diff --git a/.github/workflows/claude-code-review.yml.bkp b/.github/workflows/claude-code-review.yml.bkp index 60aa943a..2941d162 100644 --- a/.github/workflows/claude-code-review.yml.bkp +++ b/.github/workflows/claude-code-review.yml.bkp @@ -78,7 +78,7 @@ jobs: # 'Please provide a thorough code review focusing on our coding standards and best practices.' }} # Project-specific tools for Python development - allowed_tools: "Bash(pytest),Bash(ruff check .),Bash(ruff format .),Bash(mypy .),Bash(uv pip install -e .[dev,solvers])" + allowed_tools: "Bash(pytest),Bash(ruff check .),Bash(ruff format .),Bash(mypy .),Bash(uv pip install -e .[solvers] --group dev)" # Optional: Skip review for certain conditions # if: | diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml index 49a03d15..eed1a694 100644 --- a/.github/workflows/claude.yml +++ b/.github/workflows/claude.yml @@ -59,7 +59,7 @@ jobs: # assignee_trigger: "claude-bot" # Project-specific tools for Python development - allowed_tools: "Bash(pytest),Bash(ruff check .),Bash(ruff format .),Bash(mypy .),Bash(uv pip install -e .[dev,solvers])" + allowed_tools: "Bash(pytest),Bash(ruff check .),Bash(ruff format .),Bash(mypy .),Bash(uv pip install -e .[solvers] --group dev)" # Custom instructions for linopy project custom_instructions: | diff --git a/.github/workflows/test-notebooks.yml b/.github/workflows/test-notebooks.yml index dfe025d2..7512a1f4 100644 --- a/.github/workflows/test-notebooks.yml +++ b/.github/workflows/test-notebooks.yml @@ -30,7 +30,7 @@ jobs: - name: Install package and dependencies run: | python -m pip install uv - uv pip install --system -e ".[docs]" + uv pip install --system -e . --group docs - name: Execute notebooks run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9cfa3991..c93cf6ee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -82,7 +82,7 @@ jobs: - name: Install package and dependencies run: | python -m pip install uv - uv pip install --system "$(ls dist/*.whl)[dev,solvers,oetc]" + uv pip install --system "$(ls dist/*.whl)[solvers,oetc]" --group dev - name: Test with pytest env: @@ -120,7 +120,7 @@ jobs: - name: Install package and dependencies run: | python -m pip install uv - uv pip install --system "$(ls dist/*.whl)[dev]" + uv pip install --system "$(ls dist/*.whl)" --group dev - name: Run type checker (mypy) run: | diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 5eac0cca..c033f8eb 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -10,7 +10,7 @@ build: - git fetch --unshallow # Needed to get version tags python: install: - - method: pip - path: . - extra_requirements: + - method: uv + command: sync + groups: - docs diff --git a/README.md b/README.md index 870bbfb4..210fda2e 100644 --- a/README.md +++ b/README.md @@ -159,7 +159,7 @@ Note that these do have to be installed by the user separately. To set up a local development environment for linopy and to run the same tests that are run in the CI, you can run: ```sh -uv sync --extra dev --extra solvers +uv sync --group dev --extra solvers source .venv/bin/activate pytest ``` diff --git a/benchmarks/README.md b/benchmarks/README.md index 22ac73ce..38396bc0 100644 --- a/benchmarks/README.md +++ b/benchmarks/README.md @@ -7,7 +7,8 @@ Measures linopy's own performance (build time, LP write speed, memory usage) acr ## Setup ```bash -pip install -e ".[benchmarks]" +pip install -e . --group benchmarks # pip >= 25.1 +# or: uv sync --group benchmarks ``` ## Running benchmarks diff --git a/doc/contributing.rst b/doc/contributing.rst index 6c2ee2de..9458208e 100644 --- a/doc/contributing.rst +++ b/doc/contributing.rst @@ -43,7 +43,7 @@ To run the test suite: .. code-block:: bash # Install development dependencies - uv sync --extra dev --extra solvers + uv sync --group dev --extra solvers # Run all tests pytest @@ -57,6 +57,20 @@ To run the test suite: # Run a specific test function pytest test/test_model.py::test_model_creation +The contributor toolchains (``dev``, ``docs``, ``benchmarks``) are +`PEP 735 `_ dependency groups rather than +extras, so they are installed with ``--group`` instead of ``--extra`` and are +not reachable through the ``.[...]`` syntax. With pip, dependency groups +require **pip >= 25.1**: + +.. code-block:: bash + + pip install -e . --group dev # pip >= 25.1 + uv sync --group dev # uv (any recent version) + +The runtime extras (``solvers``, ``oetc``, ``remote``) are unaffected and are +still installed the usual way, e.g. ``pip install linopy[solvers]``. + GPU Testing ----------- @@ -84,7 +98,7 @@ When working on performance-sensitive code, use the internal benchmark suite in .. code-block:: bash # Install benchmark dependencies - uv sync --extra benchmarks + uv sync --group benchmarks # Quick timing benchmarks pytest benchmarks/ --quick diff --git a/pyproject.toml b/pyproject.toml index 19d0abb3..a8c8e531 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,6 +53,21 @@ oetc = [ remote = [ "paramiko", ] +solvers = [ + "gurobipy", + "highspy>=1.5.0,!=1.14.0; python_version < '3.12'", + "highspy>=1.7.1,!=1.14.0; python_version >= '3.12'", + "cplex; platform_system != 'Darwin'", + "mosek", + "mindoptpy", + "coptpy!=7.2.1", + "xpress; platform_system != 'Darwin'", + "pyscipopt; platform_system != 'Darwin'", + "knitro>=15.1.0", + # "cupdlpx>=0.1.2", pip package currently unstable +] + +[dependency-groups] docs = [ "ipython==8.26.0", "numpydoc==1.7.0", @@ -88,19 +103,6 @@ benchmarks = [ "highspy>=1.7.1", "pytest-memray", ] -solvers = [ - "gurobipy", - "highspy>=1.5.0,!=1.14.0; python_version < '3.12'", - "highspy>=1.7.1,!=1.14.0; python_version >= '3.12'", - "cplex; platform_system != 'Darwin'", - "mosek", - "mindoptpy", - "coptpy!=7.2.1", - "xpress; platform_system != 'Darwin'", - "pyscipopt; platform_system != 'Darwin'", - "knitro>=15.1.0", - # "cupdlpx>=0.1.2", pip package currently unstable -] [tool.setuptools.packages.find] include = ["linopy"]