Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

[No fix] Poetry publish to Azure DevOps Artifacts returning HTTP Error 405 #5348

Closed
3 tasks done
FilBot3 opened this issue Mar 23, 2022 · 5 comments
Closed
3 tasks done

Comments

@FilBot3
Copy link

FilBot3 commented Mar 23, 2022

  • 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: Fedora 35 Kinoite using Toolbox Container
  • Poetry version: 1.1.13
  • Link of a Gist with the contents of your pyproject.toml file: pyproject.toml

Issue

After following what I did previously in:

I am now getting an HTTP Error 405 from Azure DevOps when trying to publish to an Azure DevOps Artifacts Python Feed. Using a freshly generated PAT token with full access to all accessible organizations, I am having issues publishing my package. I get HTTP Error 405. See the output below.

OS Information

➜  cat /etc/os-release 
NAME="Fedora Linux"
VERSION="35 (Container Image)"
ID=fedora
VERSION_ID=35
VERSION_CODENAME=""
PLATFORM_ID="platform:f35"
PRETTY_NAME="Fedora Linux 35 (Container Image)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:35"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f35/system-administrators-guide/"
SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=35
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=35
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
VARIANT="Container Image"
VARIANT_ID=container

Python Poetry Version

➜  poetry --version
Poetry version 1.1.13

Python Version

➜  python --version
Python 3.10.2

poetry.toml contents

The ${..} is so I am not giving out my organizational information.

[repositories]
[repositories.azure]
url = "https://pkgs.dev.azure.com/${ADO_ORG}/${ADO_PROJ}/_packaging/python-azure-artifacts/pypi/simple/"

Poetry Verbose output

➜  poetry publish -r azure -u phil -p $(cat ~/.local/azdo-pat.txt)

Publishing snow (0.1.0) to azure
 - Uploading snow-0.1.0-py3-none-any.whl 100%

  UploadError

  HTTP Error 405: Method Not Allowed

  at ~/.local/share/pypoetry/venv/lib64/python3.10/site-packages/poetry/publishing/uploader.py:216 in _upload
      212│                     self._register(session, url)
      213│                 except HTTPError as e:
      214│                     raise UploadError(e)
      215│
    → 216│             raise UploadError(e)
      217│
      218│     def _do_upload(
      219│         self, session, url, dry_run=False
      220│     ):  # type: (requests.Session, str, Optional[bool]) -> None

➜  poetry publish -r azure -u phil -p $(cat ~/.local/azdo-pat.txt) -vvv

Publishing snow (0.1.0) to azure
 - Uploading snow-0.1.0-py3-none-any.whl 100%

  Stack trace:

  7  ~/.local/share/pypoetry/venv/lib64/python3.10/site-packages/clikit/console_application.py:131 in run
      129│             parsed_args = resolved_command.args
      130│
    → 131│             status_code = command.handle(parsed_args, io)
      132│         except KeyboardInterrupt:
      133│             status_code = 1

  6  ~/.local/share/pypoetry/venv/lib64/python3.10/site-packages/clikit/api/command/command.py:120 in handle
      118│     def handle(self, args, io):  # type: (Args, IO) -> int
      119│         try:
    → 120│             status_code = self._do_handle(args, io)
      121│         except KeyboardInterrupt:
      122│             if io.is_debug():

  5  ~/.local/share/pypoetry/venv/lib64/python3.10/site-packages/clikit/api/command/command.py:171 in _do_handle
      169│         handler_method = self._config.handler_method
      170│
    → 171│         return getattr(handler, handler_method)(args, io, self)
      172│
      173│     def __repr__(self):  # type: () -> str

  4  ~/.local/share/pypoetry/venv/lib64/python3.10/site-packages/cleo/commands/command.py:92 in wrap_handle
       90│         self._command = command
       91│
    →  92│         return self.handle()
       93│
       94│     def handle(self):  # type: () -> Optional[int]

  3  ~/.local/share/pypoetry/venv/lib64/python3.10/site-packages/poetry/console/commands/publish.py:77 in handle
      75│         )
      76│
    → 77│         publisher.publish(
      78│             self.option("repository"),
      79│             self.option("username"),

  2  ~/.local/share/pypoetry/venv/lib64/python3.10/site-packages/poetry/publishing/publisher.py:93 in publish
      91│         )
      92│
    → 93│         self._uploader.upload(
      94│             url,
      95│             cert=cert or get_cert(self._poetry.config, repository_name),

  1  ~/.local/share/pypoetry/venv/lib64/python3.10/site-packages/poetry/publishing/uploader.py:119 in upload
      117│
      118│         try:
    → 119│             self._upload(session, url, dry_run)
      120│         finally:
      121│             session.close()

  UploadError

  HTTP Error 405: Method Not Allowed

  at ~/.local/share/pypoetry/venv/lib64/python3.10/site-packages/poetry/publishing/uploader.py:216 in _upload
      212│                     self._register(session, url)
      213│                 except HTTPError as e:
      214│                     raise UploadError(e)
      215│
    → 216│             raise UploadError(e)
      217│
      218│     def _do_upload(
      219│         self, session, url, dry_run=False
      220│     ):  # type: (requests.Session, str, Optional[bool]) -> None

pyproject.toml

[tool.poetry]
name = "snow"
version = "0.1.0"
description = ""
authors = ["Phillip Dudley <Predatorian3@gmail.com>"]

[tool.poetry.dependencies]
python = "^3.8"
requests = "^2.24.0"
click = "^8.0.4"
jmespath = "^0.10.0"
pyright = "^1.1.230"

[tool.poetry.dev-dependencies]
pytest = "^5.2"
autopep8 = "^1.5.4"
flake8 = "^3.8.4"
pycodestyle = "^2.6.0"
pylint = "^2.6.0"
jsonlint = "^0.1"
yamllint = "^1.25.0"
rstcheck = "^3.3.1"
artifacts-keyring = "^0.3.1"
twine = "^3.8.0"
keyring = "^23.5.0"

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

[tool.poetry.scripts]
servicenow = 'snow.cli:start'

[tool.pyright]
include = ["src"]
exclude = ["**/node_modules", "**/__pycache__"]
#strict = ["src"]
#typeCheckingMode = "strict"
@FilBot3 FilBot3 added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Mar 23, 2022
@FilBot3
Copy link
Author

FilBot3 commented Mar 23, 2022

Similar to Issue: #4658

@FilBot3
Copy link
Author

FilBot3 commented Mar 29, 2022

I opened an issue on Visual Studio Developer Forums, and the issue was closed with the Duplicate response.

It's something to do with Azure DevOps since both twine and pip, their recommended solutions did not work either.

Closing this ticket as it's not Poetry's issue.

@FilBot3 FilBot3 closed this as completed Mar 29, 2022
@FilBot3 FilBot3 changed the title Poetry publish to Azure DevOps Artifacts returning HTTP Error 405 [No fix] Poetry publish to Azure DevOps Artifacts returning HTTP Error 405 Mar 29, 2022
@abn
Copy link
Member

abn commented Mar 29, 2022

@FilBot3 can you try the following in your poetry.toml?

[repositories]
[repositories.azure]
url = "https://pkgs.dev.azure.com/${ADO_ORG}/${ADO_PROJ}/_packaging/python-azure-artifacts/pypi/upload"

The /simple endpoint wont accept POST requests.

@FilBot3
Copy link
Author

FilBot3 commented Mar 29, 2022

Changing /simple to /upload did the trick. Should I make one for uploading and one for pulling from?

@abn
Copy link
Member

abn commented Mar 29, 2022

Correct. For "pulling" it is package "sources" (in pyproject.toml) for publishing it is "repositories" (in poetry.toml). It is a bit confusing right now, but these are two different configurations.

@abn abn removed kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Mar 29, 2022
@python-poetry python-poetry locked and limited conversation to collaborators Mar 29, 2022
@abn abn converted this issue into discussion #5382 Mar 29, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants