-
-
Notifications
You must be signed in to change notification settings - Fork 147
Replace pip with uv
#579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Replace pip with uv
#579
Conversation
requirements_prod.txt
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been moved to a UV dependency group instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that UV specific or an accepted Python PEP?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it was left out of scope when PEP-0621 was proposed. Poetry and UV move dependencies into groups, a default one that is always installed, along with optional groups of dependencies that we can install.
uv sync installs dependencies + dev dependencies
uv sync --no-dev install project dependencies without any development
uv sync --group prod installs dependencies + prod dependencies
etc.
This makes it easy for us to manage different scope of dependencies within the project
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Digging through UV's documentation a little more, dependencies are specified using Python dependency specification, and it follows PEP-621 standard, but it seems the dependency grouping spec is mainly UV-specific from what I understood.
jelly
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, I'll have to give this a test spin. I am not entirely sure if I'll like uv (never used it before).
This also calls for us switching to dependabot, but not sure if that can bump the uv version in the github actions workflow.
.python-version
Outdated
| @@ -0,0 +1 @@ | |||
| 3.13.0 | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't this be part of pyproject.toml?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can. uv creates this by default, given some Python toolings read this file. I will remove this and keep it in pyproject.toml, then update workflow to revert to its original version selection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in 6634c9b (#579)
requirements_prod.txt
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that UV specific or an accepted Python PEP?
| "pytest>=8.4.1", | ||
| "pytest-cov>=6.2.1", | ||
| "pytest-django>=4.11.1", | ||
| "ruff>=0.12.11", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
venv managed ruff :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will still be in venv. uv will only install this when we install dev dependencies (enabled by default). Before, we had to install this separately with pip.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, but I prefer system linters ;-)
|
|
||
| lint: | ||
| flake8 --extend-exclude "*/migrations/,local_settings.py" devel main mirrors news packages releng templates todolists visualize *.py | ||
| uv run flake8 --extend-exclude "*/migrations/,local_settings.py" devel main mirrors news packages releng templates todolists visualize *.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should re-evaluate if ruff already has the formatting rules, or ugh ruff format I guess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ruff actually replaces flake8, so we can technically get rid of this and have one tool to handle formatting/linting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"replaces", not entirely most of the E1 rules are not yet implemented and if implemented are preview rules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway, this will be handled in a follow up by moving to ruff format
|
On August 30, 2025 2:41:12 PM UTC, Ben Mezger ***@***.***> wrote:
benmezger left a comment (archlinux/archweb#579)
> This also calls for us switching to dependabot, but not sure if that can bump the uv version in the github actions workflow.
@jelly it [can](https://github.blog/changelog/2025-03-13-dependabot-version-updates-now-support-uv-in-general-availability/):
```yaml
version: 2
enable-beta-ecosystems: true
updates:
- package-ecosystem: "uv"
directory: "/"
schedule:
interval: "daily"
```
Can dependabot run on gitlab though?
|
|
@benmezger renovate should already support |
.github/workflows/main.yml
Outdated
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: 3.13 | ||
| python-version: "3.13.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| lint: | ||
| flake8 --extend-exclude "*/migrations/,local_settings.py" devel main mirrors news packages releng templates todolists visualize *.py | ||
| uv run flake8 --extend-exclude "*/migrations/,local_settings.py" devel main mirrors news packages releng templates todolists visualize *.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"replaces", not entirely most of the E1 rules are not yet implemented and if implemented are preview rules.
|
|
||
| lint: | ||
| flake8 --extend-exclude "*/migrations/,local_settings.py" devel main mirrors news packages releng templates todolists visualize *.py | ||
| uv run flake8 --extend-exclude "*/migrations/,local_settings.py" devel main mirrors news packages releng templates todolists visualize *.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway, this will be handled in a follow up by moving to ruff format
mirrors/utils.py
Outdated
| desc = cursor.description | ||
| return [ | ||
| dict(zip([col[0] for col in desc], row)) | ||
| dict(zip([col[0] for col in desc], row, strict=False)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be a place where strict=True seems fine to use.
pyproject.toml
Outdated
| [project] | ||
| name = "archweb" | ||
| version = "0.1.0" | ||
| description = "Archlinux website code" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Arch Linux ;-)
| "pytest>=8.4.1", | ||
| "pytest-cov>=6.2.1", | ||
| "pytest-django>=4.11.1", | ||
| "ruff>=0.12.11", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, but I prefer system linters ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR migrates the archweb project from pip to uv for dependency management, consolidating dependencies into a single pyproject.toml file and modernizing the development workflow.
Key Changes:
- Replaced pip-based dependency files with uv's
pyproject.tomland lock file - Updated all CI/CD workflows and documentation to use uv commands
- Reorganized dependencies into logical groups (dev, prod, smtp)
Reviewed changes
Copilot reviewed 9 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Added project metadata and consolidated all dependencies with proper dependency groups for dev, prod, and smtp |
| uv.lock | Generated lock file containing all dependency metadata and version hashes |
| requirements.txt | Removed legacy pip requirements file |
| requirements_prod.txt | Removed legacy production requirements file |
| requirements_test.txt | Removed legacy test requirements file |
| README.md | Updated installation and usage instructions to use uv commands instead of pip |
| Makefile | Updated all commands to use uv run prefix |
| .gitlab-ci.yml | Migrated CI pipeline from pip to uv |
| .github/workflows/main.yml | Updated GitHub Actions workflow to use uv with setup-uv action |
| main/storage.py | Reordered imports (cssmin moved before jsmin) |
| devel/migrations/0012_alter_userprofile_social_alter_userprofile_time_zone.py | Auto-generated Django migration file |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
README.md
Outdated
|
|
||
| ./manage.py runserver | ||
|
|
||
| uv ./manage.py runserver |
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command is missing the "run" keyword. It should be "uv run ./manage.py runserver" instead of "uv ./manage.py runserver".
| uv ./manage.py runserver | |
| uv run ./manage.py runserver |
README.md
Outdated
| use virtualenv and pip to handle these. But if you insist on (Arch Linux) | ||
| packages, you will probably want the following: | ||
| You can look at the packages `archweb` uses by looking at the `pyproject.toml` file; | ||
| it is best to use `uv` to handle these. If you insist on (Archlinux) packages, you |
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The spelling of "Archlinux" should be "Arch Linux" (with a space) for consistency with how it appears elsewhere in the documentation and the official project naming.
| it is best to use `uv` to handle these. If you insist on (Archlinux) packages, you | |
| it is best to use `uv` to handle these. If you insist on (Arch Linux) packages, you |
I've been using
UVinarchwebto handle dependencies andvenvmanagement a little easier. Given that, I am opening a PR with the changes I made, in case you want to migrate frompiptoUV.I will take care of the infrastructure PR, so if one wants to merge this, it's better to wait for the infra PR.