Skip to content

Use uv for development, CI and docs builds - #436

Merged
mxamin merged 3 commits into
masterfrom
chore/use-uv
Nov 5, 2026
Merged

mxamin merged 3 commits into
masterfrom
chore/use-uv

Conversation

@mxamin

@mxamin mxamin commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

Contributor setup relied on virtualenvwrapper, pip and requirements files whose pins had drifted (ruff differed from pre-commit, lxml differed between tests and docs). Move to a single uv-based workflow.

  • Pin Python 3.14.10 as the development default in .python-version. Supported versions for users are unchanged: requires-python stays >=3.10, and the wheels and CI matrices still cover 3.10-3.15.
  • Replace the requirements files with dependency groups and uv.lock. Keep exact pins in the test group, because cibuildwheel installs it from pyproject.toml through test-groups and does not read the lockfile.
  • Set uv cache keys so C and build_support changes rebuild the extension. Git state and PYXMLSEC_STATIC_DEPS are left out on purpose: a static rebuild takes over a minute, and keying on the variable makes any uv run without it rebuild against the system libraries.
  • Move the GitHub workflows, manylinux script and Read the Docs config to uv. Replace setup.py sdist and setup.py --version with uv build and globs.
  • Add CONTRIBUTING.md with the full setup for static and system libraries, and update the README, docs and libs guides.
  • Remove the unused .travis.yml, which referenced the removed files.

Tested locally on macOS only. The Linux and Windows runners, manylinux containers and Read the Docs build have not run with these changes yet.

Contributor setup relied on virtualenvwrapper, pip and requirements files
whose pins had drifted (ruff differed from pre-commit, lxml differed between
tests and docs). Move to a single uv-based workflow.

- Pin Python 3.14.10 as the development default in .python-version. Supported
  versions for users are unchanged: requires-python stays >=3.10, and the
  wheels and CI matrices still cover 3.10-3.15.
- Replace the requirements files with dependency groups and uv.lock. Keep
  exact pins in the test group, because cibuildwheel installs it from
  pyproject.toml through test-groups and does not read the lockfile.
- Set uv cache keys so C and build_support changes rebuild the extension.
  Git state and PYXMLSEC_STATIC_DEPS are left out on purpose: a static rebuild
  takes over a minute, and keying on the variable makes any `uv run` without
  it rebuild against the system libraries.
- Move the GitHub workflows, manylinux script and Read the Docs config to uv.
  Replace `setup.py sdist` and `setup.py --version` with `uv build` and globs.
- Add CONTRIBUTING.md with the full setup for static and system libraries,
  and update the README, docs and libs guides.
- Remove the unused .travis.yml, which referenced the removed files.

Tested locally on macOS only. The Linux and Windows runners, manylinux
containers and Read the Docs build have not run with these changes yet.
The non-static macOS job on Python 3.11 failed at import with "lxml & xmlsec
libxml2 library version mismatch". Runners preinstall several Pythons and uv
uses a matching one before downloading its own, so the jobs ran on a mix: 3.11
and 3.12 on universal2 builds in /usr/local/bin, 3.14 on Homebrew's and 3.10 on
a uv-managed build.

- Set UV_PYTHON_PREFERENCE=only-managed so every macOS job uses uv's own Python.
- Assign PYXMLSEC_LIBFILE before writing it to GITHUB_ENV. The command
  substitution inside echo hid the failed import, so the job only failed later
  during test collection.
- Document the workaround in the CONTRIBUTING.md mismatch entry.
Non-static macOS jobs could fail at import with "lxml & xmlsec libxml2 library
version mismatch". The static and non-static jobs share a uv cache, since the
key only uses the Python version and lockfile, and they build wheels with the
same filename. uv then installed the cached wheel from the other job instead
of the one in dist/, so a static wheel with libxml2 2.14.6 ended up next to an
lxml built against Homebrew's 2.15.4.

Pass --refresh-package xmlsec so each job installs the wheel it just built.

This corrects the diagnosis in the previous commit, which blamed preinstalled
Pythons. Remove the CONTRIBUTING.md advice based on it, and keep
UV_PYTHON_PREFERENCE=only-managed only so every job uses the same kind of
Python.
@mxamin
mxamin merged commit 099d2e3 into master Nov 5, 2026
114 checks passed
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.

1 participant