Name | picopyn JSON |
Version |
0.1.1
JSON |
| download |
home_page | None |
Summary | Async connector for working with the distributed Picodata database. |
upload_time | 2025-09-03 19:50:56 |
maintainer | None |
docs_url | None |
author | None |
requires_python | ==3.9 |
license | BSD-2-Clause |
keywords |
database
picodata
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Picopyn - Picodata python driver
**Picopyn** is a Python package for working with the distributed Picodata database. It's built on top of the [asyncpg](https://github.com/MagicStack/asyncpg) package.
## Features
* Connection pooling with configurable pool size
* Optional automatic node discovery
* Pluggable load-balancing strategies
* Fully asynchronous API
## Navigation
* [Installation](#install-driver)
* [Quickstart](#simple-start)
* [Development](#dev)
* [Benchmark](#bench)
## <a name="install-driver"></a>Install
Install from source:
``` sh
git clone https://git.picodata.io/solution/picopyn.git
cd picopyn
make install
```
## <a name="simple-start"></a>Quickstart
```python
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())
```
## <a name="dev"></a>Development
Install development dependencies
```bash
pip install -r requirements-dev.txt
```
### Documentation
To update documentation:
```bash
make gen-doc
```
To view documentation:
```bash
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:
```bash
make lint
````
To automatically fix formatting and style issues:
```bash
make fmt
```
### How to test
Run the test suite:
```bash
make test
```
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:
```bash
make shell
```
2. For interactive Python (with asyncio support) run inside of container:
```bash
python -m asyncio
```
3. To connect directly to Picodata:
```bash
picodata admin tmp/picodata-1-1/admin.sock
```
## <a name="bench"></a>Benchmark
Benchmark instructions and usage examples are available [here](benchmark/README.md).
Raw data
{
"_id": null,
"home_page": null,
"name": "picopyn",
"maintainer": null,
"docs_url": null,
"requires_python": "==3.9",
"maintainer_email": null,
"keywords": "database, picodata",
"author": null,
"author_email": "Asya Lomakina <a.lomakina@picodata.io>, Igor Kuznetsov <i.kuznetsov@picodata.io>, Dmitriy \u041aoltsov <dkoltsov@picodata.io>",
"download_url": "https://files.pythonhosted.org/packages/8b/cc/fd4275bd4ef95d5fbc40453d7962b72996b186d96d3aee1bcfc5a9678886/picopyn-0.1.1.tar.gz",
"platform": null,
"description": "# Picopyn - Picodata python driver\n\n**Picopyn** is a Python package for working with the distributed Picodata database. It's built on top of the [asyncpg](https://github.com/MagicStack/asyncpg) package.\n\n## Features\n* Connection pooling with configurable pool size\n* Optional automatic node discovery\n* Pluggable load-balancing strategies\n* Fully asynchronous API\n\n## Navigation\n* [Installation](#install-driver)\n* [Quickstart](#simple-start)\n* [Development](#dev)\n* [Benchmark](#bench)\n\n## <a name=\"install-driver\"></a>Install\n\nInstall from source:\n\n``` sh\ngit clone https://git.picodata.io/solution/picopyn.git\ncd picopyn\nmake install\n```\n\n## <a name=\"simple-start\"></a>Quickstart\n\n```python\nimport asyncio\nfrom picopyn import Client\n\nasync def main():\n # create and connect client to the picodata cluster\n client = Client(dsn=\"postgresql://admin:pass@localhost:5432\")\n await client.connect()\n\n # execute DDL operations\n await client.execute('''\n CREATE TABLE \"warehouse\" (id INTEGER NOT NULL, item TEXT NOT NULL, PRIMARY KEY (id)) USING memtx DISTRIBUTED BY (id) OPTION (TIMEOUT = 3.0);\n ''')\n\n # execute DML operations\n await client.execute('INSERT INTO \\\"warehouse\\\" VALUES ($1::int, $2::varchar)', 1, \"test\")\n rows = await client.fetch('SELECT * FROM \\\"warehouse\\\"')\n print(rows)\n\n await client.close()\n\nasyncio.run(main())\n```\n\n## <a name=\"dev\"></a>Development\n\nInstall development dependencies\n```bash\npip install -r requirements-dev.txt\n```\n\n### Documentation\n\nTo update documentation:\n```bash\nmake gen-doc\n```\n\nTo view documentation:\n```bash\nmake doc\n```\n\n### How to write code\n\nWe use several tools to ensure code style and type safety.\n* ruff \u2014 code style, lint checks and automatic lint fixing\n* mypy \u2014 static type checking\n* black \u2014 code formatting\n\nTo check code style and static types:\n```bash\nmake lint\n````\n\nTo automatically fix formatting and style issues:\n\n```bash\nmake fmt\n```\n\n### How to test\n\nRun the test suite:\n\n```bash\nmake test\n```\n\nThis will:\n\n1. Start required test containers (Picodata cluster and test-runner) using Docker Compose\n\n2. Execute tests using pytest\n\n\n### How to debug\n\nDo not forget run environment via `make env`\n\nFor debugging purposes:\n\n1. Open a bash shell in the test container:\n\n```bash\nmake shell\n```\n\n2. For interactive Python (with asyncio support) run inside of container:\n\n```bash\npython -m asyncio\n```\n\n3. To connect directly to Picodata:\n\n```bash\npicodata admin tmp/picodata-1-1/admin.sock\n```\n## <a name=\"bench\"></a>Benchmark\n\nBenchmark instructions and usage examples are available [here](benchmark/README.md).\n",
"bugtrack_url": null,
"license": "BSD-2-Clause",
"summary": "Async connector for working with the distributed Picodata database.",
"version": "0.1.1",
"project_urls": {
"Homepage": "https://git.picodata.io/solution/picopyn"
},
"split_keywords": [
"database",
" picodata"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "cd9fc1b975415ed4bf030d2303855d8d8d9e13ad2c62f565050d8f5d67036937",
"md5": "c354c2318d56cf18ef2a0bf4cfe3083f",
"sha256": "11bc91c45b9f4412659f0f7615b0895f2a991f01571bcba39c850e494df419ec"
},
"downloads": -1,
"filename": "picopyn-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c354c2318d56cf18ef2a0bf4cfe3083f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "==3.9",
"size": 9329,
"upload_time": "2025-09-03T19:50:55",
"upload_time_iso_8601": "2025-09-03T19:50:55.014202Z",
"url": "https://files.pythonhosted.org/packages/cd/9f/c1b975415ed4bf030d2303855d8d8d9e13ad2c62f565050d8f5d67036937/picopyn-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "8bccfd4275bd4ef95d5fbc40453d7962b72996b186d96d3aee1bcfc5a9678886",
"md5": "e7fa76770403e89086fd9cc25b133cfb",
"sha256": "86c42002a998b14446687f63041743241bc3d2e5c36f32a89d9f1720d701cae1"
},
"downloads": -1,
"filename": "picopyn-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "e7fa76770403e89086fd9cc25b133cfb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "==3.9",
"size": 519235,
"upload_time": "2025-09-03T19:50:56",
"upload_time_iso_8601": "2025-09-03T19:50:56.732067Z",
"url": "https://files.pythonhosted.org/packages/8b/cc/fd4275bd4ef95d5fbc40453d7962b72996b186d96d3aee1bcfc5a9678886/picopyn-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-03 19:50:56",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "picopyn"
}