Migrate from pip/pip-tools to uv#1788
Conversation
Test results 6 files 954 suites 1m 56s ⏱️ Results for commit befd09d. ♻️ This comment has been updated with latest results. |
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
a4172e5 to
66a9689
Compare
421d983 to
5354f74
Compare
| --------------------- | ||
|
|
||
| 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| 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 |
There was a problem hiding this comment.
It will probably be possible to switch to dependency groups instead, at least for dev.
| We recommend using virtualenv or virtualenvwrapper to create | ||
| a place to stash Argus' dependencies. |
There was a problem hiding this comment.
I will still need to be able to use virtualenvwrapper because I need to switch between different sets of dependencies...
There was a problem hiding this comment.
Updated the text to mention this as an option.
| 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 |
There was a problem hiding this comment.
Phew! Multiple lock-files are important, oh yes.
|
I've pushed changes addressing your comments:
I also added This should give a similar workflow to having multiple |
c71412f to
d77b0a0
Compare
lunkwill42
left a comment
There was a problem hiding this comment.
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.
|
|
||
| - name: Lint HTML | ||
| run: djlint --lint . | ||
| run: uvx djlint --lint . |
There was a problem hiding this comment.
.. is HTML linting happening twice?
There was a problem hiding this comment.
No, the linting jobs run on separate runners, which requires setup for both
| - name: Set up uv | ||
| uses: astral-sh/setup-uv@v6 |
There was a problem hiding this comment.
Uv is set up twice, once here to run HTML lint, then again after python is installed for everything else.
There was a problem hiding this comment.
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``. |
There was a problem hiding this comment.
Won't this remove things in the venv that is not in the pyproject.toml/lock-file?
There was a problem hiding this comment.
You're right, I changed it to use pip install again, as that will install what's defined in pyproject.toml
f898faf to
a6779e7
Compare
a1d322b to
befd09d
Compare
|



Scope and purpose
Fixes #1787.
Replaces pip, pip-tools, and venv with uv across CI, Docker, tox, and local dev setup.
This pull request
Contributor Checklist