Skip to content

poetry export includes extras packages by default #1284

@tommilligan

Description

@tommilligan
  • 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: Ubuntu 18.04
  • Poetry version: 1.0.0a5
  • Link of a Gist with the contents of your pyproject.toml file: mimal example inline below

Issue

Background

I use the extras section to describe additional clusters of packages, as documented in the readme:

# ~~ snip ~~

[tool.poetry.dependencies]
attrs = "~=19.1"
black = { version = "==18.9b0", optional = true }

[tool.poetry.extras]
lint = ["black"]

When I run poetry install, only attrs is installed, and when I run poetry install --extras lint, both attrs and black are installed. So far this is all expected behaviour.

Issue

When I run poetry export -f requirements.txt, all main packages are exported, including all optional packages.

I would expect that the default output of export excludes optional packages, and that these have to be added by an --extras flag.

I'm happy to write up a PR for this, should be something by the end of today.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions