Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@JohnStrunk
Copy link
Member

@JohnStrunk JohnStrunk commented May 5, 2025

Summary
This switches from using venv and pip for managing the python dependencies to using uv

Benefits

  • uv is much faster
  • uv maintains a lockfile (uv.lock) that includes the exact versions of all dependencies for the project, not just direct ones. This ensures that the environment is reproducible.
  • We now get consistent versions of all dependencies (previously, the order in which the setup.py scripts were called led to different package versions being installed)

Changes

  • Project direct dependencies are now in pyproject.toml, and all setup.py files have been removed. I did my best to migrate the metadata across where possible. setuptools is still used for the actual install.
  • The python version is now locked for the project via .python-version. uv will install this version of python when it creates the environment, so it no longer matters what python version is installed on the user's machine.
  • The "sub-packages" from augur/tasks/data_analysis have been pulled into the main project. I suspect this may be controversial, and I can separate them back out if necessary.
  • Backend Dockerfile has been updated to use uv based on uv's best-practices docs.

Assuming you all are good w/ this change, I'd like to update the docs prior to merge.

To try this out, the docker version should work as before, but if you're running outside of docker, you should:

  • Install uv: $ pip install --user uv
  • Prefix your "augur" commands w/ uv run, e.g., $ uv run augur backend start.

It's no longer necessary to manage the virtual environment or use pip directly, though you probably want to delete your old venv prior to starting w/ uv.

To do

  • GH action to ensure the lockfile is up-to-date
  • Documentation

@JohnStrunk JohnStrunk force-pushed the uv branch 2 times, most recently from 9c272ae to 02bd0a1 Compare May 8, 2025 16:52
@JohnStrunk
Copy link
Member Author

@sgoggins @Ulincsys Please take a look when you get a chance. If you're good w/ it, I'll get to work on revising the docs.

@erikerlandson erikerlandson self-requested a review May 20, 2025 20:27
Copy link

@erikerlandson erikerlandson left a comment

Choose a reason for hiding this comment

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

LGTM

sgoggins
sgoggins previously approved these changes May 23, 2025
Copy link
Member

@sgoggins sgoggins left a comment

Choose a reason for hiding this comment

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

@JohnStrunk : Candidly I am outside my element for being able to provide a meaningful review here.

I do understand, though, that this will stabilize our dependencies and make them easier to maintain in one place. And there are other benefits you outline.

I am inclined to merge this into dev and test it vigorously.

@Ulincsys : Any thoughts?

- Replaces setup.py with pyproject.toml
- Creates .python-version file that will control the python version that
  uv uses in the virtualenv

Signed-off-by: John Strunk <[email protected]>
Signed-off-by: John Strunk <[email protected]>
Update GitHub workflow to include a new job that checks the uv lockfile,
ensuring it is up to date by installing uv and running the lock check
command.

Signed-off-by: John Strunk <[email protected]>
Added post_create_environment job to generate requirements.txt using uv,
and updated python install method to use the generated requirements file.

Signed-off-by: John Strunk <[email protected]>
@JohnStrunk
Copy link
Member Author

@sgoggins I've made the doc changes. This should be ready.

@JohnStrunk JohnStrunk requested a review from sgoggins May 28, 2025 20:57
Copy link
Member

@sgoggins sgoggins left a comment

Choose a reason for hiding this comment

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

LGTM@!

@sgoggins sgoggins merged commit e8f64f6 into chaoss:dev May 29, 2025
8 of 9 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.

3 participants