Skip to content

Conversation

@benmezger
Copy link
Contributor

@benmezger benmezger commented Aug 30, 2025

I've been using UV in archweb to handle dependencies and venv management a little easier. Given that, I am opening a PR with the changes I made, in case you want to migrate from pip to UV.

I will take care of the infrastructure PR, so if one wants to merge this, it's better to wait for the infra PR.

Copy link
Contributor Author

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.

Copy link
Member

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?

Copy link
Contributor Author

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

Copy link
Contributor Author

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.

Copy link
Member

@jelly jelly left a 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
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed in 6634c9b (#579)

Copy link
Member

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",
Copy link
Member

Choose a reason for hiding this comment

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

venv managed ruff :(

Copy link
Contributor Author

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.

Copy link
Member

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
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Member

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

@benmezger
Copy link
Contributor Author

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:

version: 2
enable-beta-ecosystems: true
updates:
  - package-ecosystem: "uv"
    directory: "/"
    schedule:
      interval: "daily"

@lahwaacz
Copy link
Contributor

lahwaacz commented Aug 31, 2025 via email

@benmezger
Copy link
Contributor Author

benmezger commented Aug 31, 2025

@lahwaacz I think Arch's Gitlab uses renovate, but I don't think it supports uv yet. But it seems Gitlab does support Dependabot.

@lahwaacz
Copy link
Contributor

@benmezger renovate should already support uv: renovatebot/renovate#34494

uses: actions/setup-python@v5
with:
python-version: 3.13
python-version: "3.13.0"
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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))
Copy link
Member

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"
Copy link
Member

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",
Copy link
Member

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 ;-)

Copilot AI review requested due to automatic review settings January 6, 2026 17:55
Copy link

Copilot AI left a 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.toml and 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
Copy link

Copilot AI Jan 6, 2026

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".

Suggested change
uv ./manage.py runserver
uv run ./manage.py runserver

Copilot uses AI. Check for mistakes.
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
Copy link

Copilot AI Jan 6, 2026

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
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.

3 participants