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

Question about best practices for cross-compat with pip install -e .[dev] (pre PEP 735 support) #11093

Closed
tlambert03 opened this issue Jan 30, 2025 · 5 comments
Labels
question Asking for clarification or support

Comments

@tlambert03
Copy link

Question

I ❤️ uv and want to be able to just run uv sync in all of my projects and bring along all of the dev dependencies (let's assume no uv.lock exists yet). However, in some cases, I also need to work with others who don't use uv and want to be able to run the classic pip install -e .[dev]... and if I'm not mistaken, pip does not yet support PEP 735? (pypa/pip#12963)

My question is how best to accomplish this. I know I can just use uv sync --extra dev (but would like to just use uv sync).

Would this be the best way to accomplish this until pip supports dependency groups?

[project.optional-dependencies]
dev = ["pytest", "ruff"]   # dev deps still go in the dev extra for now

[dependency-groups]
dev = ["my-package[dev]"]  # reference dev extra in dependency-groups.dev

[tool.uv.sources]
my-package = { workspace = true }   # declare local source

other tips?

Platform

No response

Version

No response

@tlambert03 tlambert03 added the question Asking for clarification or support label Jan 30, 2025
@charliermarsh
Copy link
Member

We'll likely support --group in the uv pip CLI soon, but in the interim, what you could do is uv export --dev -o requirements.txt, and then have non-uv users uv pip install requirements.txt.

@tlambert03
Copy link
Author

thanks for that tip as well! The constraints I'd like to have here (if possible) are:

  • i don't want to have to add/maintain requirements.txt in addition to project.dependencies / project.optional-dependencies
  • i'm aiming for python -m pip install -e .[dev] (no uv installed at all)

as a last question, do you have any caution against the pattern I suggested above? (and then feel free to close this)

1 similar comment
@tlambert03
Copy link
Author

thanks for that tip as well! The constraints I'd like to have here (if possible) are:

  • i don't want to have to add/maintain requirements.txt in addition to project.dependencies / project.optional-dependencies
  • i'm aiming for python -m pip install -e .[dev] (no uv installed at all)

as a last question, do you have any caution against the pattern I suggested above? (and then feel free to close this)

@charliermarsh
Copy link
Member

What you have above seems reasonable... The downsides are just:

  1. The dev extra would be part of the published package metadata (if relevant), whereas a dependency group would not.
  2. Users that install with uv pip won't benefit from uv.lock, and so won't have the same constraints applied to their install.

But otherwise, I think you're on the right track in understanding the various options.

@tlambert03
Copy link
Author

Thanks a bunch 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Asking for clarification or support
Projects
None yet
Development

No branches or pull requests

2 participants