Re: Async client for PostgreSQL?

2012-09-01 Thread jwp
On Friday, August 31, 2012 10:17:18 PM UTC-7, Laszlo Nagy wrote:
 Is there any extension for Python that can do async I/O for PostgreSQL 

As others point out, the easiest route is using one of the blocking drivers 
with threads and emulate async operations.

However, the low-level parts of py-postgresql (python.projects.postgresql.org) 
were designed with arbitrary modes in mind. That is, the protocol code is 
independent of the transport so that it could be used with frameworks like 
twisted given some effort. Much of the work that will go into py-postgresql 
over the next couple years will be to make it easier to integrate into 
arbitrary frameworks. Currently, I suspect it would require some heavy 
lifting.. =\

cheers,

github.com/jwp
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: visage (interfaces)

2012-08-12 Thread jwp
On Sunday, July 29, 2012 10:18:23 PM UTC-7, jwp wrote:
 What's c.l.py's perspective on managing interfaces and implementations?

I pushed another version with support for IID references, so you can refer to 
implementations in annotations. The ultimate point of this is to give registry 
queries the ability to check for implementations with particular features:

@visage.lib.implementation('foo')
class Imp(object):
 def meth(self) - visage.lib.reference('bar'):
  ...

Imp.meth making a statement that a 'bar' implementation will be returned.

That is, consider code that is not aware of the modules that Imp is stored in 
but wants a 'foo' implementation whose meth method returns a 'bar' instance. 
Registry queries pave the way for supporting IID based implementation 
resolution. There is also the potential that registry information could be 
extracted on package installation for the purpose of an implementation index. 
Implementations could be imported on demand by modules that have no knowledge 
of the implementation.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: On-topic: alternate Python implementations

2012-08-04 Thread jwp
On Friday, August 3, 2012 11:15:20 PM UTC-7, Steven D'Aprano wrote:
 WPython - another optimizing version of Python with wordcodes instead of 
 bytecodes.
 
 http://code.google.com/p/wpython/

I remember reading about this a while ago. I thought this was eventually going 
to be committed to CPython... =\
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: visage (interfaces)

2012-07-30 Thread jwp
On Monday, July 30, 2012 6:09:10 PM UTC-7, alex23 wrote:
 a side project, so I may have some more concrete feedback soon :)

=)

 BTW I think if you rename the ReStructured Text docs to .rst github
 
 will automatically render them.

Did not know that. Gonna go do a lot of git mv's now.

Thanks.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: visage (interfaces)

2012-07-30 Thread jwp
On Monday, July 30, 2012 7:09:03 PM UTC-7, Steven D'Aprano wrote:
 Do *one* and see if github actually does render it. Then do the rest.

Did it for one project. It does render it. =)

Naturally, sphinx autodoc links don't work. =( Come-on github, use dat fundin'
-- 
http://mail.python.org/mailman/listinfo/python-list


ANN: visage (interfaces)

2012-07-29 Thread jwp
Hi,

I just pushed this up to pypi/github, and I hoped to acquire some c.l.py 
opinions.
It's experimental at this point, and might get scrapped.

visage is a loosely coupled interface registry. weakrefs make it cake to 
implement.

Basically, zope.interface, but where the interfaces are referenced by an 
identifier instead of the defining Interface class. Also, ABC registration is 
performed when the Interface becomes available so that isinstance/issubclass 
checks can be performed on Implementation instances/classes.

FWICT, pyprotocols allows for something like this, but while introducing many 
interesting concepts. (;

Currently, visage has no concept of adaption, but I'm suspecting that it could 
be built *on top* of the existing foundation.

Personally, I'd prefer to reference interfaces by an identifier. Notably, the 
idea of having to pull in a dependency in order to perform local tests that 
have no need for the formal Interface class is reason enough for me to use 
something like this instead of the existing solutions. Sure, to each their own.?

What's c.l.py's perspective on managing interfaces and implementations?

Fuck it, ship it? =)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ANN: visage (interfaces)

2012-07-29 Thread jwp
On Sunday, July 29, 2012 10:18:23 PM UTC-7, jwp wrote:
 I just pushed this up to pypi/github, and I hoped to acquire some c.l.py 
 opinions.

http://github.com/jwp/py-visage
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to represent dates BC

2012-07-28 Thread jwp
On Tuesday, July 24, 2012 2:55:29 AM UTC-7, Laszlo Nagy wrote:
   conn.getqueryvalue(select '1311-03-14 BC'::date)
 What is the good representation here? Should I implement my own date 

Do your datetime formatting in postgres: select '1311-03-14 BC'::date::text

PG does have a have a reasonable set of functions for working with datetime.
If you need something more complicated than a simple cast to text, I'd suggest 
creating a function:

CREATE OR REPLACE FUNCTION fmt_my_dates(date) RETURNS text LANGUAGE SQL AS
$$
SELECT EXTRACT(.. FROM $1)::text || ...
$$;
-- 
http://mail.python.org/mailman/listinfo/python-list


Automatic setup of meta path hooks?

2012-07-11 Thread jwp
Hi,

I'm working on a meta path hook that performs compilation of C extension 
modules on import ( github.com/jwp/py-c ; pip install c ). It mostly works, but 
I'm having a hard time finding a standard way to automatically install the hook 
upon interpreter startup.

I've thought about just having depending projects install the loader 
themselves, but I was hoping to make it seamless...Not to mention, there's the 
possibility of the case where the extension module is compiled and installed 
with setup.py. In which case, the loader isn't necessary, so it seems 
inappropriate to reference and install the meta path hook in an outer package 
module.

Am I missing something? Is there some setuptools/distribute magicalawesome that 
I can use?
-- 
http://mail.python.org/mailman/listinfo/python-list


py-postgresql 1.0 released

2010-03-31 Thread jwp
I'm pleased to announce the release of py-postgresql version 1.0,
the pure Python 3 driver for PostgreSQL formerly known as
'pg_proboscis'.

Highlights:

* CopyManager for connection-to-connection COPY operations.
* NotificationManager for receiving asynchronous notifications with
payloads.
* Advisory Lock Context Manager.
* hstore type support.
* Improved performance. 2x, in some cases.

For a more detailed list of changes, visit:
http://python.projects.postgresql.org/docs/1.0/changes.html


If you are interested in seeing this backported to Python 2.x, please
let me know.


Homepage:
http://python.projects.postgresql.org

SCM:
http://github.com/jwp/py-postgresql

Mailing List:
http://pgfoundry.org/mailman/listinfo/python-general
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


py-postgresql 0.9 Released: Speed Query Libraries

2009-06-17 Thread jwp
I'm pleased to announce the release of py-postgresql 0.9.0 and 0.8.2.

py-postgresql is a Python programmer's client (driver) for PostgreSQL
and
general toolkit for working with PostgreSQL in Python.


   
http://python.projects.postgresql.org/?utm_source=releaseutm_medium=emailutm_campaign=py-postgresql-0.9.0


Changes in 0.9:

 * Performance Improvements. Always nice. =)
 * Query Libraries--statement management.
 * Display of line and relative location of the POSITION for syntax
errors.
 * DB-API now extends PG-API.
 * Many under-the-hood improvements.


Special thanks to the following bug reporters:

 Mike Bayer [Broken DB-API row counts]
 Dallas Morisett [Broken procedure reference generation]


... Bugs, while of crunchy consistency, are fearlessly squashed.
... If you find a bug, a report would be greatly appreciated.
http://pgfoundry.org/tracker/?atid=442group_id=194
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


py-postgresql-0.8.1 for Python 3 Released: Bugs

2009-05-01 Thread jwp
I'm pleased to announce the release of py-postgresql 0.8.1.
This release marks major bug fixes for the 0.8 branch.


http://python.projects.postgresql.org


Fixes:

* Memory leak due to __del__ and circular references. [Reported by
Valentine Gogichashvili]
* Encoding normalization issue. [Reported by Marc Silver]
* Other minor issues.

Documentation: http://python.projects.postgresql.org/0.8
Source: http://python.projects.postgresql.org/files/py-postgresql-0.8.1.tar.gz
Win32 Installer: 
hhttp://python.projects.postgresql.org/files/py-postgresql-0.8.1.win32-py3.0.exe
--
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html


py-postgresql-0.8 for Python 3 Released: Was pg_proboscis

2009-04-04 Thread jwp
I'm pleased to announce the release of py-postgresql 0.8. This release
marks months of work porting the 2.x code to Python 3 and making
numerous improvements. py-postgresql is a port of pg_proboscis-1.0 and
other projects under the pg/python project umbrella. This release
simplifies the project structure by combining the smaller projects
into one easy-to-manage package.


http://python.projects.postgresql.org


Documentation:
 http://python.projects.postgresql.org/docs/0.8
Source:
 http://python.projects.postgresql.org/files/py-postgresql-0.8.0.tar.gz
Win32 Installer:
 http://python.projects.postgresql.org/files/py-postgresql-0.8.0.win32-py3.0.exe


Features:

* BSD/MIT/PSF Licensed.

* Documentation. =)

* Pure-Python + C optimizations. No need for libpq.

* Prepared Statement driven interface/native APIs. (DB-API 2.0 is here
too ;)
(PG-API, [Was: pg_greentrunk])

* Scrollable cursors with configurable direction for paging.

* COPY support. [iter(db.prepare(COPY table TO STDOUT))]

* Windows support. We love you too. ;)

* pg_python quick console.
$ pg_python -h localhost - Gives a Python prompt with a connection
bound to `db`.

* Support for most PostgreSQL types. (datetime.*, numeric-decimal,
and more)

* Composite Types and Arrays. Fully structured for easy access.

* Row-objects returned by cursors support
Mapping and Sequence interfaces. (row[colname], row[0])

* Over 150 tests and counting!


Sample PG-API code via pg_python:

$ pg_python -h localhost -U postgres -d postgres

Backslash Commands:

\?  Show this help message.
\E  Edit a file or a temporary script.
\e  Edit and Execute the file directly in the context.
\i  Execute a Python script within the interpreter's context.
\setConfigure environment variables. \set without arguments to
show all
\x  Execute the Python command within this process.

Python 3.0.1+ (release30-maint:70204M, Mar  5 2009, 21:28:06)
Type help, copyright, credits or license for more information.
(ExtendedConsole)
 ps = db.prepare('select 1')
 ps()
[(1,)]
 ps.first()
1
 c = ps.declare()
 c.read()
[(1,)]
 c.seek(0)
 c.read()
[(1,)]
--
http://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations.html