Skip to content

Missing user feedback for why publish was aborted when --no-interaction is set #351

Open

Description

@mstandley-tempus

When trying to run poetry publish on one of our projects with --no-interaction set, we see that the build fails with the error Aborted! and no additional information about why.

It turns out that our build script runs poetry build prior to poetry publish --build. Because of this, we hit this condition in poetry: https://github.com/python-poetry/poetry/blob/2b16b2fcf15da2a69e118a637ab4ee4fcb6a234c/src/poetry/console/commands/publish.py#L60

When we remove --no-interaction we see the message There are 2 files ready for publishing. Build anyway? (yes/no) [no] as expected.

It would have been nice if this message had been visible in our CI system's logs in the first place. Instead of suppressing the user prompt completely, can we print the question and append something on the end to indicate that we're selecting the default option because we are running non-interactively? E.g.,:

There are 2 files ready for publishing. Build anyway? (yes/no) [no] 
WARNING: --no-interaction is set. Choosing the default answer!
Aborted!

Alternatively, change the error message Aborted! to something more descriptive.

Activity

  1. mstandley-tempus commented on Aug 10, 2023

    @mstandley-tempus
    Author

    Additionally, when --no-interaction is unset, if our CI system encounters this situation, it hangs forever, and the prompt never shows up in the console logs, even after aborting the build. This is what prompted us to start using --no-interaction in the first place.

  2. chan-vince commented on Feb 22, 2024

    @chan-vince

    I also have this issue.
    I would expect the --no-interaction to be equivalent to typing 'yes' at the user prompt. Obviously it doesn't make sense to not use the --no-interaction flag in a CI system; that's what it's for.

    It's possible that a more explicit flag like -y, similar to how apt-get -y install works could be clearer than --no-interaction in this case.

    For me, I solved this by removing the build files before running publish with the --build option. Assuming the default dist directory:

    rm -rf dist/
    poetry publish --build --no-interaction

    While this works, I hope a future poetry release would either make --no-interaction be like typing yes at the prompt, or add a new -y flag.

  3. MatthewCane commented on Apr 3, 2024

    @MatthewCane

    +1 on this issue. Removing the dist/ dir certainly works, but it's pretty frustrating. It would be better to have an option to build only if build artifacts don't already exist.

  4. added
    enhancement
    on Jan 3, 2025
  5. psibre commented on Feb 9, 2025

    @psibre

    It would also help if the --clean option that was added to the build command in Poetry v2.0 was also available for the publish command.
    Then we could do poetry publish --clean --build in a single command.

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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions