How are you supposed to install optionals?
See original GitHub issue- I have searched the issues of this repo and believe that this is not a duplicate.
- I have searched the documentation and believe that my question is not covered.
Question
I’ve got something similar to poetry’s pyproject.toml file.
You can see my file here: aiohttp_session_ws
The problem is, now that black
is optional, I can’t get it to install. Should I only be using optional
for packages that are “extras”. And if so, why doesn’t poetry install -E development
then install black?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:6 (2 by maintainers)
Top Results From Across the Web
What Are NPM's Optional Dependencies and When Should ...
Execute npm install someDependency --save-optional to install a package as an optional dependency. The installed package will be put into ...
Read more >What are Optional Dependencies and when should we use them
How to install a dependency as an optional dependency: We can install a dependency as an optional dependency using the following command:
Read more >What Are Windows Optional Updates, and How Do You Install ...
Not all Windows updates are mandatory. Check out our guide on optional updates, what they do, and if you should download them or...
Read more >Python poetry - how to install optional dependencies?
You need to add a tool.poetry.extras group to your pyproject.toml if you want to use the -E flag during install, as described in...
Read more >Should I Install Optional Updates In Windows ... - YouTube
Should I Install Optional Updates In Windows? How To Install Optional Updates Windows 11 [Tutorial]We'll explain what's going on in more ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As it appears to be the case that the use of extras is required for all optional dependencies in order in order to be able to opt-in, I think the phrasing of this comment in the docs at https://python-poetry.org/docs/pyproject/ need to be changed. Note the word “some”, which implies “not all”.
It’s confusing at best.
EDIT I’ve submitted a PR that fixes the issue.
I have the same (or similar) issue:
pyproject.toml
When I run
poetry install -v
, I get:When I run
poetry show -v
:The packages
appdirs
,black
,click
,mypy
,mypy-extensions,
toml,
typed-ast,
typing,
typing-extensions` are red instead of green.When I run
poetry install -v -E developer
I get:and
poetry run pip freeze
shows:HOWEVER, I found a manual fix. When I look at
poetry.lock
, there is a section that looks like this:When I change that list to:
and run
poetry install -v -E developer
I get:and
poetry show
works as expected (all 9 packages are green).It seems the initial extras are not being written to the lock file when the dependencies appear as part of
dev-dependencies
.When I move the requirements from
dev-dependencies
todependencies
, things work as expected:I believe this is a bug. We should be able to define extras that depend on packages only in
dev-dependencies
. I have a straightforward fix that I’m working on and expect to submit today.