Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Version Supported Versions Documentation

Picopyn - Picodata Python driver

Picopyn is a Python package for working with the distributed Picodata database.

Features

  • Connection pooling with configurable pool size
  • Optional automatic node discovery
  • Pluggable load-balancing strategies
  • Provides both asynchronous API (based on asyncpg) and synchronous API (based on psycopg)

Navigation

Installation

pip install picopyn

Or from source:

git clone https://git.picodata.io/solution/picopyn.git
cd picopyn
pip install -e .

Quickstart

import asyncio
from picopyn import Client

async def main():
    # create and connect client to the picodata cluster
    client = Client(dsn="postgresql://admin:pass@localhost:5432")
    await client.connect()

    # execute DDL operations
    await client.execute('''
        CREATE TABLE "warehouse" (id INTEGER NOT NULL, item TEXT NOT NULL, PRIMARY KEY (id)) USING memtx DISTRIBUTED BY (id) OPTION (TIMEOUT = 3.0);
    ''')

    # execute DML operations
    await client.execute('INSERT INTO \"warehouse\" VALUES ($1::int, $2::varchar)', 1, "test")
    rows = await client.fetch('SELECT * FROM \"warehouse\"')
    print(rows)

    await client.close()

asyncio.run(main())

Development

For development we use uv as package manager and docker compose for test environment.

To install development dependencies:

uv sync --extra test

Inside the test container, run the same command to keep dependencies up to date if the image is outdated:

make shell
# inside the container:
make install

Documentation

The documentation is written in Markdown and built with MkDocs using the Material theme. API reference is generated automatically from docstrings via mkdocstrings.

Published documentation is available at picopyn.readthedocs.io.

Source files are located in the docs/ directory. To work on docs locally, install the docs dependencies and start the live-reload server:

uv sync --extra docs
make doc

How to write code

We use several tools to ensure code style and type safety.

  • ruff — code style, lint checks and automatic lint fixing
  • mypy — static type checking
  • black — code formatting

To check code style and static types:

make lint

To automatically fix formatting and style issues:

make fmt

How to test

We use docker compose for test environment.

Run the general test suite:

make test

or run SSL tests:

make test-ssl

This will:

  1. Start required test containers (Picodata cluster and test-runner) using Docker Compose

  2. Execute tests using pytest

How to debug

Do not forget to run the environment via make env

For debugging purposes:

  1. Open a bash shell in the test container:
make shell
  1. For interactive Python (with asyncio support) run inside of container:
python -m asyncio
  1. To connect directly to Picodata:
picodata admin tmp/data/picodata-1-1/admin.sock

Benchmark

Benchmark instructions and usage examples are available here.

Download files

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

Source Distribution

picopyn-0.3.0.dev1.tar.gz (425.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

picopyn-0.3.0.dev1-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file picopyn-0.3.0.dev1.tar.gz.

File metadata

  • Download URL: picopyn-0.3.0.dev1.tar.gz
  • Upload date:
  • Size: 425.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for picopyn-0.3.0.dev1.tar.gz
Algorithm Hash digest
SHA256 0fafff03ce3a01ae11b4f2b361275429df8f53916be2bfe2bc4c8c2e99ae5d9c
MD5 e66440bb97f50dd7fb914d686aa28e58
BLAKE2b-256 264cc44288d9326ef88e0e5201fd99a57dee52260163f2852637f574ed7717a1

See more details on using hashes here.

File details

Details for the file picopyn-0.3.0.dev1-py3-none-any.whl.

File metadata

  • Download URL: picopyn-0.3.0.dev1-py3-none-any.whl
  • Upload date:
  • Size: 23.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for picopyn-0.3.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 ff41537008b4209dc966f69ad89ed0338a68d09df2179045db4be4fdd1dcf433
MD5 c6f1b9a82f64fa9ed935bf9adfd32a5e
BLAKE2b-256 095db3251293acbfdf45554d71d82b65dc0da24f0ec57d5f361fb9ed0b0fc35c

See more details on using hashes here.

Release history Release notifications | RSS feed

2.0.0

2 files

1.0.0

2 files

This release

0.3.0.dev1 This release

2 files

0.2.0

2 files

0.1.1

2 files

0.1

2 files

Supported by

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