Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extras installed by default #1340

Closed
3 tasks done
esciara opened this issue Aug 29, 2019 · 3 comments
Closed
3 tasks done

extras installed by default #1340

esciara opened this issue Aug 29, 2019 · 3 comments

Comments

@esciara
Copy link

esciara commented Aug 29, 2019

Issue

Expected behavior

Following the extras documentation statement:

Poetry supports extras to allow expression of:

  • optional dependencies, which enhance a package, but are not required; and
  • clusters of optional dependencies.

Extras should not be installed by default when performing a poetry install, but should be installable only explicitly through a poetry install -E <extra>.

Actual behavior

Extras added with poetry add <package> -E <extra> are installed by default when doing a poetry install.

Further explanations

Performing a poetry add behave -E bdd generates the following in the pyproject.toml file adds the following:

# ~~ snip ~~

[tool.poetry.dependencies]
behave = {version = "^1.2", extras = ["bdd"]}

# ~~ snip ~~

The generated line is without an optional = true, which leads to the package being installed by default with a poetry install.

Workaround

Adding package with poetry add <package> -E <extra> --optional.

Resolution

Change the default behavior of poetry add <package> -E <extra> to be equivalent to poetry add <package> -E <extra> --optional.

@esciara
Copy link
Author

esciara commented Aug 29, 2019

Following my comment at #1145 (comment) , isn't poetry add <package> -E <extra> actually not working properly at all?

Should it not have generated this in pyproject.toml:

# ~~ snip ~~

[tool.poetry.dependencies]
behave = {version = "^1.2", optional = true} 

[tool.poetry.extras]
bdd = ["behave"]

# ~~ snip ~~

@esciara
Copy link
Author

esciara commented Aug 29, 2019

Closing as -E defines the extras to activate for the dependency, not to declare an extra for the package. There is no option on the cli to do that. Ongoing discussion to eventually create one.

See #1145 (comment).

@esciara esciara closed this as completed Aug 29, 2019
Copy link

github-actions bot commented Mar 3, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant