Skip to main content

SerenSinew

The connective tissue of the Seren stack.

If SerenMeninges is the membrane - the UI shell, auth, config, credentials every service wears - then Sinew is the tendon: the cross-cutting runtime plumbing every Seren web service repeats. One copy, so a fix lands everywhere at once.

What's in it (today)

Request logging. Drop-in middleware that logs every HTTP request as <client> <METHOD> <path> -> <status> (<ms>ms) [rid=<id>] - INFO for 2xx/3xx, WARNING for 4xx (and slow 2xx), ERROR for 5xx, with the full traceback when an exception escaped the route. Goes to both stderr (so journalctl catches it) and a rotating file the running user owns at ~/seren-logs/<service>-requests.log, so anyone debugging can tail it without sudo. If there is no home directory to put the file in, it logs to stderr only and says so, rather than refusing to start.

Request ids. Every request gets one: an inbound X-Request-Id is kept, so one string follows a call from Lodestar through Observatory into a service; otherwise a short random one is minted. It is on the log line and echoed back as X-Request-Id on the response, and routes can read it from request.state.request_id to pass along to the next hop.

It's parameterized, not hardcoded - service_name picks the logger name and log filename, env_prefix picks the env-var namespace:

from seren_meninges.auth import bearer_auth_middleware
from seren_sinew.request_log import RequestLoggingMiddleware

# Mount OUTERMOST - before auth - so 401s get logged too.
app.add_middleware(bearer_auth_middleware(token))                # inner
app.add_middleware(                                              # outer
    RequestLoggingMiddleware,
    service_name="seren-observatory",
    env_prefix="SEREN_AGENT",   # -> SEREN_AGENT_LOG_LEVEL / SEREN_AGENT_LOG_QUERY
)

Knobs (per env_prefix):

env var effect
<PREFIX>_LOG_LEVEL INFO (default) | DEBUG | WARNING | ERROR
<PREFIX>_LOG_QUERY 1 to append ?query to the logged path (off by default - query strings can carry tokens / PII)

What's coming

The cluster client, discovery and the DTOs that Lodestar and Observatory currently spell separately. Sinew is where the connective runtime code goes; Meninges stays the membrane.

Install

pip install seren-sinew

Light by design - depends only on starlette (already in every leaf via FastAPI), so it stays FastAPI-agnostic and adds nothing to a real install.

AGPL-3.0-or-later.

Metadata

Release files for seren-sinew 1.11.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 seren-sinew 1.11.0
File Size Uploaded
seren_sinew-1.11.0.tar.gz 58.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for seren-sinew 1.11.0
File Interpreter ABI Platform
seren_sinew-1.11.0-py3-none-any.whl Python 3 none any Details

Total release size: 104.1 kB

Release files / seren_sinew-1.11.0.tar.gz

Download URL seren_sinew-1.11.0.tar.gz
Size 58.9 kB
Tags Source
SHA-256 checksum
How to use checksums
52b5055bbf4246478d57117d5f2ce4eb67496408ea07d8479863807de9d6a1c5
BLAKE2b-256 checksum
How to use checksums
b5794b1aa7fac613300747d6b72cf450f803f797f1f539596c751dee5ef8ff54
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Release files / seren_sinew-1.11.0-py3-none-any.whl

Download URL seren_sinew-1.11.0-py3-none-any.whl
Size 45.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a852bc1bb69c7c1ba4679412a9ba17f57fb9174c1c14e8e87cf33ba6cbd88b6d
BLAKE2b-256 checksum
How to use checksums
11bc53f7d41fe60e0bbc378f57245f04105fc473b61188972411c3460f53c77b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 6, 2026.

Transparency log

Release history Release notifications | RSS feed

5.1.1

2 release files

5.1.0

2 release files

5.0.0

2 release files

This release

1.11.0 This release

2 release files

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