Welcome to pg-purepy’s documentation!

pg-purepy is a Python 3.11+ library for connecting to a PostgreSQL server. As the name suggests, it is written in pure-Python (no C dependencies), and exports three APIs:

  1. A high-level asynchronous AnyIO API based on connection pooling, that wraps multiple individual persistent connections.

  2. An mid-level asynchronous anyio API, based on singular connections, that handles the protocol parsing and networking for you.

  3. A low-level sans-IO API, which only does protocol parsing and has no niceness but is ideal for writing your own client.

Requirements

  1. pg-purepy requires at least Python 3.11.

  2. pg-purepy requires the latest version of PostgreSQL, although in practice the protocol parser should work with versions from 9.4 upwards.

API Usage