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
Install dependency's extra based on my extra #5733
Comments
We're facing this same problem with an internal dependency used in multiple micro-services. Solving it in the same way the OP works around Is there a better way to solve this? |
[tool.poetry.dependencies]
python = "^3.10"
celery = [
{ version = "^5.2.6" },
{ version = "^5.2.6", extras = ["redis"], optional = true },
]
[tool.poetry.extras]
redis = ["celery"] works for me on master. As does the variation in your pyproject.toml that includes explicit You didn't say what version of poetry you're using, perhaps you could try again with the latest beta and confirm. I expect that an MR improving the docs would be welcomed. However it looks as though you had in fact found a good way to do this, but it wasn't working, so perhaps no need? |
Thank you for your reply. I was using Poetry 1.1.13. With 1.2.0b2 it does indeed work. I'm looking forward to the release 😄 Is there/will there be a way to specify in the pyproject.toml that the project requires Poetry >= 1.2.0? The docs suggest you can specify the poetry_core version. But this doesn't really help, does it? In fact it seems you can just specify any version there, even ones that don't exist, and Poetry will run just fine without any error. |
no |
this can be closed |
@dimbleby this solution does seem to support Did anyone found a fully working solution for both |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Issue
Hi!
I'm trying to install a dependency's extra based on my own package's extra. E.g. I want to always install
celery
but when I specify-E redis
, I want to installcelery[redis]
. I believe this case is not described in the documentation.Here is a
pyproject.toml
where I tried some things but it didn't work out. In no combination of these lines wouldpoetry install -E redis
installredis
.An easy fix for my case would be to install
redis
itself as an optional dependency. However, this only works becausecelery[redis]
is the same iscelery
plusredis
(see here). An imagined case where it wouldn't work would besomepackage[caching]
which installssomepackage
plussomecache
plusconvenience_functions_for_somecache
. Even if one would manually look up these dependencies, regular checks for changes would still be required.So, is this possible with Poetry? If so, I think it would be great to see this described in the docs. If it is not possible, I would like to see it as a new feature because it feels to me like a fairly common case.
Thanks in advance!
The text was updated successfully, but these errors were encountered: