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

uv pip compile does not respect tool.setuptools.dynamic dependencies #1644

Closed
adamtheturtle opened this issue Feb 18, 2024 · 7 comments · Fixed by #2633
Closed

uv pip compile does not respect tool.setuptools.dynamic dependencies #1644

adamtheturtle opened this issue Feb 18, 2024 · 7 comments · Fixed by #2633
Assignees
Labels
compatibility Compatibility with a specification or another tool

Comments

@adamtheturtle
Copy link
Contributor

adamtheturtle commented Feb 18, 2024

With the following files, pip-compile output includes the ruff dependency, uv pip compile does not:

pyproject.toml:

[project]
name = "demo-project"
version = "0.1"
dynamic = ["dependencies"]

[tool.setuptools.dynamic]
dependencies = { file = "requirements.txt" }

requirements.txt:

ruff

pip-compile includes ruff:

> pip-compile pyproject.toml
WARNING: --strip-extras is becoming the default in version 8.0.0. To silence this warning, either use --strip-extras to opt into the new default or use --no-strip-extras to retain the existing behavior.
#
# This file is autogenerated by pip-compile with Python 3.12
# by the following command:
#
#    pip-compile pyproject.toml
#
ruff==0.2.2

uv does not:

> uv pip compile pyproject.toml 
Resolved 0 packages in 174ms
# This file was autogenerated by uv v0.1.4 via the following command:
#    uv pip compile pyproject.toml

I expect uv's behaviour to match pip-compile's, or for the difference to be documented.

> pip-compile --version
pip-compile, version 7.4.0
> uv --version
uv 0.1.4
@zanieb zanieb added the compatibility Compatibility with a specification or another tool label Feb 18, 2024
@sbidoul
Copy link

sbidoul commented Mar 10, 2024

Related: #1624

@albertotb
Copy link

I've also run into this issue and I just wanted to +1 this feature. In my case I have something like:

[tool.setuptools.dynamic]
dependencies = { file = ["requirements.in"] }

and then all the dependencies in requirements.in, which produces an empty requirements.txt file with uv but works with pip-compile.

@zanieb
Copy link
Member

zanieb commented Mar 15, 2024

We will address this as discussed in #1624

@charliermarsh
Copy link
Member

For what it's worth, if you treat the project as a dependency, we should respect it. E.g. echo "-e ." | uv pip compile - or echo "poetry-editable @ ." | uv pip compile -. But yes, we should fix.

@albertotb
Copy link

albertotb commented Mar 15, 2024

I've temporarily fixed this just by using directly (which is not a big deal)

uv pip compile -o requirements.txt requirements.in

It is a little less convenient for extras, i.e.

uv pip compile -o requirements-dev.txt -c requirements.txt requirements.in requirements-dev.in

instead of (this does not work)

uv pip compile --extra dev -c requirements.txt pyproject.toml

(assuming you also have optional-dependencies.dev = { file = ["requirements-dev.in"] } in pyproject.toml)

@charliermarsh
Copy link
Member

I'll be looking into this tomorrow.

@charliermarsh
Copy link
Member

Now in review here: #2633. Expect it to be supported in the next release.

charliermarsh added a commit that referenced this issue Mar 25, 2024
## Summary

When a user passes a `pyproject.toml` to `pip compile` (e.g., `uv pip
compile pyproject.toml`), we extract the requirements from the
`pyproject.toml` directly. However... that isn't always possible (as
seen in the linked issues). When it's _not_, we instead need to run the
PEP 517 build hooks to identify the metadata.

Closes #1624.

Closes #1644.

## Test Plan

`cargo test`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility Compatibility with a specification or another tool
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants