From ba025f094a5303e129472ffbbb84eb7d30bc0b40 Mon Sep 17 00:00:00 2001 From: Martin Schuck Date: Tue, 30 Jun 2026 19:33:23 +0200 Subject: [PATCH] Add uv support. Fixes #72 --- .gitignore | 3 +++ README.md | 12 +++++++++-- docs/get-started/installation.md | 36 +++++++++++++++++++++++++++----- pyproject.toml | 27 ++++++++++++++++++++++++ 4 files changed, 71 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 20a9481..226ae79 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,9 @@ benchmark/data .pixi *.egg-info +# uv (lockfile intentionally not committed; pixi.lock is the reproducible env) +uv.lock + # ProperDocs build output site/ # Temporary files diff --git a/README.md b/README.md index badea95..6336249 100644 --- a/README.md +++ b/README.md @@ -50,14 +50,22 @@ pip install crazyflow # CPU pip install "crazyflow[gpu]" # GPU (Linux x86-64, CUDA 12) ``` -Developer install with editable submodules ([pixi](https://pixi.sh/) required): +Developer install with editable install ([pixi](https://pixi.sh/) recommended): ```bash -git clone --recurse-submodules https://github.com/learnsyslab/crazyflow.git +git clone https://github.com/learnsyslab/crazyflow.git cd crazyflow pixi shell ``` +Or with [uv](https://docs.astral.sh/uv/): + +```bash +git clone https://github.com/learnsyslab/crazyflow.git +cd crazyflow +uv sync # core + dev tooling (tests, docs, ruff) +``` + ## Performance First-principles dynamics, one drone. CPU: AMD Ryzen 9 7950X. GPU: NVIDIA RTX 4090. diff --git a/docs/get-started/installation.md b/docs/get-started/installation.md index f51e5fe..9fe2d45 100644 --- a/docs/get-started/installation.md +++ b/docs/get-started/installation.md @@ -30,6 +30,15 @@ Select your installation method from the tabs below, then read the notes under e pixi shell -e tests ``` +=== "uv" + + ```bash + git clone https://github.com/learnsyslab/crazyflow.git + cd crazyflow + uv sync # core + dev tooling (tests, docs, ruff) + uv run python -c "from crazyflow.sim import Sim; Sim().reset()" + ``` + --- ## GPU support @@ -41,16 +50,33 @@ JAX defaults to CPU-only execution. The `gpu` extra swaps in `jax[cuda12]`, enab ## Developer install -[Pixi](https://pixi.sh/) creates a fully reproducible environment. This variant installs `crazyflow` in editable mode. Any source change takes effect immediately without reinstalling. Recommended for contributors and researchers who modify the simulator. +[Pixi](https://pixi.sh/) creates a fully reproducible environment (locked via `pixi.lock`). This variant installs `crazyflow` in editable mode. Any source change takes effect immediately without reinstalling. Recommended for contributors and researchers who modify the simulator. + +[uv](https://docs.astral.sh/uv/) is supported as an alternative. `uv sync` creates a `.venv` with `crazyflow` installed editable plus the `dev` dependency group (tests, docs, ruff). The dependency groups (`tests`, `docs`, `dist`, `dev`) mirror the pixi features and are defined under `[dependency-groups]` in `pyproject.toml`. The uv lockfile is not committed — `pixi.lock` remains the canonical reproducible environment. + +```bash +uv sync # core + dev group (default) +uv sync --group docs # only the docs group + core +uv sync --no-default-groups --extra gpu # core + GPU extra, no dev tooling +``` ## Testing Adds `pytest` and `pytest-markdown-docs` for running the test suite and doc snippet tests. -```bash -pixi run tests # unit and integration tests -pixi run test-docs # doc code snippet tests -``` +=== "pixi" + + ```bash + pixi run tests # unit and integration tests + pixi run test-docs # doc code snippet tests + ``` + +=== "uv" + + ```bash + uv run pytest -v tests # unit and integration tests + uv run pytest -v --markdown-docs --markdown-docs-syntax=superfences crazyflow/ docs/ --ignore=docs/gen_ref_pages.py + ``` ## Verify the installation diff --git a/pyproject.toml b/pyproject.toml index 57cfb46..321d33e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,6 +43,33 @@ benchmark = ["fire", "matplotlib", "pandas", "pyinstrument"] Homepage = "https://github.com/learnsyslab/crazyflow" Repository = "https://github.com/learnsyslab/crazyflow" +# Dependency groups for uv-based developer workflows. These mirror the pixi features below +# ([tool.pixi.feature.*]). `uv sync` installs the `dev` group by default. pixi ignores this table. +[dependency-groups] +tests = [ + "pytest>=8.4.1", + "pytest-timeout>=2.1.0", + "array-api-strict>=2.4.1", + "matplotlib", + "pytest-markdown-docs", +] +docs = [ + "properdocs>=1.5.0", + "mkdocs-material>=9.0.0", + "mkdocs-autorefs>=1.2.0", + "mkdocstrings[python]>=0.26.0", + "mkdocs-gen-files>=0.5.0", + "mkdocs-literate-nav>=0.6.0", + "mkdocs-section-index>=0.3.0", + "mkdocs-charts-plugin>=0.0.10", +] +dist = ["build>=1.3", "twine>=6.0"] +dev = [ + "ruff", + { include-group = "tests" }, + { include-group = "docs" }, +] + [tool.setuptools.packages] find = {include = ["crazyflow*"]}