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 test suite:
make test
This will:
-
Start required test containers (Picodata cluster and test-runner) using Docker Compose
-
Execute tests using pytest
How to debug
Do not forget run environment via make env
For debugging purposes:
- Open a bash shell in the test container:
make shell
- For interactive Python (with asyncio support) run inside of container:
python -m asyncio
- 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.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| picopyn-0.1.1.tar.gz | 519.2 kB | Without provenance | Details for picopyn-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| picopyn-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for picopyn-0.1.1-py3-none-any.whl |
Total release size: 528.6 kB
Release files / picopyn-0.1.1.tar.gz
| Download URL | picopyn-0.1.1.tar.gz |
|---|---|
| Size | 519.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
86c42002a998b14446687f63041743241bc3d2e5c36f32a89d9f1720d701cae1
|
|
BLAKE2b-256 checksum How to use checksums |
8bccfd4275bd4ef95d5fbc40453d7962b72996b186d96d3aee1bcfc5a9678886
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.2
|
Release files / picopyn-0.1.1-py3-none-any.whl
| Download URL | picopyn-0.1.1-py3-none-any.whl |
|---|---|
| Size | 9.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
11bc91c45b9f4412659f0f7615b0895f2a991f01571bcba39c850e494df419ec
|
|
BLAKE2b-256 checksum How to use checksums |
cd9fc1b975415ed4bf030d2303855d8d8d9e13ad2c62f565050d8f5d67036937
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.2
|
Security for picopyn 0.1.1
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.