mirror of
https://github.com/Cian-H/read_aconity_layers.git
synced 2026-07-13 02:24:49 +01:00
Update Toolchains (uv, ty, python, maturin, rust 2024) (#69)
* WIP: Fixed non-deterministic test error * Updated tooling to use uv/ty instead of poetry/mypy * Updated python/rust/maturin versions * Added mac os to testing pipelines * Properly enforced fixed with csv reading * Minor tweaks for maintainability * Minor version bump * track npz files with git-lfs * fix: add macos dynamic lookup linker flags for pyo3
This commit is contained in:
+16
-18
@@ -14,7 +14,7 @@ Prerequisites
|
||||
|
||||
- Rust 1.70+ with Cargo
|
||||
- Python 3.11+
|
||||
- Poetry
|
||||
- uv
|
||||
- Git
|
||||
|
||||
Environment Setup
|
||||
@@ -31,19 +31,19 @@ Environment Setup
|
||||
|
||||
.. code:: bash
|
||||
|
||||
poetry install --with dev,docs
|
||||
uv sync --group dev --group docs
|
||||
|
||||
#. **Setup pre-commit hooks:**
|
||||
|
||||
.. code:: bash
|
||||
|
||||
poetry run pre-commit install
|
||||
uv run pre-commit install
|
||||
|
||||
#. **Build the Rust extension:**
|
||||
|
||||
.. code:: bash
|
||||
|
||||
poetry run maturin develop
|
||||
uv run maturin develop
|
||||
|
||||
************************
|
||||
Code Style and Quality
|
||||
@@ -55,7 +55,7 @@ Python Code
|
||||
===========
|
||||
|
||||
- **Ruff**: For linting and formatting
|
||||
- **MyPy**: For type checking
|
||||
- **ty**: For type checking
|
||||
- **Pytest**: For testing
|
||||
|
||||
Run quality checks:
|
||||
@@ -63,14 +63,14 @@ Run quality checks:
|
||||
.. code:: bash
|
||||
|
||||
# Format and lint Python code
|
||||
poetry run ruff format .
|
||||
poetry run ruff check .
|
||||
uv run ruff format .
|
||||
uv run ruff check .
|
||||
|
||||
# Type checking
|
||||
poetry run mypy .
|
||||
uv run ty check
|
||||
|
||||
# Run tests
|
||||
poetry run pytest
|
||||
uv run pytest
|
||||
|
||||
Rust Code
|
||||
=========
|
||||
@@ -105,10 +105,10 @@ Running Tests
|
||||
.. code:: bash
|
||||
|
||||
# Run all tests
|
||||
poetry run pytest
|
||||
uv run pytest
|
||||
|
||||
# Run with coverage
|
||||
poetry run pytest --cov=read_aconity_layers
|
||||
uv run pytest --cov=read_aconity_layers
|
||||
|
||||
# Run Rust tests
|
||||
cargo test
|
||||
@@ -144,14 +144,14 @@ Building Documentation
|
||||
.. code:: bash
|
||||
|
||||
# Install documentation dependencies
|
||||
poetry install --with docs
|
||||
uv sync --group docs
|
||||
|
||||
# Build documentation
|
||||
cd docs
|
||||
make html
|
||||
|
||||
# Or build manually
|
||||
poetry run sphinx-build -b html . _build/html
|
||||
uv run sphinx-build -b html . _build/html
|
||||
|
||||
# Serve locally (optional)
|
||||
make serve
|
||||
@@ -199,9 +199,8 @@ The project uses pre-commit hooks that run automatically:
|
||||
|
||||
- Code formatting (Ruff, rustfmt)
|
||||
- Linting (Ruff, Clippy)
|
||||
- Type checking (MyPy)
|
||||
- Type checking (ty)
|
||||
- Version bump validation
|
||||
- Poetry validation
|
||||
|
||||
These checks must pass before commits are accepted.
|
||||
|
||||
@@ -253,7 +252,7 @@ Adding a New Function
|
||||
|
||||
#. **Implement in Rust** (``src/rust_fn/mod.rs``)
|
||||
#. **Add Python binding** (``src/lib.rs``)
|
||||
#. **Update type stubs** (``read_layers.pyi``)
|
||||
#. **Update type stubs** (``read_aconity_layers.pyi``)
|
||||
#. **Add tests** for both Rust and Python
|
||||
#. **Update documentation**
|
||||
|
||||
@@ -262,8 +261,7 @@ Debugging Build Issues
|
||||
|
||||
- **Check Rust version**: Must be 1.70+
|
||||
- **Verify PyO3 compatibility**: Should match Python version
|
||||
- **Clear build cache**: ``cargo clean`` and ``poetry env remove
|
||||
--all``
|
||||
- **Clear build cache**: ``cargo clean`` and ``rm -rf .venv``
|
||||
- **Check dependencies**: Ensure all dev dependencies are installed
|
||||
|
||||
Profiling Performance
|
||||
|
||||
@@ -28,7 +28,7 @@ Prerequisites
|
||||
|
||||
- Rust 1.70 or higher
|
||||
- Python 3.11 or higher
|
||||
- Poetry (for development)
|
||||
- uv (for development)
|
||||
|
||||
Build Steps
|
||||
===========
|
||||
@@ -44,19 +44,19 @@ Build Steps
|
||||
|
||||
.. code:: bash
|
||||
|
||||
poetry install
|
||||
uv sync
|
||||
|
||||
#. Build the Rust extension:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
poetry run maturin develop
|
||||
uv run maturin develop
|
||||
|
||||
#. Run tests to verify installation:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
poetry run pytest
|
||||
uv run pytest
|
||||
|
||||
**************************
|
||||
Development Installation
|
||||
@@ -66,12 +66,12 @@ For development work, you'll also want the development dependencies:
|
||||
|
||||
.. code:: bash
|
||||
|
||||
poetry install --with dev,docs
|
||||
uv sync --group dev --group docs
|
||||
|
||||
This installs additional tools for:
|
||||
|
||||
- Code formatting (ruff)
|
||||
- Type checking (mypy)
|
||||
- Type checking (ty)
|
||||
- Testing (pytest)
|
||||
- Documentation building (sphinx)
|
||||
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
# Justfile for Sphinx documentation
|
||||
|
||||
_sphinxopts := ""
|
||||
_sphinxbuild := "poetry run sphinx-build"
|
||||
_sphinxbuild := "uv run sphinx-build"
|
||||
_sourcedir := "."
|
||||
_builddir := "./_build"
|
||||
|
||||
@@ -23,7 +23,7 @@ ensure-rustdocgen:
|
||||
build-extension:
|
||||
@echo "Checking Rust toolchain..."
|
||||
@which cargo > /dev/null || (echo "Error: Rust/Cargo not found. Please install Rust toolchain." && exit 1)
|
||||
cd .. && poetry run maturin develop
|
||||
cd .. && uv run maturin develop
|
||||
|
||||
# Clean build directory
|
||||
clean builddir=_builddir:
|
||||
@@ -45,7 +45,7 @@ serve sphinxbuild=_sphinxbuild sourcedir=_sourcedir builddir=_builddir sphinxopt
|
||||
|
||||
# Build documentation with live reload (requires sphinx-autobuild)
|
||||
livehtml sourcedir=_sourcedir builddir=_builddir sphinxopts=_sphinxopts: ensure-rustdocgen build-extension
|
||||
poetry run sphinx-autobuild "{{sourcedir}}" "{{builddir}}/html" {{sphinxopts}}
|
||||
uv run sphinx-autobuild "{{sourcedir}}" "{{builddir}}/html" {{sphinxopts}}
|
||||
|
||||
# Check for broken links
|
||||
linkcheck sphinxbuild=_sphinxbuild sourcedir=_sourcedir builddir=_builddir sphinxopts=_sphinxopts:
|
||||
|
||||
Reference in New Issue
Block a user