Skip to content

1.2.x version regression: when install called multiple times with different "extras", then "extras" from previous step are removed #5895

Closed

Description

@simon-liebehenschel

Steps to reproduce (1.2.x version)

  1. poetry install -E foobar
  2. poetry install -E spameggs

After calling -E spameggs, all extras from "foobar" will be removed.

Old behavior (1.1.x version)

  1. poetry install -E foobar
  2. poetry install -E spameggs

After calling -E spameggs, all extras from "foobar" are kept. In result, I have all "foobar" and "spameggs" dependencies.

Problems

Rationale

In the past, I was able to use Docker multi-stage builds:

FROM python:3.10-slim-bullseye as base
# Install only main dependencies
RUN poetry install --no-interaction --no-ansi --no-root --no-dev


FROM base as testing
# We have runtime dependencies, now add only "dev" dependencies
RUN poetry install --no-interaction --no-ansi --no-root


FROM base as deploy
# We have runtime dependencies, now add only cloud dependencies
RUN poetry install --no-interaction --no-ansi --no-root --no-dev -E cloud_deploy

In other words, I was able to add more and more "extras" on every CI/CD step. Since 1.2.x version such behavior is broken and I see no workarounds.

Activity

  1. changed the title [-]1.2.x version regression: when `install` called multiple times with different "extras", previous "extras" are removed[/-] [+]1.2.x version regression: when `install` called multiple times with different "extras", then "extras" from previous step are removed[/+] on Jun 22, 2022
  2. dimbleby commented on Jun 22, 2022

    @dimbleby
    Contributor

    The 1.2 behaviour seems like an improvement to me. If you want to install more than one set of extras then, per the help

      -E (--extras)          Extra sets of dependencies to install. (multiple values allowed)
    

    multiple values are allowed

  3. simon-liebehenschel commented on Jun 22, 2022

    @simon-liebehenschel
    Author

    The 1.2 behaviour seems like an improvement to me. If you want to install more than one set of extras then, per the help

      -E (--extras)          Extra sets of dependencies to install. (multiple values allowed)
    

    multiple values are allowed

    Multiple values were allowed in 1.1.x. You are talking about a different thing.

    I need to install more and more extras during multiple CI/CD stages. Can you see the difference between installing multiple extras at once and installing multiple extras by calling poetry install multiple times? The second option is what I need:

    CI stage 1:
        poetry install -E base
    
    CI stage 2:
        poetry install -E foobar
    
    
    CI stage 3:
        poetry install -E cloud_deploy
    
    # At the end I must have "base foobar cloud_deploy". All selected extras!
    

    Of course I can always install -E "foo bar spam eggs" at the start, but this is not what I need. E.g. I do not need cloud dependencies for my unit tests. I need to add cloud dependencies as an extra later, but I need to keep all other extras that I've installed at the beginning.

  4. dimbleby commented on Jun 22, 2022

    @dimbleby
    Contributor

    stage 1 install foo, stage 2 install foo + bar, stage 3 install foo + bar + baz?

  5. simon-liebehenschel commented on Jun 22, 2022

    @simon-liebehenschel
    Author

    stage 1 install foo, stage 2 install foo + bar, stage 3 install foo + bar + baz?

    Yes, exactly. I can do as you wrote, but this will result in more boilerplate code inside Dockerfile multi-stages. I will need to copy/paste specific extras again and again in every Dockerfile stage.


    I am fine with the current (new) Poetry behavior, but it must be documented. Of course, if you say that this is a feature and not a bug.

  6. dimbleby commented on Jun 22, 2022

    @dimbleby
    Contributor

    An MR updating the docs would be welcome I'm sure. I've been trying to help you with

    and I see no workarounds

    ... and I think we're done.

  7. juhoinkinen commented on Sep 12, 2022

    @juhoinkinen

    I'm surprised of this behaviour. Often I find myself needing to use a feature provided by some extra, which I would like to just add to my current environment. I might not even know or remember what other extras I have already installed, but I would like to still have them.

    How about adding an option --keep-existing that would retain the already installed extras (or simply any dependencies) when installing new ones?

    (Issue #6229 discusses the same and its linked PR #6432 improves related documentation.)

  8. neersighted commented on Sep 12, 2022

    @neersighted
    Member

    Not a bug / docs are updated by #6432.

  9. github-actions commented on Mar 1, 2024

    @github-actions

    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.

  10. locked as resolved and limited conversation to collaborators on Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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