Skip to content

Docs: Update developer workflow to prioritize Devcontainers and local setup using uv#1790

Open
tharun-mk wants to merge 1 commit into
brian-team:masterfrom
tharun-mk:update-workflow-uv
Open

Docs: Update developer workflow to prioritize Devcontainers and local setup using uv#1790
tharun-mk wants to merge 1 commit into
brian-team:masterfrom
tharun-mk:update-workflow-uv

Conversation

@tharun-mk
Copy link
Copy Markdown

->Added the standard command uv add --dev --editable .[docs,test] so developers can resolve dependencies directly from the existing pyproject.toml without needing to maintain redundant dependency files.
->ocal setup instructions with a modern uv workflow.
->Restructured the environment setup guide to prominently feature the VS Code Devcontainer approach as the #1 recommended method for new contributors.

@mstimberg
Copy link
Copy Markdown
Member

Hi @tharun-mk, thanks for the PR. The doc looks mostly good, even though the "uv resolves all dependencies directly from the existing pyproject.toml file, keeping the repository clean without needing external dependency files" is not very meaningful, I think. Regarding the uv add... command: the idea was not to include this command in the documentation, but to use it to update the pyproject.toml file. The documentation would have to state how to actually run the code in the environment created by uv.

@tharun-mk
Copy link
Copy Markdown
Author

Hi @mstimberg,
I have rewritten the "Option 2" section to use uv venv and uv pip install so it safely installs the existing dependencies without modifying the pyproject.toml. I also added a step showing how to execute the test suite within that environment.
Here is the updated text for this section. Let me know if this looks good to you and is it okay push commit!
Option 2: Local Setup using uv


If you prefer a local setup without Docker, you can use
`uv <https://docs.astral.sh/uv/>`_ to create a virtual environment and install Brian in development mode.

1. `Install uv <https://docs.astral.sh/uv/getting-started/installation/>`_ if
   you haven't already.
2. From the root of the repository, create a virtual environment and install the package along with its testing and documentation dependencies:

   .. code-block:: bash

      uv venv
      uv pip install -e ".[docs,test]"

3. To run code or tests within this environment, use ``uv run`` (which automatically detects the virtual environment). For example, to run the test suite:

   .. code-block:: bash

      uv run pytest

@mstimberg
Copy link
Copy Markdown
Member

Hi @tharun-mk. Why not change the pyproject.toml file? I think if you did, you wouldn't need your point two, and calling uv run pytest would automatically install the environment. But also note that calling pytest directly is not a good way of calling Brian's test suite (fixing this would be #1129). Instead, there are scripts in dev/tools or you can call it programatically from Python (https://brian2.readthedocs.io/en/stable/developer/guidelines/testing.html#running-the-test-suite).

@mstimberg
Copy link
Copy Markdown
Member

Hi @tharun-mk are you still interested in/have time for working on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants