asgi-gzip
gzip middleware for ASGI applications, extracted from Starlette
Installation
Install this library using pip:
pip install asgi-gzip
Usage
from asgi_gzip import GZipMiddleware
from my_asgi_app import app
gzip_app = GZipMiddleware(app)
Consult the Starlette GZipMiddleware documentation for full details.
Should you use this package?
This package exists purely for use by ASGI applications that want to add gzip support without adding the whole of Starlette as a dependency.
But... Starlette is actually a very light dependency! It's a small codebase and it only depends on two other small libraries - check its install_requires in the Starlette setup.py module.
So if you don't mind adding Starlette as a dependency, you should consider using that directly instead.
Tracking Starlette
Since this code is extracted from Starlette, it's important to keep watch for changes and bug fixes to the Starlette implementation that should be replicated here.
The GitHub repository for this library uses Git scraping to track changes to a copy of the Starlette gzip.py module, which is kept in the tracking/ folder.
Any time a change to that file is detected, an issue will be automatically created in the repository. This issue should be closed once the change to Starlette has been applied here, if necessary.
For more details on how this works, see Automatically opening issues when tracked file content changes.
Development
To contribute to this library, first checkout the code. Then run the tests with uv:
cd asgi-gzip
uv run pytest
Release files for asgi-gzip 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| asgi_gzip-0.3.tar.gz | 4.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| asgi_gzip-0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.6 kB
Release files / asgi_gzip-0.3.tar.gz
| Download URL | asgi_gzip-0.3.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e388bb804e430dd2ebd15fec72692d9d88ec1828d319a91e77f521982670b3f2
|
|
BLAKE2b-256 checksum How to use checksums |
811c253414da2384f2afe93370e1ac8117e167780fc4a0c6bd6f3c4011e69a91
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 9, 2026.
Transparency logRelease files / asgi_gzip-0.3-py3-none-any.whl
| Download URL | asgi_gzip-0.3-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fcde1776c5217dbe4f486e5d53d5f56dd287a92432c2c262be00aad63116b5f4
|
|
BLAKE2b-256 checksum How to use checksums |
9b21b1d7a38aba8e71a7d2a595ae9aa77cf7c0e565f37dbe44739acb1baadd2b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 9, 2026.
Transparency log