Add option to install only dev dependencies
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.
Feature Request
Add an option to poetry install
to install only dev dependencies, e.g. poetry install --dev-only
.
Use Case:
Being able to quickly install only dev dependencies in a Continuous Integration environment to run basic quality checks as fast as possible.
As a developer, I run a series of quick checks on my code, like pylint, flake, black, and mypy, both locally and in a CI environment. Locally, those tools can be installed by running poetry install
together with the rest of the package’s dependencies.
In a CI environment I would like to run those tests as quickly as possible to minimize the reponse time of the CI pipeline in the detection of problem in the code. Making a full install of all dependencies could be time consuming for certain projects.
Adding an option to install dev dependencies only will simplify the scripts that run those first stages in the CI pipeline.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:85
- Comments:17 (4 by maintainers)
@jose-lpa
Running
poetry install
installs both production and development dependencies – can you run that in step 3 of your example, or does it not meet your needs? If not, what is the behavior you’re seeing?poetry install --no-dev
poetry install --dev-only
poetry install
Hey @jose-lpa, thanks for bringing this up!
Just for my understanding, are you hoping that all project dependencies would get installed in your workflow? I see
--no-dev
and--dev-only
as being mutually exclusive – each option specifying both the presence of one set of dependencies with the absence of another – and, importantly, not being additive, as it seems you desire.For further clarification, running
poetry install
does install development dependencies. This issue, and others, were requesting a way to only install development dependencies, whereas in your example you’re asking for both production and development dependencies.The current behavior for
--dev-only
lets me run CI scripts which don’t depend on my application code, e.g. formatting and static analysis. For your project, I’m wondering if simply runningpoetry install
before your CI scripts (since your CI seems coupled to your application code & its dependencies) would solve the problem.Finally,
--dev-only
is implemented in the same way that--no-dev
is, in that first runningpoetry install
followed bypoetry install --no-dev
removes a subset of installed dependencies. That said, I will defer to the core maintainers to correct me if I’m wrong!Pinging @finswimmer as they reviewed my previous PR