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

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

Open
mstandley-tempus opened this issue Aug 10, 2023 · 3 comments

Comments

@mstandley-tempus
Copy link

mstandley-tempus commented Aug 10, 2023

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.

@mstandley-tempus
Copy link
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.

@chan-vince
Copy link

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.

@MatthewCane
Copy link

+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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants