astral-sh / rye

a Hassle-Free Python Experience
https://rye.astral.sh
MIT License
13.29k stars 455 forks source link

Store dev dependencies under the [project.optional-dependencies.dev] key? #705

Open MartinBernstorff opened 6 months ago

MartinBernstorff commented 6 months ago

This is what I have been doing for my projects so far; it means that dev dependencies can be installed via pip as well!

I'm unsure about the practical and/or semantic downsides, would love to learn more here 👍

Thanks a ton for the work you're doing on Rye!

mitsuhiko commented 6 months ago

This is something I have been considering. The main reason it's not today is that optional-dependencies.dev cannot contain any pip args and the current hackjob lets you do things such as -e foo. I am however quite in favor of trying to abuse already existing standards liberally :)

One thing that makes this a bit tricker is that dev/non dev is currently not a persisted thing. We store separate lock files for either and autosync just assumes dev (there is no RYE_ENVIROMENT=production or something similar today). If we were to just move this into [dev] it might need some changes to how lock files and synching is handled.

MartinBernstorff commented 6 months ago

Happy to hear it, and good points!

Just to add some contexts, allowing other devs to install required dev dependencies with pip without having to install Rye makes me much more likely to recommend it.

gunungpw commented 6 months ago

There is ongoing PEP about this topic; Python Discuss Forum PEP 735 - Dependency Groups in pyproject.toml

wgordon17 commented 5 months ago

Just throwing in my vote for development dependency groups! This would be a huge readability win! Being able to separate development dependencies into test/lint/local types of groupings is a flow that I'm already using in PDM, and makes everything much easier to manage

rbavery commented 5 months ago

I'd like to use something like dependency groups not just for development but also to build wheels for cpu and gpu versions of a python package that mostly share the same core dependencies but have some package versions that have both (or either) a cpu or gpu variant (pytorch, torchvision, triton). related issue: https://github.com/astral-sh/rye/issues/421