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

Dependency Extras Are Unnecessary & Illogically Removed After Adding #2494

Closed
3 tasks done
cpvandehey opened this issue Jun 4, 2020 · 3 comments · Fixed by python-poetry/poetry-core#78 or #2887
Closed
3 tasks done
Labels
area/cli Related to the command line area/solver Related to the dependency resolver kind/bug Something isn't working as expected

Comments

@cpvandehey
Copy link

cpvandehey commented Jun 4, 2020

  • 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: MacOS Catalina 10.15.4

  • Poetry version: 1.0.5

Issue

Hello, I am working on a project that is experiencing odd "extra" dependency removals. At a high level, I have noticed "extras", that are explicitly written within the pyproject.toml file, are removed whenever I add a new dependency. For security/privacy purposes, I will only be pasting in some sections of the code.

pyproject.toml:

...
[tool.poetry.dependencies]
package-a = {version = "^1", extras = ["app", "boto"]}
...

poetry.lock contains package-a and both app and boto as dependencies. I was happy with this initial state.

When I go to add a new dependency, e.g. Django (could be anything for that matter), I am seeing this within the poetry output:
poetry add django -vv

Package operations: 4 installs, 0 updates, 8 removals

  - Installing asgiref (3.2.7)
  - Installing pytz (2020.1)
  - Installing sqlparse (0.3.1)
  - Installing django (3.0.7)
  - Removing boto (2.49.0)
...

It has no logical reason to remove boto, but it does and does not explain anything related to boto within the very verbose output.

Surprisingly, when I lock down the version of package-a to NOT use caret specification (like so):
pyproject.toml:

...
[tool.poetry.dependencies]
package-a = {version = "1.0.0", extras = ["app", "boto"]}
...

And I proceed to add django the same way I did above. It doesn't remove boto! It respects the extra when I don't use carets to note the applicable package version updates.

For what its worth, this issue also holds when I use multiple requirements like so:
pyproject.toml:

...
[tool.poetry.dependencies]
package-a = {version = ">= 1.2, < 1.5", extras = ["app", "boto"]}
...

--

In summary, I can't understand why package extras are deemed removable when I use caret specification. I find this to be somewhat similar to the other issues, but certainly with its unique set of characteristics.

@cpvandehey cpvandehey added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jun 4, 2020
@finswimmer finswimmer added area/cli Related to the command line area/solver Related to the dependency resolver labels Jun 6, 2020
@ghost ghost mentioned this issue Jun 11, 2020
3 tasks
@ghost
Copy link

ghost commented Jun 11, 2020

Can reproduce with the following package (that has a dependency on dask[dataframe]):

$ poetry new test_proj
$ cd test_proj
$ poetry install
$ poetry add tsfresh  # here everything gets installed as it should
$ poetry update  # here fsspec, locket and partd are removed

Interestingly, pinning the version number to an exact version doesn't help in this case.

Similar bug to #2080 and #2300 IMO

@bibz
Copy link
Contributor

bibz commented Aug 7, 2020

Can reproduce with directory dependencies.

I cannot poetry add <DIRECTORY_PATH> and specify a version as suggested in OP.
My workaround is to run poetry add for the dependency with the extras every time I change/update the other dependencies.

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
area/cli Related to the command line area/solver Related to the dependency resolver kind/bug Something isn't working as expected
Projects
None yet
4 participants