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

Need a way to set a global PyPI repo URL for all project manually. #2940

Closed
2 tasks done
dev-techmoe opened this issue Sep 19, 2020 · 8 comments
Closed
2 tasks done
Labels
kind/feature Feature requests/implementations status/duplicate Duplicate issues

Comments

@dev-techmoe
Copy link

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

Feature Request

Hello everyone, I'm a python developer live in Mainland China. As well known the network connection is so bad in my country that we cannot connect to the official PyPI repo directly sometimes. So most of us usually some PyPI mirrors in our region (like https://mirrors.aliyun.com/pypi/simple/, it's deployed by AlibabaCloud) to get a fast and stabilizing network connection. PIP gives us a way to set the index globally using pip config set global.index-url . But I cannot find related config items in Poetry.
Okay, I know what you want to say, I know I can set repo info in my pyproject.toml like this.

[[tool.poetry.source]]
name = "aliyun"
url = "https://mirrors.aliyun.com/pypi/simple/"
default = true

But it will cause some tricky problems. If I have some workmates in other countries, they don't need repo mirrors to speed up service, even it will make them cannot use PyPI repo (thanks to stupid GFW), or we need to use Github Action as our CI service, they all don't need this config item. So I think the PyPI repo URL should not as a project config in my project repo, we need a way to set in our dev environment and use it for all projects. Thank you.

@dev-techmoe dev-techmoe added kind/feature Feature requests/implementations status/triage This issue needs to be triaged labels Sep 19, 2020
@gaoming714
Copy link

I see what you mean, there should really be a global control, or I hope the project leader can use even pip configuration.
Because I pip to download when it is convenient to use pqi to control repo.

Is there some one can answer it, make poetry use pip repo.

Maybe you need someway to connect google, you know it.

@abn
Copy link
Member

abn commented Sep 28, 2020

@dev-techmoe I can definitely appreciate your situation and I do agree that there are various cases where you would want to use a mirror instead of public pypi index.

Poetry has some hard-coded assumptions about PyPI. This means taht simply setting a url for PyPI will not work. The assumptions include (but not limited to), the use of the JSON endpoint to get package metadata, There is no guarentee that this exists for all mirrors. We need to,

  1. Allow for poetry to be confired with first-class knowledge of PyPI mirrors.
  2. Improve legacy repository support to ensure that we detect "true" legacy repos (ie, without json endpoints).
  3. With these changes, we should be able to safely configure mirror urls and identify if they are warehouse compatible and be smart about what endpoints we use.

For this issue we should keep generic environment specific overrides out of scope; but only focus on supporting PyPI mirrors for an environment.

@teruokun
Copy link

So, I agree that solving for this use-case is blocked on the above (supporting full Pypi mirrors or repositories based on full pypi mirrors that don't implement the json apis), but it's actually a different feature.

I actually also have this use-case, but it's because we have multiple private repositories that we actually want to publish to as they have specific use-cases as we want their ecosystems to be independent of one-another and we want the build logic to all be the same and use the same underlying code repository, but our build logic would do some environment setup before running poetry directly. If it could be done as a part of 'env' or even settable as an option to install or add on the command line, this would make life much simpler.

@abn
Copy link
Member

abn commented Oct 16, 2020

@teruokun I think your usecase can be handled in otherways. For example;

export POETRY_REPOSITORIES_SOMEWHERE_URL=https://somewhere.com/legacy
export POETRY_HTTP_BASIC_SOMEWHERE_USERNAME=username
export POETRY_HTTP_BASIC_SOMEWHERE_PASSWORD=password
poetry publish --build -r somewhere

Alternatively, once #3068 is done, you could do something like this.

poetry publish --build -r https://somewhere.org/legacy -u username -p password

@NateScarlet
Copy link

Duplicate of #1632

@finswimmer
Copy link
Member

Thanks for pointing to the duplications @NateScarlet.

@Felix-neko
Copy link

#4944 -- looks like it's implemented here.

Copy link

github-actions bot commented Mar 2, 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 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/feature Feature requests/implementations status/duplicate Duplicate issues
Projects
None yet
Development

No branches or pull requests

7 participants