Skip to main content

.. image:: https://travis-ci.org/chtd/psycopg2cffi.svg

Project description

https://travis-ci.org/chtd/psycopg2cffi.svg

An implementation of the psycopg2 module using cffi. The module is currently compatible with Psycopg 2.5.

You can install psycopg2cffi from pypi:

pip install psycopg2cffi

Or from source:

python setup.py develop

Installation requirements are the same as for psycopg2 - you must have libpq headers, pg_config somewhere on your $PATH. Installation was tested on Ubuntu 12.04 and CentOS (RHEL 5.0). It should be possible to make it work on Windows, but I did not even test it.

This module is only tested with python 2.6+, python 3.2+ and PyPy 2.x (and will definityly not work on PyPy 1.9).

To use this package with Django or SQLAlchemy invoke a compatability hook (for example, from settings.py in case of django, or from a psycopg2.py file in site-packages of your virtual env):

from psycopg2cffi import compat
compat.register()

This will map psycopg2cffi to psycopg2.

Submit issues to https://github.com/chtd/psycopg2cffi/issues

If you notice that psycopg2cffi under PyPy is noticably slower than psycopg2 under CPython, submit this to the issues too - it should not be the case.

This is a port of (Michael van Tellingen port https://github.com/mvantellingen/psycopg2-ctypes of Alex Gaynor’s rpython port (https://bitbucket.org/alex_gaynor/pypy-postgresql/overview) of psycopg2 to python + ctypes) to cffi.

The main motivation for a port was speed - the writeup with benchmarks is here: http://chtd.ru/blog/bystraya-rabota-s-postgres-pod-pypy/?lang=en

Development

To run tests, install pytest and run them with:

py.test psycopg2cffi

You can also run Django tests. You need to checkout django source, add psycopg2 compat as described above, and, from the root of the django checkout:

PYTHONPATH=`pwd` ./tests/runtests.py \
    --settings=psycopg2cffi.tests.psycopg2_tests.testconfig

In case of problems with django tests, see official django docs https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#running-the-unit-tests

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

psycopg2cffi-2.6.0.tar.gz (68.9 kB view details)

Uploaded Source

File details

Details for the file psycopg2cffi-2.6.0.tar.gz.

File metadata

  • Download URL: psycopg2cffi-2.6.0.tar.gz
  • Upload date:
  • Size: 68.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for psycopg2cffi-2.6.0.tar.gz
Algorithm Hash digest
SHA256 60d8a86728e2e6eee9f4077fd4cefb06cd95ae8c91c331c2361dce3d7b9701a0
MD5 cc71f2d961e58e8ae4f8c7cb4d5dc987
BLAKE2b-256 00bf5fbf920ddf1b323b4f353b342f732b86dad4c1efb172ca050c46e0da1f35

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page