New generation PostgreSQL database adapter for the Python programming language https://www.psycopg.org/psycopg3/
Go to file
Daniele Varrazzo 3c59850cd2 docs: add docs about connection pool logging 2023-09-20 11:07:56 +02:00
.github ci: fix building Python 3.7 extension on windows using delvewheel 1.5.1 2023-09-15 17:44:43 +02:00
docs docs: add docs about connection pool logging 2023-09-20 11:07:56 +02:00
psycopg chore: constrain importlib metadata to the version supporting Python 3.7 2023-09-15 17:38:25 +02:00
psycopg_c fix(c): fix loading of intervals with days and months or years 2023-09-19 22:23:21 +02:00
psycopg_pool chore: constrain importlib metadata to the version supporting Python 3.7 2023-09-15 17:38:25 +02:00
tests fix(c): fix loading of intervals with days and months or years 2023-09-19 22:23:21 +02:00
tools chore(binary): bump depending libraries 2023-09-04 01:28:57 +01:00
.codespellrc Configure codespell to run on a dirty working directory 2022-02-06 01:24:17 +01:00
.flake8 ci: drop tox from tests 2022-12-18 19:12:23 +00:00
.gitignore build: add scripts to build macOS arm64 packages 2022-07-28 13:22:10 +02:00
.yamllint.yaml Yaml lint 2021-03-06 01:08:04 +01:00
BACKERS.yaml docs: allow square logos in the sponsors page 2023-08-18 16:41:20 +01:00
LICENSE.txt Added license 2020-03-31 15:15:35 +13:00
README.rst fixed broken link to pip docs 2023-02-03 15:34:13 +01:00
pyproject.toml feat: add numpy dumpers for int, float, bool types 2023-08-05 15:21:30 +01:00

README.rst

Psycopg 3 -- PostgreSQL database adapter for Python

Psycopg 3 is a modern implementation of a PostgreSQL adapter for Python.

Installation

Quick version:

pip install --upgrade pip               # upgrade pip to at least 20.3
pip install "psycopg[binary,pool]"      # install binary dependencies

For further information about installation please check the documentation.

Hacking

In order to work on the Psycopg source code you need to have the libpq PostgreSQL client library installed in the system. For instance, on Debian systems, you can obtain it by running:

sudo apt install libpq5

After which you can clone this repository:

git clone https://github.com/psycopg/psycopg.git
cd psycopg

Please note that the repository contains the source code of several Python packages: that's why you don't see a setup.py here. The packages may have different requirements:

  • The psycopg directory contains the pure python implementation of psycopg. The package has only a runtime dependency on the libpq, the PostgreSQL client library, which should be installed in your system.
  • The psycopg_c directory contains an optimization module written in C/Cython. In order to build it you will need a few development tools: please look at Local installation in the docs for the details.
  • The psycopg_pool directory contains the connection pools implementations. This is kept as a separate package to allow a different release cycle.

You can create a local virtualenv and install there the packages in development mode__, together with their development and testing requirements:

python -m venv .venv
source .venv/bin/activate
pip install -e "./psycopg[dev,test]"    # for the base Python package
pip install -e ./psycopg_pool           # for the connection pool
pip install ./psycopg_c                 # for the C speedup module

Please add --config-settings editable_mode=strict to the pip install -e above if you experience editable mode broken__.

Now hack away! You can run the tests using:

psql -c 'create database psycopg_test'
export PSYCOPG_TEST_DSN="dbname=psycopg_test"
pytest