question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue
  • 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.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:29
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
abncommented, 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.

0reactions
Felix-nekocommented, Jan 9, 2022

https://github.com/python-poetry/poetry/pull/4944 – looks like it’s implemented here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PyPI Repositories - JFrog - JFrog Documentation
Set the Package Type to PyPI and enter the Repository Key value. · The URL and Registry URL settings depend on whether you...
Read more >
How to Create a Private Python Package Repository - Linode
On the client computer, create a .pip directory in the home directory. Inside this directory, create pip. · Install the linode_example package:
Read more >
PyPI packages in the Package Registry - GitLab Docs
Publish PyPI packages in your project's Package Registry. Then install the packages whenever you need to use them as a dependency.
Read more >
How to setup two PyPI indices - Stack Overflow
Create a pip.conf ( pip.ini if on Windows) in any of the ... Till then, one needs to manually specify which PyPi index...
Read more >
Help - PyPI
API tokens provide an alternative way (instead of username and password) to authenticate when uploading packages to PyPI. You can create a token...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found