Skip to content

Migrate from pip/pip-tools to uv#1788

Open
Simrayz wants to merge 7 commits into
mainfrom
chore/use-uv-for-environment-management
Open

Migrate from pip/pip-tools to uv#1788
Simrayz wants to merge 7 commits into
mainfrom
chore/use-uv-for-environment-management

Conversation

@Simrayz
Copy link
Copy Markdown
Contributor

@Simrayz Simrayz commented Feb 17, 2026

Scope and purpose

Fixes #1787.

Replaces pip, pip-tools, and venv with uv across CI, Docker, tox, and local dev setup.

This pull request

  • adds/changes/removes a dependency

Contributor Checklist

  • Added a changelog fragment for towncrier
  • Added/changed documentation, including updates to the user manual if feature flow or UI is considerably changed
  • Linted/formatted the code with ruff and djLint, easiest by using pre-commit
  • The first line of the commit message continues the sentence "If applied, this commit will ...", starts with a capital letter, does not end with punctuation and is 50 characters or less long. See our how-to

@Simrayz Simrayz added dependencies Run `tox -r` before testing locally, dependencies have changed DevEx documentation Improvements or additions to documentation labels Feb 17, 2026
@Simrayz Simrayz self-assigned this Feb 17, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 17, 2026

Test results

    6 files    954 suites   1m 56s ⏱️
  729 tests   728 ✅ 1 💤 0 ❌
4 374 runs  4 368 ✅ 6 💤 0 ❌

Results for commit befd09d.

♻️ This comment has been updated with latest results.

@Simrayz Simrayz added the nonews No news fragment is necessary for this PR (e.g. refactoring, cleanups, workflow/development changes) label Feb 17, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.58%. Comparing base (2b24f29) to head (befd09d).
⚠️ Report is 20 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1788   +/-   ##
=======================================
  Coverage   84.58%   84.58%           
=======================================
  Files         136      136           
  Lines        6630     6630           
=======================================
  Hits         5608     5608           
  Misses       1022     1022           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Simrayz Simrayz force-pushed the chore/use-uv-for-environment-management branch from a4172e5 to 66a9689 Compare February 17, 2026 11:44
@Simrayz Simrayz removed the nonews No news fragment is necessary for this PR (e.g. refactoring, cleanups, workflow/development changes) label Feb 17, 2026
@Simrayz Simrayz force-pushed the chore/use-uv-for-environment-management branch 2 times, most recently from 421d983 to 5354f74 Compare February 17, 2026 11:48
---------------------

To generate a secret key to be used in the `cmd.sh` file one can use
To generate a secret key to be used in the `.env` file one can use
Copy link
Copy Markdown
Contributor

@hmpf hmpf Feb 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would I run with multiple sets of environment variables?

I don't use .env today, because I regularly use two different sets of environment variables, and frequently three when testing something.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point :) My reasoning was to try to avoid creating custom "cmd.sh" script files instead of using the uv tooling. I can look into how we can support switching between different environments.

Comment thread pyproject.toml
Comment on lines 59 to 73
dev = [
"django-debug-toolbar",
"coverage",
"django-extensions",
"ruff",
"djlint",
"ipython",
"pre-commit",
"pydotplus",
"python-dotenv",
"towncrier",
"unittest-xml-reporting",
"werkzeug",
"tox>=4",
"build", # for debugging builds/installs
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will probably be possible to switch to dependency groups instead, at least for dev.

Comment thread README.md
Comment on lines -174 to -175
We recommend using virtualenv or virtualenvwrapper to create
a place to stash Argus' dependencies.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will still need to be able to use virtualenvwrapper because I need to switch between different sets of dependencies...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the text to mention this as an option.

Comment thread tox.ini
Comment on lines +59 to +60
uv pip compile --no-strip-extras --output-file requirements-django52.txt {posargs} pyproject.toml requirements/django52.txt constraints.txt
uv pip compile --no-strip-extras --output-file requirements-django60.txt {posargs} pyproject.toml requirements/django60.txt constraints.txt
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Phew! Multiple lock-files are important, oh yes.

Comment thread docs/development/makefile-rules.rst Outdated
@Simrayz
Copy link
Copy Markdown
Contributor Author

Simrayz commented Feb 20, 2026

I've pushed changes addressing your comments:

  • "Some of the rules" wording in makefile-rules docs
  • Removed prescriptive .env file reference in management-commands docs
  • Re-added mention of virtualenv/virtualenvwrapper as alternatives

I also added create-env and set-env Makefile rules to support switching between multiple environment configurations:

make create-env dev      # copy template -> .env.dev
make create-env test     # copy template -> .env.test
make set-env dev         # symlink .env.dev -> .env
make set-env             # list available environments

This should give a similar workflow to having multiple cmd.sh files.

@Simrayz Simrayz force-pushed the chore/use-uv-for-environment-management branch from c71412f to d77b0a0 Compare February 20, 2026 10:23
Copy link
Copy Markdown
Member

@lunkwill42 lunkwill42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I support any initiative to move to the uv toolchain 👍

I'm not going to argue with how @hmpf wants to handle multiple sets of environment variables within Argus (in my head, this bit is specific to each developer).

What I do want to argue is that we should move also Argus' pyproject.toml to use proper dependency groups, rather than use project.optional-dependencies, since none of the dependencies listed in our project.optional-dependencies section are actually optional runtime dependencies. But that's a separate issue.

@Simrayz Simrayz marked this pull request as ready for review February 24, 2026 08:43
Comment thread .github/workflows/python.yml Outdated

- name: Lint HTML
run: djlint --lint .
run: uvx djlint --lint .
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.. is HTML linting happening twice?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the linting jobs run on separate runners, which requires setup for both

Comment thread .github/workflows/python.yml Outdated
Comment on lines +26 to +27
- name: Set up uv
uses: astral-sh/setup-uv@v6
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uv is set up twice, once here to run HTML lint, then again after python is installed for everything else.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UV had to be setup twice as it was used in two different jobs, but I moved the linting job into the format workflow, as it naturally belongs with linting anyways.


.. note:: The development settings file assumes that the optional development
dependencies are installed. You can get them via ``pip install argus-server[dev]``.
dependencies are installed. You can get them via ``uv sync --extra dev``.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this remove things in the venv that is not in the pyproject.toml/lock-file?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I changed it to use pip install again, as that will install what's defined in pyproject.toml

Comment thread tox.ini Outdated
@Simrayz Simrayz force-pushed the chore/use-uv-for-environment-management branch from f898faf to a6779e7 Compare March 2, 2026 09:28
@Simrayz Simrayz requested a review from hmpf March 2, 2026 10:12
@Simrayz Simrayz force-pushed the chore/use-uv-for-environment-management branch from a1d322b to befd09d Compare March 2, 2026 10:12
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Mar 2, 2026

@hmpf hmpf added the rc-next Prioritized candidate for next release label Mar 5, 2026
@github-project-automation github-project-automation Bot moved this from 📋 Backlog to ♻ Changes requested in Argus development, public Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Run `tox -r` before testing locally, dependencies have changed DevEx documentation Improvements or additions to documentation rc-next Prioritized candidate for next release

Projects

Status: ♻ Changes requested

Development

Successfully merging this pull request may close these issues.

Migrate from pip/pip-tools to uv

4 participants