python-poetry / python-poetry/poetry

Private PyPi URL for publishing and downloading is not the same

Open
#4,658 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

area/docs status/triage
Dominant language
Python
Stars
34.3k
Forks
2.5k
Avg merge
2d 19h
Merged PRs (30d)
30

Description

  • I have searched the issues of this repo and believe that this is not a duplicate.

Issue

Hi,

First thank you for your effort on this library.
I have been trying to add a dependency from a private pypi repo and I followed the docs and other internet resources to be able to download and upload the package from/to my private PyPi server. However, after some experiments, I realised that the download and upload just worked using different URLs.

For downloading I used the following configuration in pyproject.toml, which follows Poetry docs:

[[tool.poetry.source]]
name = "foo_api"
url = "https://pypi.foo.com/simple/"

And it works perfectly.

However, for uploading I had to use a different URL:

$ poetry config repo.foo_api https://pypi.foo.com/
$ poetry publish -r foo_api

which is not what is recommended in the docs [1]

If I use the recommendation from the Docs, then I get the following:

Publishing foo_api (0.1.0) to mqtt_api
 - Uploading foo_api-0.1.0-py3-none-any.whl 100%

  UploadError

  HTTP Error 405: Method Not Allowed

  at ~/.virtualenvs/foo_api/lib/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
make: *** [deploy] Error 1

Seems I was not the first tumbling into this issue, as I found a similar one in stackoverflow:
https://stackoverflow.com/questions/65064910/cant-upload-poetry-package-to-local-dockerized-pypiserver

Installation details
Poetry version 1.1.11
Python version 3.10
20.6.0 Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:21 PDT 2021; root:xnu-7195.141.6~3/RELEASE_X86_64 x86_64

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the repository documentation section linked in the issue and compare its private PyPI URL guidance with the configuration and commands shown. Review the reported failure location in poetry/publishing/uploader.py:216, then verify which URL forms are supported for downloading and publishing; done means the documentation accurately distinguishes them and avoids directing users to a configuration that produces HTTP 405.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.