question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 3 years ago
  • Reactions:85
  • Comments:17 (4 by maintainers)

github_iconTop GitHub Comments

13reactions
opelrcommented, Jul 7, 2021

@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?

Command Prod. Deps Dev. Deps
poetry install --no-dev True False
poetry install --dev-only False True
poetry install True True
3reactions
opelrcommented, Jul 6, 2021

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 running poetry 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 running poetry install followed by poetry 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

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to install only "devDependencies" using npm
The --only={prod[uction]|dev[elopment]} argument will cause either only devDependencies or only non-devDependencies to be installed regardless of the NODE_ENV.
Read more >
Adding dependencies to a package.json file - npm Docs
To add dependencies and devDependencies to a package.json file from the command line, you can install them in the root directory of your...
Read more >
yarn add
Installs a package and any packages that it depends on. Adding dependencies. In general, a package is simply a folder with code and...
Read more >
You're correct. npm ci also installs dev dependencies. Adding
Adding --only=prod or --production would not install devDependencies and just install dependencies . I'll update the article to show both ...
Read more >
pnpm install
If you want to disable this behavior, set the recursive-install setting to false ... Only devDependencies are installed and dependencies are removed insofar ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found