Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Recursive extra dependencies don't compile like pip-tools #1987

Closed
jdawang opened this issue Feb 26, 2024 · 5 comments · Fixed by #1990
Closed

Recursive extra dependencies don't compile like pip-tools #1987

jdawang opened this issue Feb 26, 2024 · 5 comments · Fixed by #1990
Assignees
Labels
bug Something isn't working

Comments

@jdawang
Copy link

jdawang commented Feb 26, 2024

Essentially the same issue as jazzband/pip-tools#1685. When you have a recursive extras in a pyproject.toml for a private project, uv pip compile fails. If the project is uploaded to an index, then it looks in the index first, but I'd expect it to prioritize the self-reference in pyproject.toml.

Info

  • Platform: macOS Sonoma 14.3
  • uv version: v0.1.10
  • command: uv pip compile pyproject.toml --extra=dev

Reproducible example (from pip-tools issue)

Minimal pyproject.toml

[project]
name = "privateproject"
version = "0.0.1"
dependencies = [
    "tomli",
]

[project.optional-dependencies]
test = [
    "pep517",
]
dev = [
    "privateproject[test]",
]

With pip-tools, this is the output:

❯ pip-compile pyproject.toml --extra=dev
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.10
# by the following command:
#
#    pip-compile --extra=dev pyproject.toml
#

pep517==0.13.1
    # via privateproject
privateproject[test] @ file:///...
    # via file:///...
tomli==2.0.1
    # via
    #   pep517
    #   privateproject
    #   privateproject (pyproject.toml)

With uv, this is the output:

❯ uv pip compile pyproject.toml --extra=dev
  × No solution found when resolving dependencies:
  ╰─▶ Because privateproject[test] was not found in the package registry and privateproject depends on privateproject[test], we can conclude that
      the requirements are unsatisfiable.
@charliermarsh charliermarsh added the bug Something isn't working label Feb 26, 2024
@charliermarsh charliermarsh self-assigned this Feb 26, 2024
@charliermarsh
Copy link
Member

I thought I fixed this but I'll take another look.

@charliermarsh
Copy link
Member

Ahh this is slightly different, you're passing the pyproject.toml directly, I see.

@charliermarsh
Copy link
Member

echo "privateproject[test] @ ./privateproject" | cargo run pip compile - -n works without issue, for reference.

charliermarsh added a commit that referenced this issue Feb 26, 2024
## Summary

When a `pyproject.toml` is provided directly to `uv pip compile`, we
were failing to resolve recursive extras. The solution I settled on here
is to flatten them recursively when determining the requirements
upfront.

Closes #1987.

## Test Plan

`cargo test`
@charliermarsh
Copy link
Member

Fixed in the next release, thanks.

@jdawang
Copy link
Author

jdawang commented Feb 26, 2024

Thanks for the quick fix!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants