-
Notifications
You must be signed in to change notification settings - Fork 681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to add files that need to be considered for the cache key in pyproject.toml #6255
Comments
I want to work on this but I don't yet have a good solution for |
I could special-case |
Well... something like |
That seems reasonable to me. |
How complicated does support for Git state need to be? Like... the commit hash changed? There are unstaged changes? The tree is dirty? Number of commits since a tag? etc. |
I think "commit hash changed" is fine. |
I guess |
This exists as of v0.4.8. You can do things like: [tool.uv]
cache-keys = [{ file = "pyproject.toml" }, { file = "requirements.txt" }, { git = true }] |
Consider the following
pyproject.toml
file, which uses dynamic metadata to referencerequirements.in
files.When invoking the command
uv pip compile -o requirements.txt pyproject.toml
then setuptools is used to build the project, which is the tool that understands thedynamic
andtool.setuptools.dynamic
configuration. Once the build is finished, uv reads the package'srequires.txt
and generatesrequirements.txt
.The problem is that after (only) modifying
requirements.in
, the commanduv pip compile
does not update therequirements.txt
file. This is because the contentpyproject.toml
did not change anduv
decide to not reinstall the package (call setuptools) again.The current workaround is to add
--reinstall
or--reinstall-package=myproject
to the command or configuration and force setuptools to run.This was discussed in discord, and the user
@ThiefMaster
suggested that we could add a new configuration under[tool.uv]
which allows specifying which files have to be considered as part of 'pyproject.toml's cache key.One example would be:
Worth mentioning also (not part of this ticket) that it would be good if
uv
supported popular dynamic implementations natively and not need to invoke setuptools for it.The text was updated successfully, but these errors were encountered: