Skip to main content

This Python module provides a modified version of the ThreadingHTTPServer class from the http.server module in the standard library. This server is designed to serve a static web site, such as documentation for a python project generated by Sphinx and installed with the software. It serves the files locally, on a random port of the loopback interface, and hence works off line. The server runs in its own daemon thread of the python process, so it terminates when the python program exits and thus will not leave zombie processes running.

The server has been modified to allow any file in the site to be gzip compressed and served with a Content-Encoding header set to “gzip”. The compressed file will be automatically decompressed by the browser, with no noticeable performance loss. This is more efficient than the typical case of serving compressed content over the internet since the compression is done in advance. It also takes significantly less space on the user’s disk. (Brotli compression would be even more efficient in both ways, but web browsers still tend to only support Brotli compression over https, due to the prevalence of broken proxy servers on the internet.)

Source code is available on Github. The git repository includes a script (compress_site.py) for compressing all of the .html, .css, .js, .woff and .svg files below a given site root directory. The tool is aware of Sphinx’s tendency to produce many identical copies of the same (large) _static directory. So it also collects the contents of all of the _static subdirectories into one _static directory in the root, replacing the others by symlinks.

The server can be installed by running: python3 -m pip install cocoserver.

To use the server:

>>> from cocoserver import StaticServer
>>> s = StaticServer('my/site/root')
>>> s.visit('mypage')

The pip package also installs a console script named coco which can be used to view your static site, for example by running: coco /usr/local/share/doc/myproject.

Metadata

Release files for cocoserver 1.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cocoserver 1.0.9
File Size Uploaded Provenance
cocoserver-1.0.9.tar.gz 12.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for cocoserver 1.0.9
File Interpreter ABI Platform
cocoserver-1.0.9-py3-none-any.whl Python 3 none any Details

Total release size: 24.8 kB

Release files / cocoserver-1.0.9.tar.gz

Download URL cocoserver-1.0.9.tar.gz
Size 12.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3c3d6ee005a44eb90005f1e36eefe9450cb00efd521656ef1b12a3b7e8b58ae7
BLAKE2b-256 checksum
How to use checksums
a6025c78d1aa066295f9e13e19e722bc82ee0779dfd366fb4b5cccbbe69bd0e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / cocoserver-1.0.9-py3-none-any.whl

Download URL cocoserver-1.0.9-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1c6df89404f638bf58a118323cb0f9ebc06c17644d40ce32b202ef29d1cdc7c0
BLAKE2b-256 checksum
How to use checksums
c2a68799b94506e8719f12641cee5cb5dc541e68144b7150d12a1dceeb3a9777
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Security for cocoserver 1.0.9

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page