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.

Provide way to export only development 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

I’m using Poetry v1.0.0b for this, which (as opposed to v0.12.x) includes the export command.

I come from a background where core dependencies are defined in requirements.txt and development ones in requirements-dev.txt (or similar). Test dependencies might have their own file as well (e.g. to only install what’s necessary to test on CI systems, but not debug and documentation tools).

My issue is that while I can (re-)create the core requirements file via poetry export -f requirements.txt --without-hashes -o requirements.txt, I cannot do the same for the list of (only) development dependencies.

There is the --dev option for the export command (“Include development dependencies.”), but it includes the core dependencies, too. Thus, the result is not the list of additional dependencies that required for development purposes only.

I’m not sure how this can be solved without breaking the (probably useful) use case of exporting all dependencies together.

  • Maybe a --dev-only option?
  • Or make --dev output only development dependencies, but not core ones? And
  • introduce --all to output both core and development dependencies?
    • Should these include extras? If not, and I don’t think they should, is the name “all” appropriate?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:26
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

17reactions
finswimmercommented, Oct 15, 2019

I like the idea, and I think it would be a useful feature for the --extras packages as well. My two favorite implementation would be:

  • --dev-only/ --extras-only as parameters
  • -f requirements-dev.txt/-f requirements-extra.txt

If we can get a consensus about the way, I think I would be able to implement such feature.

@sdispater What’s your opinion?

2reactions
mkniewallnercommented, May 28, 2022

export command is being replaced by a plugin in Poetry 1.2, which should solve the use cases you mentioned.

Tested on latest version with the plugin:

curl -sSL https://install.python-poetry.org | python - --git https://github.com/python-poetry/poetry.git@master
poetry plugin add poetry-plugin-export

Then:

# Export main + dev dependencies
poetry export -f requirements.txt --output requirements.txt --with dev

# Export main dependencies
poetry export -f requirements.txt --output requirements_without_dev.txt

# Export dev dependencies only
poetry export -f requirements.txt --output requirements_only_dev.txt --only dev

Could you confirm if it solves all your use cases?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do you prevent install of "devDependencies" NPM ...
I suggest to use npm ci . If you want to install only production-needed packages (as you wrote - without devDependencies ) then:...
Read more >
Commands | Documentation | Poetry - Python dependency ...
--with : The optional dependency groups to include. --only : The only dependency groups to include. --without-hashes : Exclude hashes from the exported...
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 >
Exporting - Recipe Lifecycle Management - Workato Docs
Exporting packages allows users to create a distributable file that contains related recipes and their dependencies. The export process in recipe lifecycle ...
Read more >
Shake off dev dependencies with Angular's environment files
It contains two files which both export an "environment" object. This object is just a plain JavaScript object which initially only contains one ......
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