Skip to main content

gzip middleware for ASGI applications, extracted from Starlette

Project description

asgi-gzip

PyPI Changelog License

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 create a new virtual environment:

cd asgi-gzip
python -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asgi-gzip-0.2.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

asgi_gzip-0.2-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file asgi-gzip-0.2.tar.gz.

File metadata

  • Download URL: asgi-gzip-0.2.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.7

File hashes

Hashes for asgi-gzip-0.2.tar.gz
Algorithm Hash digest
SHA256 719b8deb396e2646a80079cc199a0741ebc03a15760bbeda05fe748a58431ff1
MD5 516e216224ebc5fd411126e933988947
BLAKE2b-256 0c7f89894954a25c1f3560e618662344d78f635692db4d18c1c629b3cb72d33d

See more details on using hashes here.

File details

Details for the file asgi_gzip-0.2-py3-none-any.whl.

File metadata

  • Download URL: asgi_gzip-0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.7

File hashes

Hashes for asgi_gzip-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ec8bcefdc0d8b828bbe3a997b0bde253f2e29a590ca5e539eee09e1822d64ef8
MD5 7a406803e4ee52107abf321f1a41b4f2
BLAKE2b-256 82483ce8d346a4e8f1db8b414f9e1afddb56b31de270eb2d51a0c92b2170f6d9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page