Skip to content
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

Configure constraints file in config files #7336

Open
robertschweizer opened this issue Sep 12, 2024 · 4 comments
Open

Configure constraints file in config files #7336

robertschweizer opened this issue Sep 12, 2024 · 4 comments
Labels
duplicate This issue or pull request already exists

Comments

@robertschweizer
Copy link

Thanks a lot for this great project!

It would be cool if uv.toml and pyproject.toml allowed specifying

constraint = "https://host.local/my-global-constraints.txt

uv currently only allows passing this as environment variable or with the --constraint CLI argument.

In our team, we have a shared global constraints file that's used by all our projects. This way we can quickly exclude broken upstream package versions across all our projects.

With pip, we set the PIP_CONSTRAINT variable in all CI pipelines, and for local development, every engineer has constraint = https://host.local/my-global-constraints.txt in their global pip.conf file. With uv, this is not possible right now. If it were supported in config files, we might just configure it in every project's pyproject.toml.

The same thing would be useful for us in build constraints.

@zanieb
Copy link
Member

zanieb commented Sep 12, 2024

This is roughly a duplicate of #6518

You probably want to read the discussion there regarding constraints from URLs.

@zanieb zanieb added the duplicate This issue or pull request already exists label Sep 12, 2024
@pabarcgar
Copy link

Hi @zanieb , thank you for the quick reply. The issue @robertschweizer mentions is for projects we build using 'uv pip install'. In #6518 you say that 'constraint-dependencies' setting is applied to every single uv command and therefore passing a URL to it is not desirable.

Would it be possible to support 'constraint' and 'build-constraint' settings in the [tool.uv.pip] pyproject.toml section instead?

@charliermarsh
Copy link
Member

I'm pretty sure that constraint-dependencies in [tool.uv] is respected within the current workspace for uv pip commands. So if the pyproject.toml in the current directory has:

[tool.uv]
constraint-dependencies = ["anyio>3"]

Then uv pip commands in that directory will respect the anyio>3 constraint.

@pabarcgar
Copy link

Hi @charliermarsh , thank you for your reply, I think you are right, but what we need is to be able to pass an URL. In the related issue #6518 this is discussed, but URL support is dismissed because that config is used for every uv command and that URL would be accessed unnecessarily. That is reasonable, and that is why we ask to add 'constraint' settings in the [tool.uv.pip] (so the URL is only accessed for URL commands). Does it make sense?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

4 participants