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 publish fails on 1.2.0 #4349

Closed
3 tasks done
martinxsliu opened this issue Aug 3, 2021 · 6 comments · Fixed by #5889
Closed
3 tasks done

poetry publish fails on 1.2.0 #4349

martinxsliu opened this issue Aug 3, 2021 · 6 comments · Fixed by #5889
Labels
kind/bug Something isn't working as expected

Comments

@martinxsliu
Copy link

  • 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

  • Poetry version: 1.2.0a1 and 1.2.0a2

  • Link of a Gist with the contents of your pyproject.toml file:

[tool.poetry]
name = "foo"
version = "0.1.0"
description = "foo"
authors = ["Martin Liu <[email protected]>"]
readme = "README.md"

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

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

Issue

Running poetry publish throws the following exception. This reproduces for both 1.2.0a1 and 1.2.0a2.

  Stack trace:

  8  .venv/lib/python3.9/site-packages/cleo/application.py:330 in run
      328│
      329│             try:
    → 330│                 exit_code = self._run(io)
      331│             except Exception as e:
      332│                 if not self._catch_exceptions:

  7  .venv/lib/python3.9/site-packages/poetry/console/application.py:180 in _run
      178│         self._load_plugins(io)
      179│
    → 180│         return super()._run(io)
      181│
      182│     def _configure_io(self, io: IO) -> None:

  6  .venv/lib/python3.9/site-packages/cleo/application.py:425 in _run
      423│                 io.set_input(ArgvInput(argv))
      424│
    → 425│         exit_code = self._run_command(command, io)
      426│         self._running_command = None
      427│

  5  .venv/lib/python3.9/site-packages/cleo/application.py:467 in _run_command
      465│
      466│         if error is not None:
    → 467│             raise error
      468│
      469│         return event.exit_code

  4  .venv/lib/python3.9/site-packages/cleo/application.py:451 in _run_command
      449│
      450│             if event.command_should_run():
    → 451│                 exit_code = command.run(io)
      452│             else:
      453│                 exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED

  3  .venv/lib/python3.9/site-packages/cleo/commands/base_command.py:118 in run
      116│         io.input.validate()
      117│
    → 118│         status_code = self.execute(io)
      119│
      120│         if status_code is None:

  2  .venv/lib/python3.9/site-packages/cleo/commands/command.py:85 in execute
       83│
       84│         try:
    →  85│             return self.handle()
       86│         except KeyboardInterrupt:
       87│             return 1

  1  .venv/lib/python3.9/site-packages/poetry/console/commands/publish.py:78 in handle
       76│         )
       77│
    →  78│         publisher.publish(
       79│             self.option("repository"),
       80│             self.option("username"),

  AttributeError

  'IO' object has no attribute 'ask'

  at .venv/lib/python3.9/site-packages/poetry/publishing/publisher.py:82 in publish
       78│         )
       79│         # Requesting missing credentials but only if there is not a client cert defined.
       80│         if not resolved_client_cert:
       81│             if username is None:
    →  82│                 username = self._io.ask("Username:")
       83│
       84│             # skip password input if no username is provided, assume unauthenticated
       85│             if username and password is None:
       86│                 password = self._io.ask_hidden("Password:")
@martinxsliu martinxsliu added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Aug 3, 2021
@henriklindgren
Copy link

I see this when I've forgot to install the keyring (in my case keyrings.google-artifactregistry-auth for Google Artifact Registry), but if properly set up that works. Seems limited to breaking the username/password input prompt, other than giving the odd message when missing keyring or cert auth.
poetry 1.2.0a2

@mmalet-sky
Copy link

mmalet-sky commented Nov 12, 2021

@henriklindgren also seeing this error with keyrings.google-artifactregistry-auth installed outside and inside the poetry env (using poetry 1.2.0a2)

EDIT:

solved this by using the -r flag: poetry publish -r <repo-name>

@whisller
Copy link

Have same problem, on version 1.2.0a2, solution for me was to add credentials by calling poetry config http-basic.myrepo

@lalmei
Copy link
Contributor

lalmei commented May 30, 2022

was able to solve the same way @mmalet-sky. using version 1.2.0b1
I set the configs first.

poetry config repo.myreponame url
poetry config http-basic.myreponame username password

and publishing with the following,

poetry publish -r myreponame

even though I had already created this repo in pyproject.toml, albeit without credentials, but with default= true

@neersighted
Copy link
Member

Closing as this is solved on 1.2.0b2 and we're removing the problematic code entirely -- you now use keyring, poetry config, or env vars to pass credentials.

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.

7 participants