Skip to main content

purge-static PyPI PyPI - Format PyPI - Python Version

purge-static is a tool to find changed static files, show their URLs, and optionally purge them for you on your CDN, such as Cloudflare.

With purge-static, you can enable aggressive caching for your static site on your CDN, caching the entire site on the CDN edge. When you update your site, you simply need to use purge-static to purge only the changed files.

purge-static uses the SHA256 hash of files to determine if they changed.

Installation

pip install purge-static

Example Invocation

purge-static -d /path/to/my/webroot -u https://example.com

If your webroot is not writable, you can select a different path to write the hash store with --store /path/to/a/file/to/store/hashes.

This example ignores all .gz files, since they are only used for nginx's gzip_static module, as well as all files with hash already in the name:

purge-static -d /path/to/my/webroot -u https://example.com \
    -i '.*\.gz$|.*-[0-9a-f]{64}\.'

For more detailed description of the arguments, run purge-static --help.

Cloudflare

To use Cloudflare, you will need to create a credentials file:

{"api_token": "myverysecretapitoken"}

For legacy API keys, use this instead:

{
    "email": "you@example.com",
    "api_key": "myverysecretapikey"
}

Then, you can invoke purge-static:

purge-static -d /path/to/my/webroot -u https://example.com \
    --cloudflare -c /path/to/my/credentiails -z mycloudflarezoneid

Note that -z takes the Cloudflare zone ID as 32 hex digits.

Metadata

Release files for purge-static 0.2.0

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

Source distribution (sdist)

Source distribution for purge-static 0.2.0
File Size Uploaded Provenance Actions
purge-static-0.2.0.tar.gz 5.6 kB Without provenance Details for purge-static-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for purge-static 0.2.0
File Interpreter ABI Platform Actions
purge_static-0.2.0-py3-none-any.whl Python 3 none any Details for purge_static-0.2.0-py3-none-any.whl

Total release size: 12.5 kB

Release files / purge-static-0.2.0.tar.gz

Download URL purge-static-0.2.0.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
44ff312ac98e32acba05185b7e421f9abc3e4023868355632d1ee660ecc2b43f
BLAKE2b-256 checksum
How to use checksums
13fff6829bec7e03d1713226d70d0f3a5ac9bb45586c7f16ff87d337be300f90
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

Release files / purge_static-0.2.0-py3-none-any.whl

Download URL purge_static-0.2.0-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a2e48ab3c3043e36796419722eacafc601d2d215e8c7fd8b3a218854e882fe1f
BLAKE2b-256 checksum
How to use checksums
b3b5a38319e579d8b8267592df3e71b90cf774fe1a23cdb1fcf6b729ef1c5b17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

Security for purge-static 0.2.0

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