Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simonw/datasette-gzip
Add gzip compression to Datasette
https://github.com/simonw/datasette-gzip
Last synced: 27 days ago
JSON representation
Add gzip compression to Datasette
- Host: GitHub
- URL: https://github.com/simonw/datasette-gzip
- Owner: simonw
- License: apache-2.0
- Created: 2022-04-27T06:54:52.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-04-28T16:06:51.000Z (over 2 years ago)
- Last Synced: 2024-10-06T20:30:48.048Z (about 1 month ago)
- Language: Python
- Homepage:
- Size: 14.6 KB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# datasette-gzip
[![PyPI](https://img.shields.io/pypi/v/datasette-gzip.svg)](https://pypi.org/project/datasette-gzip/)
[![Changelog](https://img.shields.io/github/v/release/simonw/datasette-gzip?include_prereleases&label=changelog)](https://github.com/simonw/datasette-gzip/releases)
[![Tests](https://github.com/simonw/datasette-gzip/workflows/Test/badge.svg)](https://github.com/simonw/datasette-gzip/actions?query=workflow%3ATest)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/datasette-gzip/blob/main/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](https://github.com/simonw/asgi-gzip), which extracts the [GzipMiddleware](https://www.starlette.io/middleware/#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/activateNow install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest