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: 4 months 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 (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-04-28T16:06:51.000Z (almost 3 years ago)
- Last Synced: 2024-10-06T20:30:48.048Z (5 months 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
[](https://pypi.org/project/datasette-gzip/)
[](https://github.com/simonw/datasette-gzip/releases)
[](https://github.com/simonw/datasette-gzip/actions?query=workflow%3ATest)
[](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