Contributing¶
Thanks for your interest in contributing to pyfs-watcher!
Prerequisites¶
- Python 3.9+
- Rust 1.77+ (install via rustup)
- maturin — Python/Rust build tool
Dev Setup¶
# Clone the repository
git clone https://github.com/pratyush618/pyfs-watcher.git
cd pyfs-watcher
# Create a virtual environment
uv venv && source .venv/bin/activate
# or: python -m venv .venv && source .venv/bin/activate
# Install dev dependencies
uv pip install -e ".[dev]"
# or: pip install -e ".[dev]"
# Build the Rust extension
maturin develop
# Install pre-commit hooks
pre-commit install
Running Tests¶
# Rust tests
cargo test
# Python tests
pytest tests/
# Run a specific test
pytest tests/test_hash.py -v
Code Quality¶
Python¶
# Lint
ruff check py_src/ tests/ benches/
# Format
ruff format py_src/ tests/ benches/
# Type check
mypy py_src/
Rust¶
Pre-commit Hooks¶
Pre-commit hooks run automatically on git commit. To run them manually:
Adding a New Feature¶
Checklist for adding a new module (e.g., compress):
- Rust implementation — Create
src/compress.rswith the core logic - PyO3 bindings — Add
#[pyfunction]and#[pyclass]items, register insrc/lib.rs - Type stubs — Add signatures to
py_src/pyfs_watcher/_core.pyi - Python re-exports — Add functions to
py_src/pyfs_watcher/__init__.py, data classes totypes.py, and errors toerrors.py - Error type — Add a
CompressErrorvariant toerrors.rsand the.pyistub - Tests — Add
tests/test_compress.py - Documentation — Add guide page and API reference page
- README — Add usage example
Building Docs Locally¶
# Install Zensical
pip install zensical
# or: uv pip install zensical
# Serve with live reload
zensical serve
# Build static site
zensical build --clean
Open http://localhost:8000 to preview.
Pull Requests¶
- Create a feature branch from
master - Make sure all tests pass (
cargo test && pytest tests/) - Make sure linters pass (
ruff check,cargo fmt --check,cargo clippy) - Write a clear PR description explaining what and why