From 7948e5b3a5b9df259acf35d8f07047a712dea901 Mon Sep 17 00:00:00 2001 From: FBumann <117816358+FBumann@users.noreply.github.com> Date: Mon, 18 May 2026 12:42:33 +0200 Subject: [PATCH 1/2] deps: add `remote` extra for paramiko and migrate install docs to uv - Add `remote = ["paramiko"]` to `[project.optional-dependencies]` so the SSH backend can be installed without dragging it into the base install (follows the `oetc` extra convention). - Replace `pip install paramiko` in `solve-on-remote.ipynb` with `uv pip install "linopy[remote]"`. - Migrate the remaining `pip install` snippets in README.md and the Sphinx docs (`prerequisites.rst`, `contributing.rst`, `gpu-acceleration.rst`) to their `uv pip install` / `uv sync --extra` equivalents. Addresses follow-up requested in PR #681. Co-Authored-By: Claude Opus 4.7 (1M context) --- README.md | 8 +++----- doc/contributing.rst | 6 +++--- doc/gpu-acceleration.rst | 2 +- doc/prerequisites.rst | 10 +++++----- examples/solve-on-remote.ipynb | 2 +- pyproject.toml | 3 +++ 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 9738a347..870bbfb4 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ So far **linopy** is available on the PyPI repository ```bash -pip install linopy +uv pip install linopy ``` or on conda-forge @@ -159,10 +159,8 @@ 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 -python -m venv venv -source venv/bin/activate -pip install uv -uv pip install -e .[dev,solvers] +uv sync --extra dev --extra solvers +source .venv/bin/activate pytest ``` diff --git a/doc/contributing.rst b/doc/contributing.rst index 4bb9b60a..63175526 100644 --- a/doc/contributing.rst +++ b/doc/contributing.rst @@ -16,7 +16,7 @@ Development Setup For linting and formatting, we use `ruff `_ and run it via `pre-commit `_: -1. Installation ``conda install -c conda-forge pre-commit`` or ``pip install pre-commit`` +1. Installation ``conda install -c conda-forge pre-commit`` or ``uv pip install pre-commit`` 2. Usage: * To automatically activate ``pre-commit`` on every ``git commit``: Run ``pre-commit install`` * To manually run it: ``pre-commit run --all-files`` @@ -34,7 +34,7 @@ To run the test suite: .. code-block:: bash # Install development dependencies - pip install -e .[dev,solvers] + uv sync --extra dev --extra solvers # Run all tests pytest @@ -75,7 +75,7 @@ When working on performance-sensitive code, use the internal benchmark suite in .. code-block:: bash # Install benchmark dependencies - pip install -e ".[benchmarks]" + uv sync --extra benchmarks # Quick timing benchmarks pytest benchmarks/ --quick diff --git a/doc/gpu-acceleration.rst b/doc/gpu-acceleration.rst index a9048973..2498993a 100644 --- a/doc/gpu-acceleration.rst +++ b/doc/gpu-acceleration.rst @@ -24,7 +24,7 @@ To install it, you have to have the `CUDA Toolkit =0.1.2 + uv pip install "cupdlpx>=0.1.2" **Features:** diff --git a/doc/prerequisites.rst b/doc/prerequisites.rst index afb0e8a7..32b37747 100644 --- a/doc/prerequisites.rst +++ b/doc/prerequisites.rst @@ -12,11 +12,11 @@ Before you start, make sure you have the following: Install Linopy -------------- -You can install Linopy using pip or conda. Here are the commands for each method: +You can install Linopy using uv or conda. Here are the commands for each method: .. code-block:: bash - pip install linopy + uv pip install linopy or @@ -51,7 +51,7 @@ required: .. code:: bash - pip install linopy[solvers] + uv pip install "linopy[solvers]" We recommend installing the HiGHS solver, which is free, open source, and @@ -59,7 +59,7 @@ fast across a wide range of problem sizes: .. code:: bash - pip install highspy + uv pip install highspy GPU-accelerated solvers @@ -73,7 +73,7 @@ For large-scale optimization problems, GPU-accelerated solvers can provide signi .. code:: bash - pip install cupdlpx + uv pip install cupdlpx For most of the other solvers, please click on the links to get further installation information. diff --git a/examples/solve-on-remote.ipynb b/examples/solve-on-remote.ipynb index 659cf9d6..73e6346b 100644 --- a/examples/solve-on-remote.ipynb +++ b/examples/solve-on-remote.ipynb @@ -22,7 +22,7 @@ "\n", "## What you need for SSH remote solving\n", "\n", - "* A running installation of paramiko on your local machine (`pip install paramiko`)\n", + "* The `remote` extra installed on your local machine (`uv pip install \"linopy[remote]\"`), which pulls in `paramiko`\n", "* A remote server with a working installation of linopy (e.g., in a conda environment)\n", "* SSH access to that machine\n", "\n", diff --git a/pyproject.toml b/pyproject.toml index f5fa135a..6ab66c94 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,6 +48,9 @@ oetc = [ "google-cloud-storage", "requests", ] +remote = [ + "paramiko", +] docs = [ "ipython==8.26.0", "numpydoc==1.7.0", From 56544385d5e2189340509cb12ad49ec1b962a427 Mon Sep 17 00:00:00 2001 From: FBumann <117816358+FBumann@users.noreply.github.com> Date: Mon, 18 May 2026 15:13:20 +0200 Subject: [PATCH 2/2] docs: drop redundant install steps for pre-commit and highspy Both are already pulled in by the relevant extras (`pre-commit` via `dev`, `highspy` via `solvers` and `dev`), so the standalone install snippets only add noise. Co-Authored-By: Claude Opus 4.7 (1M context) --- doc/contributing.rst | 6 ++---- doc/prerequisites.rst | 9 +++------ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/doc/contributing.rst b/doc/contributing.rst index 63175526..3b0ab94d 100644 --- a/doc/contributing.rst +++ b/doc/contributing.rst @@ -16,10 +16,8 @@ Development Setup For linting and formatting, we use `ruff `_ and run it via `pre-commit `_: -1. Installation ``conda install -c conda-forge pre-commit`` or ``uv pip install pre-commit`` -2. Usage: - * To automatically activate ``pre-commit`` on every ``git commit``: Run ``pre-commit install`` - * To manually run it: ``pre-commit run --all-files`` +* Install the git hook (once): ``pre-commit install`` +* Run manually: ``pre-commit run --all-files`` Running Tests ============= diff --git a/doc/prerequisites.rst b/doc/prerequisites.rst index 32b37747..7a9e83bd 100644 --- a/doc/prerequisites.rst +++ b/doc/prerequisites.rst @@ -54,12 +54,9 @@ required: uv pip install "linopy[solvers]" -We recommend installing the HiGHS solver, which is free, open source, and -fast across a wide range of problem sizes: - -.. code:: bash - - uv pip install highspy +We recommend the HiGHS solver, which is free, open source, and fast +across a wide range of problem sizes. It is included in both the +``solvers`` and ``dev`` extras. GPU-accelerated solvers