Poetry install no longer removes dev dependencies
See original GitHub issue- I am on the latest Poetry version.
- I have searched the issues of this repo and believe that this is not a duplicate.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option).
- OS version and name: MacOS
- Poetry version: 0.12.2
Issue
There is currently no way to go from a develop
poetry install
to one that has --no-dev
.
In previous versions, if you ran poetry install --no-dev
it would remove all dev dependencies from the current virtual environment.
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Commands | Documentation | Poetry - Python dependency ...
--no-dev : Do not install dev dependencies. (Deprecated, use --without dev or --only main instead); --remove-untracked : Remove dependencies not presented ...
Read more >python - poetry: no way exclude dependencies for production?
Dev dependencies don't get installed when you do a normal poetry install . Do you have some reason to think it would be...
Read more >Dependency Management With Python Poetry
When you add a requirement to the pyproject.toml file, it's not installed yet. As long as there's no poetry.lock file present in your...
Read more >Add ability to optionally ignore dev dependencies in Poetry ...
When Dependency Scanning runs on Poetry projects, it will always include development dependencies. NPM projects with dependency scanning respect ...
Read more >A Poetic Apology. Or Why Should You Use Poetry to Manage…
lock file already exists, if you now run poetry install then Poetry will resolve and install dependencies using the versions specified in such...
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
This behavior seems like a bug, especially in how
--no-dev
is documented.This doesn’t state that
poetry
will uninstall anything. Can this be addressed with docs and perhaps a flag or configuration to not have this behavior happen?My use case for example is to not have
poetry
uninstall every python package I have installed inside a docker container, or a developer machine, when it is configured to not use virtualenvs.This is quite a big pain point actually. It’d be nice to at least have a flag to turn this behavior off. Here is how I’m trying using it.
I’m working on a library say LibA and I need to manually test it in multiple apps during development. From docs and
poetry install --help
, it seemspoetry install --no-dev
is the exactly what I need because of:Intuitively, I felt I’d do the following:
This installs LibA as an editable install in app’s venv. Now I should be able to run the app, make changes to LibA and have them reflect in the app without having to re-install LibA after every change.
However, this doesn’t work exactly as expected. When
poetry install
is executed with the--no-dev
option, it looks up for all dev dependencies of LibA and uninstalls them from app’s env. This is a huge issue if app has any packages in common with LibA’s dev dependencies. What makes it even worse is that poetry removes even indirect dependencies which makes it very likely for the deps to match.I feel the default behavior should be to not install dev dependencies when
--no-dev
is passed (as it is documented) and to not remove any packages at all. If that is not desirable for some reason, we should be able to pass in another CLI param that prevents poetry from removing packages. Something likepoetry install --no-dev --no-remove
.BTW what use cases demand that dev packages get removed when
--no-dev
is passed? Poetry already spports a--remove-untracked
option. May be if a user wants to remove dev deps, they can runpoetry install --no-dev --remove-untracked
and this would ensure any dev deps are uninstalled.poetry install --no-dev
would only install packages and never remove anything.Question: Is there another ideal way to work with the workflow that I described above when using poetry?