datasette-gzip by simonw

108 downloads this week        Star

Screenshot of simonw/datasette-gzip

README source code

datasette-gzip

PyPI Changelog Tests License

Add gzip compression to Datasette

Installation

Install this plugin in the same environment as Datasette.

datasette install datasette-gzip

Usage

Once installed, Datasette will obey the Accept-Encoding: header sent by browsers or other user agents and return content compressed in the most appropriate way.

This plugin is a thin wrapper for the asgi-gzip library, which extracts the GzipMiddleware from Starlette.

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd datasette-gzip
python3 -mvenv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

pytest