conda-forge / conda-forge/conda-forge.github.io
Changing the default `source:` URLs for PyPI archives to `files.pythonhosted.org`
- Dominant language
- JavaScript
- Stars
- 170
- Forks
- 320
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 5
Description
Currently, the documentation and tools default to download PyPI distributions via `pypi.org`. However, according to the [upstream documentation](https://docs.pypi.org/api/#predictable-urls), the canonical "predictable" URL should be:
```
https://files.pythonhosted.org/packages/source/{name[0]}/{name}/{name}-{version}.tar.gz
```
Now, I don't think switching is critical here, as it is unlikely that upstream will disable the old URLs anytime soon. However, using the current URL involves an additional 301 redirect:
```console
$ wget https://pypi.org/packages/source/f/flit-core/flit_core-3.12.0.tar.gz
--2026-07-01 15:10:52-- https://pypi.org/packages/source/f/flit-core/flit_core-3.12.0.tar.gz
Resolving pypi.org (pypi.org)... 151.101.128.223, 151.101.64.223, 151.101.0.223, ...
Connecting to pypi.org (pypi.org)|151.101.128.223|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://files.pythonhosted.org/packages/source/f/flit-core/flit_core-3.12.0.tar.gz [following]
--2026-07-01 15:10:52-- https://files.pythonhosted.org/packages/source/f/flit-core/flit_core-3.12.0.tar.gz
Resolving files.pythonhosted.org (files.pythonhosted.org)... 151.101.192.223, 151.101.0.223, 151.101.128.223, ...
Connecting to files.pythonhosted.org (files.pythonhosted.org)|151.101.192.223|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://files.pythonhosted.org/packages/69/59/b6fc2188dfc7ea4f936cd12b49d707f66a1cb7a1d2c16172963534db741b/flit_core-3.12.0.tar.gz [following]
--2026-07-01 15:10:52-- https://files.pythonhosted.org/packages/69/59/b6fc2188dfc7ea4f936cd12b49d707f66a1cb7a1d2c16172963534db741b/flit_core-3.12.0.tar.gz
Reusing existing connection to files.pythonhosted.org:443.
HTTP request sent, awaiting response... 200 OK
Length: 53690 (52K) [application/octet-stream]
Saving to: ‘flit_core-3.12.0.tar.gz’
flit_core-3.12.0.tar.gz 100%[============================================================>] 52,43K --.-KB/s in 0,02s
2026-07-01 15:10:52 (2,10 MB/s) - ‘flit_core-3.12.0.tar.gz’ saved [53690/53690]
```
And while both domains are currently resolving to the same addresses, I suppose using the canonical CDN URL runs a lower risk of hitting a more "expensive" server.
This is also what others are doing, per:
- [Arch Linux Python package guidelines](https://wiki.archlinux.org/title/Python_package_guidelines#Source)
- [Gentoo pypi.eclass implementation](https://gitweb.gentoo.org/repo/gentoo.git/tree/eclass/pypi.eclass#n173) (looks like one of the mirrors is unhealthy, you may need a few attempts)
- [Fedora Referencing Source documentation](https://docs.fedoraproject.org/en-US/packaging-guidelines/SourceURL/#_python_packages_pypi)
So what I'd like to propose is default to `files.pythonhosted.org`, and slowly work towards migrating existing feedstocks to use it.
xrefs:
- [x] conda-smithy hint: https://github.com/conda-forge/conda-smithy/pull/2604
- [ ] conda-forge-bot migrator: https://github.com/conda-forge/conda-forge-bot/pull/6275
- [x] grayskull defaults: https://github.com/conda/grayskull/pull/663
- [x] rattler-build generate defaults: https://github.com/prefix-dev/rattler-build/pull/2586
- [ ] docs: https://github.com/conda-forge/conda-forge.github.io/pull/2874
- [ ] staged-recipes: https://github.com/conda-forge/staged-recipes/pull/34117
Contributor guide
Research direction
Start by reviewing the documentation and tool defaults discussed in the issue, then compare them with PyPI's predictable URL documentation. Update the relevant defaults and documentation to use files.pythonhosted.org, and verify that the generated source URLs match the canonical pattern.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100