Skip to main content

Clacks GNU middleware

Lightweight FastAPI/Starlette middleware that keeps the tradition alive by adding the X-Clacks-Overhead HTTP header. Incoming headers are preserved, defaults can be configured, and duplicates are removed case-insensitively.

What it does

  • Adds X-Clacks-Overhead to every response, prefixed with GNU and joined by commas.
  • Merges incoming request names, your configured defaults, and any names already set on the response.
  • Deduplicates names case-insensitively to avoid repeated entries.
  • Simple configuration via a shared clacks_config object.

Install

pip install clacks-gnu-middleware

For local development:

pip install -e .
pip install -r requirements.txt  # tooling & test extras

Quick start (FastAPI)

from fastapi import FastAPI
from clacks_gnu_middleware.clacks_middleware import clacks_middleware, clacks_config

app = FastAPI()

# Optional: customize defaults before registering the middleware
clacks_config.default_names.extend([
    "Ada Lovelace",
    "Alan Turing",
])

app.middleware("http")(clacks_middleware)

@app.get("/ping")
async def ping():
    return {"status": "ok"}

# Run with: uvicorn app.application:app --reload

Header behavior

  • Header name: X-Clacks-Overhead.
  • Values are emitted as GNU <name>, joined with commas.
  • Order: configured defaults → incoming header values → names already set on the response.
  • Names are deduplicated (case-insensitive). Empty or non-GNU values are ignored.

Testing

pytest

Notes

  • The middleware uses a module-level clacks_config; set defaults before registering the middleware to avoid runtime mutation.
  • License: GPL-3.0 (see LICENSE).

Metadata

Release files for clacks-gnu-middleware 0.0.3

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

Source distribution (sdist)

Source distribution for clacks-gnu-middleware 0.0.3
File Size Uploaded Provenance Actions
clacks_gnu_middleware-0.0.3.tar.gz 17.5 kB Without provenance Details for clacks_gnu_middleware-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for clacks-gnu-middleware 0.0.3
File Interpreter ABI Platform Actions
clacks_gnu_middleware-0.0.3-py3-none-any.whl Python 3 none any Details for clacks_gnu_middleware-0.0.3-py3-none-any.whl

Total release size: 34.5 kB

Release files / clacks_gnu_middleware-0.0.3.tar.gz

Download URL clacks_gnu_middleware-0.0.3.tar.gz
Size 17.5 kB
Tags Source
SHA-256 checksum
How to use checksums
11b8966975f9f80662b64ef00d73caddb0c7b63342a7db1ad543d2d6a47d652a
BLAKE2b-256 checksum
How to use checksums
3185423fe671c87f28a4144356cfb3320c1de807767088101fd745fd6ba0274e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.12

Release files / clacks_gnu_middleware-0.0.3-py3-none-any.whl

Download URL clacks_gnu_middleware-0.0.3-py3-none-any.whl
Size 17.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
973efee279e4c602ff4fd2b9159ceb7ea16125a715dc1030ea50a5a26da6509b
BLAKE2b-256 checksum
How to use checksums
3a4dfd1be467982d919ebbf609d8946c2161b4ed88a0074f760c458a0bccc55f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.12

Security for clacks-gnu-middleware 0.0.3

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