Tonbo Python Binding
This package intends to build a native python binding for Tonbo.
Tonbo's Python bindings can be used to build data-intensive applications, including other types of databases.
Example
from tonbo import DbOption, Column, DataType, Record, TonboDB, Bound
from tonbo.fs import from_filesystem_path
import asyncio
import os
# define a Tonbo record
@Record
class User:
age = Column(DataType.Int8, name="age", primary_key=True)
height = Column(DataType.Int16, name="height", nullable=True)
weight = Column(DataType.Int8, name="weight", nullable=False)
async def main():
if not os.path.exists("db_path/users"):
os.makedirs("db_path/users")
db = TonboDB(DbOption(from_filesystem_path("db_path/users")), User())
await db.insert(User(age=18, height=175, weight=60))
record = await db.get(18)
assert record == {"age": 18, "height": 175, "weight": 60}
txn = await db.transaction()
txn.insert(User(age=19, height=195, weight=75))
result = await txn.get(19)
assert result == {"age": 19, "height": 195, "weight": 75}
# commit transaction
await txn.commit()
txn = await db.transaction()
# range scan, supports pushing down and limit
scan = await txn.scan(
Bound.Excluded(18), None, limit=100, projection=["age", "weight"]
)
async for record in scan:
print(record)
asyncio.run(main())
See examples for more information.
Roadmap
- Remote storage API mapping and test
- Integrate with other Arrow analytical tools
Development
This assumes that you have Rust and cargo installed. We use the pyo3 to generate a native Python module and use maturin to build Rust-based Python packages.
First, follow the commands below to build a new Python virtualenv, and install maturin into the virtualenv using Python's package manager, pip:
# setup virtualenv
python -m venv .env
# activate venv
source .env/bin/activate
# install maturin
pip install maturin
# build bindings
maturin develop
Whenever Rust code changes run:
maturin develop
Run tests:
maturin develop -E test
python -m pytest
Metadata
Release files for tonbo 0.1.0
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 |
|---|---|---|---|---|
| tonbo-0.1.0.tar.gz | 5.9 MB | Without provenance | Details for tonbo-0.1.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| tonbo-0.1.0-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details for tonbo-0.1.0-cp310-abi3-win_amd64.whl |
| tonbo-0.1.0-cp310-abi3-win32.whl | CPython 3.10 | abi3 | Windows x86-32 | Details for tonbo-0.1.0-cp310-abi3-win32.whl |
| tonbo-0.1.0-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details for tonbo-0.1.0-cp310-abi3-macosx_11_0_arm64.whl |
| tonbo-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl | CPython 3.10 | abi3 | macOS 10.12+ x86-64 | Details for tonbo-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl |
Total release size: 28.6 MB
Release files / tonbo-0.1.0.tar.gz
| Download URL | tonbo-0.1.0.tar.gz |
|---|---|
| Size | 5.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b8d9344b96fd08be48fa9316a306451e6e6ceb32b52f0411019f71f0fdfb375f
|
|
BLAKE2b-256 checksum How to use checksums |
48ad741d09850c0de43552e02817e73d7c59056e2f13c3e46b457ffda76dafc4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.7.4
|
Release files / tonbo-0.1.0-cp310-abi3-win_amd64.whl
| Download URL | tonbo-0.1.0-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 5.8 MB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
82b37f9c0ebb93de3861d1d7859d424e449d5b86510fe8de495ad4faaa8a3d30
|
|
BLAKE2b-256 checksum How to use checksums |
b285df10dbfa59905192220f789d437aa35387e87f1b6eff7fb7ca6f7dfece39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.7.4
|
Release files / tonbo-0.1.0-cp310-abi3-win32.whl
| Download URL | tonbo-0.1.0-cp310-abi3-win32.whl |
|---|---|
| Size | 5.0 MB |
| Tags | CPython 3.10 Windows x86-32 abi3 |
|
SHA-256 checksum How to use checksums |
63f0dfe82958405f0b293ad6cf37c3fa4a94b3fd092de6934d49d7a27cae3275
|
|
BLAKE2b-256 checksum How to use checksums |
16b236fdfaf3b6e225925c8f8b8df2432e7b888f6dfe05dcc6a119db624c71c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.7.4
|
Release files / tonbo-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | tonbo-0.1.0-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 5.7 MB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b8b4159ca555d39d8d5e34dcf798e3b97b49d09a421c03b66593d339592fb039
|
|
BLAKE2b-256 checksum How to use checksums |
74d425cefbec006bb4ad38615714bf7f98fb1c9ae0eba5fe5cb3ce199866b5a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.7.4
|
Release files / tonbo-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | tonbo-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 6.1 MB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
7c4f6be7969d298679ff53b364311cc205bf83a7bbe1a04995aa38aaae542ab2
|
|
BLAKE2b-256 checksum How to use checksums |
53799aae6f4931f7b554a9d2d60daeebe323f9a3afbbcd52e9495b919455fab9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.7.4
|
Security for tonbo 0.1.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.