mirror of
https://github.com/vinta/awesome-python.git
synced 2026-11-20 06:40:51 +00:00
docs: rewrite Package Repositories category intro
The old intro recommended Warehouse, which the 2026-10-02 audit removed from the README section. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
50de923ae1
commit
b888f20a02
1 changed files with 9 additions and 10 deletions
|
|
@ -1,17 +1,16 @@
|
|||
Your own Python package repository can mirror PyPI with bandersnatch, or host private packages over a PyPI cache with devpi. Warehouse is the code behind PyPI.
|
||||
Private packages can live on a Python package repository you host, such as pypiserver. devpi serves them too, next to a cache of PyPI.
|
||||
|
||||
How to choose:
|
||||
|
||||
- A full or filtered mirror of PyPI: bandersnatch
|
||||
- Private packages, with PyPI served from the same index: devpi
|
||||
- A PyPI cache that keeps working offline: devpi
|
||||
- Testing and staging your releases before PyPI: devpi
|
||||
- Learning how PyPI works, or contributing to it: Warehouse
|
||||
- Your own packages, served from a plain folder: pypiserver
|
||||
- A PyPI cache that keeps installs working when PyPI is down: devpi
|
||||
- Your own indexes, with releases tested and staged before they go to PyPI: devpi
|
||||
- A copy of PyPI, whole or filtered, for a network that can't reach it: bandersnatch
|
||||
|
||||
bandersnatch is what [PyPI's help page recommends](https://pypi.org/help/#mirroring) for running your own mirror. It only syncs the static files installers need: it takes no uploads and skips PyPI's dynamic APIs. [Its quickstart](https://github.com/pypa/bandersnatch#quickstart) has you run `bandersnatch mirror` once to write a config file, then adapt that file. Run it again to fill the mirror, and on a schedule to keep it current. [Add an allowlist or blocklist](https://bandersnatch.readthedocs.io/en/latest/filtering_configuration.html#allowlist-blocklist-filtering-settings) to cut the mirror down, and serve its `web/` directory with any static web server.
|
||||
pypiserver is a [minimal PyPI-compatible server](https://github.com/pypiserver/pypiserver) that serves packages from regular directories, so pip and twine talk to it as they would to PyPI. [Start it on a folder](https://github.com/pypiserver/pypiserver#quickstart-installation-and-usage) with `pypi-server run -p 8080 ~/packages`, then copy your packages in, or upload them with twine. Its docs strongly advise you to [password-protect uploads](https://github.com/pypiserver/pypiserver#uploading-packages-remotely) with an htpasswd file. A package it doesn't have [redirects pip to PyPI](https://github.com/pypiserver/pypiserver#client-side-configurations).
|
||||
|
||||
devpi is what [PyPI's help page recommends](https://pypi.org/help/#private-indices) for private packages, which PyPI doesn't host. devpi-server sets up `root/pypi`, [a caching mirror of PyPI](https://devpi.net/docs/devpi/devpi/stable/+doc/quickstart-pypimirror.html) that downloads each release on first request and works offline after that. When a cache is all you need, point pip at it. For your own packages, [create an index with `root/pypi` as its base](https://devpi.net/docs/devpi/devpi/stable/+doc/quickstart-releaseprocess.html#initializing-a-basic-server-and-index), so one URL serves your uploads and all of PyPI. By default, a name you upload there [hides the PyPI package with the same name](https://devpi.net/docs/devpi/devpi/stable/+doc/userman/devpi_indices.html#modifying-the-mirror-whitelist), which stops dependency confusion attacks. devpi-client handles the release steps: `devpi upload`, `devpi test` to run their tox tests, and `devpi push` to a staging index or on to PyPI. Before you put the server on the internet, [secure it](https://devpi.net/docs/devpi/devpi/stable/+doc/adminman/security.html): its docs warn that exposing it isn't safe by default.
|
||||
devpi pairs a [PyPI-compatible server with a command-line tool](https://devpi.net/docs/devpi/devpi/latest/+doc/index.html) for packaging, testing, and release. For a cache alone, install devpi-server and [point pip at its `root/pypi` index](https://devpi.net/docs/devpi/devpi/latest/+doc/quickstart-pypimirror.html). Once pip has fetched a file through it, that file installs offline too. For your own packages, add devpi-web and devpi-client, and [create an index based on `root/pypi`](https://devpi.net/docs/devpi/devpi/latest/+doc/quickstart-releaseprocess.html), so all of PyPI shows up beside your uploads. `devpi upload` publishes a release there, `devpi test` runs tox against it and records the result, and `devpi push` sends it on to a staging index or to PyPI. A package you upload [hides PyPI's packages of the same name](https://devpi.net/docs/devpi/devpi/latest/+doc/userman/devpi_indices.html#modifying-the-mirror-whitelist) by default, which prevents dependency confusion attacks.
|
||||
|
||||
Warehouse powers PyPI itself, and [its own docs say](https://warehouse.pypa.io/application/#usage-assumptions-and-concepts) people who run their own package index usually use other tools, like devpi. Read it to learn how PyPI works, or [set up its development environment](https://warehouse.pypa.io/development/getting-started/) with Docker to contribute.
|
||||
bandersnatch is the Python Packaging Authority's [PyPI mirror client](https://bandersnatch.readthedocs.io/en/latest/): it syncs PyPI's packages to disk as static files, and [any web server can serve them](https://bandersnatch.readthedocs.io/en/latest/serving.html). [Run `bandersnatch mirror`](https://github.com/pypa/bandersnatch#quickstart) once to create its config file, adjust the config, then run it again to fill the mirror. To mirror only what you use, list projects in an allowlist, which can also [read your requirements files](https://bandersnatch.readthedocs.io/en/latest/filtering_configuration.html#requirements-files-filtering).
|
||||
|
||||
Whichever you run, point pip at your server as its only index. [pip's docs call `--extra-index-url` unsafe](https://pip.pypa.io/en/stable/cli/pip_install/#cmdoption-extra-index-url) for private packages: pip checks every index with no priority, so a package with the same name on PyPI can win. And [serve your repository over valid HTTPS](https://packaging.python.org/en/latest/guides/hosting-your-own-index/).
|
||||
Whichever you run, set it as pip's `index-url`, so it replaces PyPI instead of sitting beside it. pip's docs call [`--extra-index-url` for private packages unsafe](https://pip.pypa.io/en/latest/cli/pip_install/#cmdoption-extra-index-url), since anyone can publish a package with the same name on PyPI. Serve it over HTTPS too, as the [Python Packaging User Guide highly recommends](https://packaging.python.org/en/latest/guides/hosting-your-own-index/).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue