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

poetry install --without installs optional dependency groups #4577

Closed
3 tasks done
pmav99 opened this issue Sep 30, 2021 · 2 comments · Fixed by #5338
Closed
3 tasks done

poetry install --without installs optional dependency groups #4577

pmav99 opened this issue Sep 30, 2021 · 2 comments · Fixed by #5338
Labels
kind/bug Something isn't working as expected

Comments

@pmav99
Copy link
Contributor

pmav99 commented Sep 30, 2021

  • 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).
Poetry
Version: 1.2.0a2
Python:  3.9.7

Virtualenv
Python:         3.8.12
Implementation: CPython
Path:           /tmp/aaa/.venv
Valid:          True

System
Platform: linux
OS:       posix
Python:   /usr

This is somewhat similar to #4401 but that was about poetry 1.1 so I opened a different ticket.

Issue

Let's say we have two optional groups, test and foo. foo does not contain any packages, but this is not important here. I am just keep it empty to speed up dependency resolution etc.

[tool.poetry]
name = "aaa"
version = "0.1.0"
description = ""
authors = ["pmav99 <[email protected]>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.9"

[tool.poetry.group.test]
optional = true
[tool.poetry.group.foo]
optional = true

[tool.poetry.group.test.dependencies]
pytest= "*"

[tool.poetry.group.foo.dependencies]

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

Running poetry update followed by poetry install works great, i.e. pytest will not be installed since nobody asked to install the group test.:

poetry update --quiet
poetry install --quiet
python -mpytest --help || echo 'pytest not installed'

If we try to run poetry install --with foo then still everything works as expected. I.e. pytest remains non-installed.

poetry install --with foo
python -mpytest --help || echo 'pytest not installed'

Nevertheless, when we try to run poetry install --without foo, then the dependencies of group test get installed too!

$ poetry install --without foo
Installing dependencies from lock file

Package operations: 8 installs, 0 updates, 0 removals

  • Installing pyparsing (2.4.7)
  • Installing attrs (21.2.0)
  • Installing iniconfig (1.1.1)
  • Installing packaging (21.0)
  • Installing pluggy (1.0.0)
  • Installing py (1.10.0)
  • Installing toml (0.10.2)
  • Installing pytest (6.2.5)

$ python -c 'import pytest' && echo 'wtf???'
wtf???
@pmav99 pmav99 added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Sep 30, 2021
@MadJlzz
Copy link

MadJlzz commented Jan 13, 2022

Is it really considered a bug? Personally, I would use --without whenever I want to install everything except what I've specified as arguments.

From your example:

  • poetry install should install default dependency group
  • poetry install --with foo should install default and foo dependencies group
  • poetry install --without foo should install default and test dependencies group (basically, everything except foo)

No?

Copy link

github-actions bot commented Mar 1, 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 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants