Skip to content

Switch to uv for dependency management - #1149

Open
tomodwyer wants to merge 25 commits into
mainfrom
switch-to-uv
Open

Switch to uv for dependency management#1149
tomodwyer wants to merge 25 commits into
mainfrom
switch-to-uv

Conversation

@tomodwyer

@tomodwyer tomodwyer commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Closes #1095

This PR follows the steps listed in opensafely-core/osgithub#236 - updated in the issue listed above.

The extra changes made include:

  • Fixing issues raised by zizmor
  • Updating the CI job names to better reflect what they are doing

This means we need to change the requirements for branch protection before merging this PR.

There is also no valid way of checking the workflow end-to-end without attempting to deploy to production, so caution should be taken when merging this to be able to rollback in the case of errors.

Preview of the updated job dependencies

image

@tomodwyer tomodwyer self-assigned this Aug 11, 2026
@tomodwyer
tomodwyer force-pushed the switch-to-uv branch 3 times, most recently from 93ca935 to 3da4d69 Compare August 11, 2026 14:38
@tomodwyer
tomodwyer force-pushed the switch-to-uv branch 2 times, most recently from fd5e7ca to db6c605 Compare August 12, 2026 10:35
@tomodwyer tomodwyer changed the title Switch to uv Switch to uv for dependency management Aug 12, 2026
@tomodwyer
tomodwyer marked this pull request as ready for review August 12, 2026 10:36
@tomodwyer tomodwyer added dependencies Pull requests that update a dependency file python Pull requests that update Python code labels Aug 17, 2026

@mikerkelly mikerkelly left a comment

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.

Thanks Thomas, the diff is obviously huge but this was a lot of work and I think as this is a relatively simple repository it makes sense to do it all in one PR so there is a clear before and after. Downside is more potential things to break when we deploy it...

I have some small questions and suggestions inline.

I also wonder if the format lint and lint-actions justfile recipes are needed now? They are not in the repo template and seem to overlap with just check / just fix.

we need to change the requirements for branch protection before merging this PR.
caution should be taken when merging this to be able to rollback in the case of errors.

Do you have a sequence of steps for the deploy and possible rollback in mind?

Comment thread pyproject.toml Outdated
Comment thread pyproject.toml
Comment thread justfile
Comment thread docker/docker-compose.yml Outdated
Comment thread docker/dependencies-build.txt Outdated
Comment thread .github/workflows/main.yml
Comment thread docker/Dockerfile Outdated
Comment thread docker/docker-compose.yml Outdated
Comment thread docker/justfile
Comment thread docker/justfile
@tomodwyer
tomodwyer force-pushed the switch-to-uv branch 4 times, most recently from 2c2ed06 to 665673f Compare August 27, 2026 08:23
As my default formatter added quote marks around everything (which I
prefer) - but for ease of review I have removed them from lines which
haven't been edited.
So that they include reports and remove the comment
When the file was renamed and copied from repo-template it missed
this dependent package.
@mikerkelly

Copy link
Copy Markdown
Contributor

we need to change the requirements for branch protection before merging this PR. caution should be taken when merging this to be able to rollback in the case of errors.
Do you have a sequence of steps for the deploy and possible rollback in mind?

Slack:

Yes - change the rules - empty commit (or rebase on main) - merge If it goes wrong, change the rules back, revert commits on new branch - review (I'll alert someone for a quick review ahead of time) and merge

Comment thread justfile Outdated
docker compose down --remove-orphans is used because it delegates
project identification to Docker Compose
Comment thread justfile
upgrade-package package: && uvmirror devenv
uv lock --upgrade-package {{ package }}

# Upgrade all packages to the latest versions as of the cutoff in pyproject.toml

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.

Currently getting:

just upgrade-all
uv lock --upgrade
  × No solution found when resolving dependencies:
  ╰─▶ Because only sentry-sdk<2.67.1 is available and your project depends on
      sentry-sdk>=2.67.1, we can conclude that your project's requirements are
      unsatisfiable.

      hint: Pre-releases are available for `sentry-sdk` in the requested range (e.g.,
      3.0.0a7), but pre-releases weren't enabled (try: `--prerelease=allow`)
error: recipe `upgrade-all` failed on line 63 with exit code 1

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.

❯ just upgrade-all
uv lock --upgrade
Resolved 79 packages in 346ms
rm -f requirements.uvmirror.txt
uv export --format requirements-txt --frozen --no-hashes --all-groups --all-extras > requirements.uvmirror.txt
uv sync --inexact
Resolved 79 packages in 11ms
Checked 76 packages in 270ms

@StevenMaude StevenMaude Sep 2, 2026

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 checked, and get similar to @tomodwyer here as of 8083167.

I haven't worked on reports for a little bit, so I ran just devenv before just upgrade-all and also saw sentry-sdk upgrade:

- sentry-sdk==2.66.1
+ sentry-sdk==3.0.0a7

Is there some other repository state, caching, or some other temporary glitch with PyPI that's happened for Mike?

Maybe worth trying again, perhaps with updated or rebuilt devenv?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate to use UV

3 participants