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:
- Created 3 years ago
- Reactions:29
- Comments:7 (3 by maintainers)
@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,
For this issue we should keep generic environment specific overrides out of scope; but only focus on supporting PyPI mirrors for an environment.
https://github.com/python-poetry/poetry/pull/4944 – looks like it’s implemented here.