Development¶
This guide covers how to set up a development environment and contribute to ptars.
Prerequisites¶
- Python 3.10+
- Rust (latest stable)
- just as a command runner
- uv for Python dependency management
- maturin for building the Rust/Python package
Setting Up the Development Environment¶
Most development tasks are available via the justfile.
Create Virtual Environment and Install Dependencies¶
This will:
- Create a virtual environment in
.venv - Install dependencies using uv
- Compile the protobuf files
- Build the Rust extension with maturin
Special Case for ARM Mac¶
Add this to your .bashrc or .zshrc:
Running Tests¶
Run both Python and Rust tests:
Or run them separately:
Building¶
Build the package locally:
Build distribution wheels using Docker:
Linting¶
Run all linters (Rust formatter, clippy, prek):
Code Coverage¶
First, install coverage tools:
Then run coverage:
Benchmarking¶
Run benchmarks comparing ptars to protarrow:
Note
Make sure to install the release version for accurate benchmarks. The debug build is much slower.
Releasing¶
Create a release from a new tag in Github. The CI takes care of the rest.
CI¶
The CI script for releases is auto-generated, though it had to be customized.
Project Structure¶
ptars/
├── ptars/ # Core Rust library
├── ptars-python/ # Python bindings (PyO3)
├── python/
│ ├── ptars/ # Python package
│ └── test/ # Python tests
├── protos/ # Protobuf definitions for tests
├── docs/ # Documentation (MkDocs)
└── scripts/ # Build scripts