You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dependencies listed in dependency groups cannot be specified as extras.
Strictly speaking, you'd never know it, since doing so works fine in your project itself (call it mylibrary). It's only when you go to depend on mylibrary[myextra] in a downstream repo does it become clear that the extra's dependencies are missing.
At least one of poetry lock, poetry build, or poetry publish ought to complain in this case.
Workarounds
Yes, but it is time-consuming to diagnose why dependencies are missing without a careful reading of the documentation.
mylibrary:
[tool.poetry.dependencies]
dep = "1.0.0"
[tool.poetry.group.downstream.dependencies]
# With or without optional = true:otherdep = "2.0.0"
[tool.poetry.extras]
myextra = ["otherdep"]
downstream repo:
[tool.poetry.dependencies]
mylibrary = { version = "*", extras = ["myextra"] }
dep = "*" # GOOD: Detects `dep` in `mylibrary`, pegged to 1.0.0 as expected.
otherdep = "*" # BAD: Does not detect `dep` in `mylibrary[myextra]`, gets 3.0.0.
### Poetry Runtime Logs
```bash session
N/A
The text was updated successfully, but these errors were encountered:
Ah, that's interesting. I could have sworn I had run that and had no errors, but I can confirm that that seems to throw the expected error now... (Thanks and sorry.) I should be correct though that this doesn't get triggered when building/publishing? It seems like it would be better to surface an error on that path rather than allow creating a package that doesn't export the right dependencies.
Description
Buried in the documentation is a single line:
Strictly speaking, you'd never know it, since doing so works fine in your project itself (call it
mylibrary
). It's only when you go to depend onmylibrary[myextra]
in a downstream repo does it become clear that the extra's dependencies are missing.At least one of
poetry lock
,poetry build
, orpoetry publish
ought to complain in this case.Workarounds
Yes, but it is time-consuming to diagnose why dependencies are missing without a careful reading of the documentation.
Poetry Installation Method
other
Operating System
Ubuntu
Poetry Version
Poetry (version 1.8.2)
Poetry Configuration
Python Sysconfig
No response
Example pyproject.toml
downstream repo:
The text was updated successfully, but these errors were encountered: