Skip to content

Migrate from pdm to uv#331

Merged
ValerianRey merged 12 commits intomainfrom
migrate-to-uv
Apr 29, 2025
Merged

Migrate from pdm to uv#331
ValerianRey merged 12 commits intomainfrom
migrate-to-uv

Conversation

@ValerianRey
Copy link
Copy Markdown
Contributor

@ValerianRey ValerianRey commented Apr 28, 2025

  • Add uv.lock to .gitignore and remove .pdm-python from it
  • Change pdm to uv in CONTRIBUTING.md
  • Change pdm to uv in tests.yml, build-deploy-docs.yml and release.yml
  • Change build-system to setuptools
  • Change license classifier to a license field in pyproject.toml

Theoretically, this should only affect contributors and CI.

The main goal is to reduce the duration of the CI checks. They now seem much shorter, (< 80 sec for the slowest I think instead of about 240 seconds with pdm). This could probably be reduced even further by using caching, to maybe < 40 sec (which would be really nice).

TODO:

  • Change release.yml. I think we need to build + publish with uv in two different commands, but it should be similar
  • Do we pin uv version? According to their documentation "It is considered best practice to pin to a specific uv version" => They dont seem confident about not making breaking changes. But at the same time, if they make breaking changes, I'm fine with having tests fail and fixing the CI asap to always be using the newest uv version. If it's once per year it's perfectly fine, if it's once per month it's boring. => I would go against pinnning uv version for now, and maybe do it if it causes problems too often. The reason is that we don't really pin anything in torchjd, even the versions of the pre-commit hooks are updated via pre-commit ci pull requests, so this would be the only thing that would need to be manually updated from time to time. I don't really like that.

Maybe in future PR:

  • Try out uv caching with dependency on uv.lock => It would require to have a uv.lock file tracked by git and updated by the CI, which will be more time consumed than saved IMO.

@ValerianRey ValerianRey added the cc: ci Conventional commit type for changes to the CI (Github workflows and actions). label Apr 28, 2025
@ValerianRey ValerianRey self-assigned this Apr 28, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ValerianRey
Copy link
Copy Markdown
Contributor Author

ValerianRey commented Apr 29, 2025

For the release.yml action, we have no way to test (unless we want to go through testing with the testpypi index, but it would be quite time-consuming). But it really seems to be very similar to how we publish with pdm (except that we have to add a step to build as well). So I would say that what I did will very probably work (90%).

@ValerianRey ValerianRey changed the title Migrate to uv Migrate from pdm to uv Apr 29, 2025
@ValerianRey ValerianRey marked this pull request as ready for review April 29, 2025 15:39
Copy link
Copy Markdown
Contributor

@PierreQuinton PierreQuinton left a comment

Choose a reason for hiding this comment

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

Hard to review and make sure everything is fine, but I cannot spot anything weird.

Could this make a PR to cache install easier? We should try to do that to potentially speedup even more the CI.

@ValerianRey
Copy link
Copy Markdown
Contributor Author

Hard to review and make sure everything is fine, but I cannot spot anything weird.

Could this make a PR to cache install easier? We should try to do that to potentially speedup even more the CI.

See my comment at the top of the PR (I tried but it requires to track uv.lock with git)

@ValerianRey ValerianRey merged commit e32e574 into main Apr 29, 2025
16 checks passed
@ValerianRey ValerianRey deleted the migrate-to-uv branch April 29, 2025 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cc: ci Conventional commit type for changes to the CI (Github workflows and actions).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants