|
1 |
| -pypi-browser |
| 1 | +PyPI Browser |
2 | 2 | ============
|
| 3 | + |
| 4 | +**PyPI Browser** is a web application for browsing the contents of packages on |
| 5 | +[the Python Package Index](https://pypi.org/). |
| 6 | + |
| 7 | +You can view a live version which provides information about packages from pypi.org: |
| 8 | + |
| 9 | +* [Search page](https://pypi-browser.ckuehl.me/) |
| 10 | +* [Package page for the `django` package](https://pypi-browser.ckuehl.me/package/django) |
| 11 | +* [Archive browse page for the `Django-4.1.1-py3-none-any.whl` file](https://pypi-browser.ckuehl.me/package/django/Django-4.1.1-py3-none-any.whl) |
| 12 | +* [File viewing page for a random file from the same archive](https://pypi-browser.ckuehl.me/package/django/Django-4.1.1-py3-none-any.whl/django/forms/boundfield.py) |
| 13 | + |
| 14 | +It can also be deployed with a private PyPI registry as its target in order to |
| 15 | +be used for a company's internal registry. |
| 16 | + |
| 17 | + |
| 18 | +## Features |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | +### Browse uploaded package archives |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | +You can see all uploaded package archives for a given package. |
| 28 | + |
| 29 | + |
| 30 | +### Inspect package archive metadata and contents |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | +You can inspect a package archive's metadata and its contents. |
| 35 | + |
| 36 | +Note that this is currently only supported for `.zip` and `.whl` files, but |
| 37 | +support for tarballs is planned. |
| 38 | + |
| 39 | + |
| 40 | +### Easily view files from package archives |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | +You can display text files directly in your browser, with syntax highlighting |
| 45 | +and other features like line selection provided by |
| 46 | +[fluffy-code](https://github.com/chriskuehl/fluffy-code). |
| 47 | + |
| 48 | +Binary files can also be downloaded. |
| 49 | + |
| 50 | + |
| 51 | +## Deploying PyPI Browser |
| 52 | + |
| 53 | +To run your own copy, install |
| 54 | +[`pypi-browser-webapp`](https://pypi.org/project/pypi-browser-webapp/) using |
| 55 | +pip, then run the `pypi_browser.app:app` ASGI application using any ASGI web |
| 56 | +server (e.g. uvicorn). |
| 57 | + |
| 58 | +You can set these environment variables to configure the server: |
| 59 | + |
| 60 | +* `PYPI_BROWSER_PYPI_URL`: URL for the PyPI server to use (defaults to |
| 61 | + `https://pypi.org`) |
| 62 | +* `PYPI_BROWSER_PACKAGE_CACHE_PATH`: Filesystem path to use for caching |
| 63 | + downloaded files. This will grow forever (the app does not clean it up) so |
| 64 | + you may want to use `tmpreaper` or similar to manage its size. |
| 65 | + |
| 66 | +pypi-browser is an ASGI app, and while it performs a lot of I/O (downloading and |
| 67 | +extracting packages on-demand), some effort has been made to keep all blocking |
| 68 | +operations off of the main thread. It should be fairly performant. |
| 69 | + |
| 70 | + |
| 71 | +## Contributing |
| 72 | + |
| 73 | +To build this project locally, you'll need to [install |
| 74 | +Poetry](https://python-poetry.org/docs/) and run `poetry install`. |
| 75 | + |
| 76 | +Once installed, you can run |
| 77 | + |
| 78 | +```bash |
| 79 | +$ make start-dev |
| 80 | +``` |
| 81 | + |
| 82 | +to run a copy of the application locally with hot reloading enabled. |
| 83 | + |
| 84 | + |
| 85 | +## Roadmap |
| 86 | + |
| 87 | +* Add support for non-ZIP files (e.g. `.tar.gz` source distributions). |
| 88 | + |
| 89 | + This shouldn't be too hard, but it may be slow at runtime since unlike zip, |
| 90 | + tarballs don't contain an index or support extracting individual files |
| 91 | + without reading the entire tarball. |
0 commit comments