This document describes how to contribute to typeid-python.
Thank you for taking the time to contribute ❤️
- Linux or macOS (development is primarily tested on Unix-like systems)
- A supported Python version (Python 3.10+; latest tested: Python 3.14)
uv– fast Python package manager and environment tool
- Rust toolchain (
rustc,cargo) maturin(installed automatically viauvif needed)
Rust is optional.
The project must always work in pure Python mode.
- Fork the repository on GitHub.
- Clone your fork locally:
git clone https://github.com/akhundMurad/typeid-python.git
cd typeid-python
### 2. Install `uv`
```bash
curl -LsSf https://astral.sh/uv/install.sh | shVerify installation:
uv --versionCreate and sync the virtual environment (including dev dependencies):
uv sync --all-groups --all-extras
uv run pre-commit installThis will:
- create a local
.venv/ - install dependencies according to
uv.lock - keep the environment reproducible
- setup pre-commit hooks
Run the full test suite:
make testor directly:
uv run pytest -vTests are expected to pass in both:
- pure Python mode
- Rust-accelerated mode (if available)
TypeID includes an optional Rust extension used for performance-critical paths (e.g. base32 encode/decode).
If you have Rust installed:
cd rust-base32
maturin developThis installs the native extension into the active virtual environment.
You can verify which backend is active via tests.
Contributors must not break the pure Python fallback.
To test fallback behavior:
pytest tests/test_base32.pyThis suite verifies that:
- Rust is used when available
- Python fallback is used when Rust is unavailable
If your change affects performance-sensitive code paths (generation, parsing, base32):
Run benchmarks locally:
./bench/run.shBenchmark results are:
- reproducible
- stored as raw JSON
- compared across versions
When making performance claims, include:
- before/after numbers
- raw benchmark JSON (if applicable)
We use:
- ruff – linting & import sorting
- black – code formatting
- mypy – static type checking
Run all linters:
make lintAuto-fix formatting where possible:
make lint-fixBuild wheel and source distribution:
make build-sdistThis uses uv build under the hood.
Rust wheels are built automatically in CI when applicable.
To test the CLI extra locally:
uv sync --all-groups --extra cli
uv run typeid new -p testuv.lockmust be committed- Always change dependencies via
uv add/uv remove - CI uses
uv sync --locked - Lockfile drift will fail builds
Branch names are flexible, as long as they are respectful and descriptive.
Recommended patterns:
fix/core/32feature/rust-base32perf/lazy-uuiddocs/readme-updatechore/ci-cleanup
Referencing an issue number is encouraged but not required.
- Create a feature branch
- Ensure tests and linters pass
- Ensure Python fallback still works
- Commit with a clear message
- Open a pull request against
main - Describe what changed and why
Performance-related PRs should explain:
- which path was optimized
- what benchmark changed
- why the change is safe
Happy hacking 🚀 If anything is unclear, feel free to open an issue or discussion.