Skip to main content

Picopyn - Picodata python driver

Picopyn is a Python package for working with the distributed Picodata database. It's built on top of the asyncpg package.

Features

  • Connection pooling with configurable pool size
  • Optional automatic node discovery
  • Pluggable load-balancing strategies
  • Fully asynchronous API

Navigation

Install

Install from source:

git clone https://git.picodata.io/solution/picopyn.git
cd picopyn
make install

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

Install development dependencies

pip install -r requirements-dev.txt

Documentation

To update documentation:

make gen-doc

To view documentation:

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

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 run 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/picodata-1-1/admin.sock

Benchmark

Benchmark instructions and usage examples are available here.

Metadata

Release files for picopyn 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for picopyn 0.2.0
File Size Uploaded Provenance Actions
picopyn-0.2.0.tar.gz 483.8 kB Without provenance Details for picopyn-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for picopyn 0.2.0
File Interpreter ABI Platform Actions
picopyn-0.2.0-py3-none-any.whl Python 3 none any Details for picopyn-0.2.0-py3-none-any.whl

Total release size: 501.0 kB

Release files / picopyn-0.2.0.tar.gz

Download URL picopyn-0.2.0.tar.gz
Size 483.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b17ffd79502d5bca164c765312a0ef4f3136d1bc1bb40ae52db3ad650a7f9c8a
BLAKE2b-256 checksum
How to use checksums
db5f298108a2aade034c3b1158a10c19200579c9f60a723739deaf5f1a955678
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.5 {"installer":{"name":"uv","version":"0.10.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / picopyn-0.2.0-py3-none-any.whl

Download URL picopyn-0.2.0-py3-none-any.whl
Size 17.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d393c582485c954893b2d861257b523a0ed4778a4e62650b8561947b4c7e88b0
BLAKE2b-256 checksum
How to use checksums
65bd993ec8c8a70f677f085106c720002c41cbe6aa83f6298cc08207839506d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.5 {"installer":{"name":"uv","version":"0.10.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for picopyn 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page