python-poetry / python-poetry/poetry

Sources used as repositories to publish to need a different URL to sources to download from

Open
#7,889 1 comment 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/feature 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.
  • I have searched the FAQ and general documentation and believe that my question is not already covered.

Feature Request

Background

It's currently possible to add a repository to publish to in a pyproject.toml by declaring it as a [secondary] source and then referencing it's name as a --repository in the poetry publish command. This does work in poetry 1.4.

However the URL needed may be different to the URL required to us the same repo as a source. Eg: When using AWS codeartifact as a source, the URL ends /simple but to publish to codeartifact this needs to be removed from the URL. IE: This works:

[[tool.poetry.source]]
name = "codeartifact"
url = "https://acmecorp-1234567.d.codeartifact.eu-west-2.amazonaws.com/pypi/acmecorp/simple/"

[[tool.poetry.source]]
name = "target"
url = "https://acmecorp-1234567.d.codeartifact.eu-west-2.amazonaws.com/pypi/acmecorp/"
poetry publish --repository target 

This comment suggests that I shouldn't even be using a source to publish to but a repository defined poetry.toml and indeed this is hinted at by the documentation.

But adding it as a source to the project does work. It's hard to tell why. I don't know if:

  • this a deliberate, yet undocumented feature?
  • this a side effect of the way poetry sources and repositories work?
  • this a depreciated feature?
  • something else?

It certainly needs better documentation (#4658)

The Request

Could sources in pyproject.toml have two URLs (a push URL and a pull URL) so that repositories to available to publish to can be managed from the project instead of just each individual's workstation.

This would be particularly useful for larger organisations with more than one private PyPi repository. Would it be possible to have the configuration something like:

[[tool.poetry.source]]
name = "codeartifact"
url = "https://acmecorp-1234567.d.codeartifact.eu-west-2.amazonaws.com/pypi/acmecorp/simple/"
# Only used by poetry publish
publish_url = "https://acmecorp-1234567.d.codeartifact.eu-west-2.amazonaws.com/pypi/acmecorp/"

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 source configuration in pyproject.toml, the repository configuration in poetry.toml, and the repositories documentation. Trace how poetry publish --repository resolves a named source or repository, using the AWS CodeArtifact URL examples as the expected case. Done should include a clear decision on whether project sources may publish and how separate pull and push URLs are represented.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
release, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.