context-goodies
Helper functions to maintain process/thread/coroutine local data in trusted microservices.
Install
pip install context-goodies
You can also "vendor" the module by copying context_goodies.py to
your project. There are no pypi dependencies.
Request ID
Call set_current_request_id to set a new request id. If using
Django, add context_goodies.context_middleware to
MIDDLEWARES to maintain request ids automatically. Note it assumes
an internal microservice API and trusted clients.
Logging context
Call update_logging_context to add new data to every log line,
eg. update_logging_context(user_id=user_id).
Logging config example
Filter and formatter to log context data added with update_logging_context:
'filters': {
'extra': {'()': 'context_goodies.ExtraDataFilter'},
},
'formatters': {'verbose': {'format': '[%(name)s][%(levelname)s] %(message)s%(extra)s'}},
'handlers': {
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'verbose',
'filters': ['extra'],
},
},
Greenlet handling
Django middleware automatically groups all greenlets spawned during request lifetime and kills the entire group in the request finalizer to avoid memory leaks.
Metadata
Release files for context-goodies 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| context_goodies-0.1.tar.gz | 5.8 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| context_goodies-0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.5 kB
Release files / context_goodies-0.1.tar.gz
| Download URL | context_goodies-0.1.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f6886a3ecdf6cb199c28c0223b923436ef1f31386d77b626ef805359b941b126
|
|
BLAKE2b-256 checksum How to use checksums |
1749fb1192a622d73d58362b20f2a410cc8650ed14d65e42dc3c56e2a8c4deef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Dec 26, 2025.
Transparency logRelease files / context_goodies-0.1-py3-none-any.whl
| Download URL | context_goodies-0.1-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
486017fc321ab074c847f2013f9c4f6770523886c547e58a7670675ba0f61913
|
|
BLAKE2b-256 checksum How to use checksums |
01757ca6d716796dbd825751f9ed89736e5e15b08be6f2823759ae6d005f05a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Dec 26, 2025.
Transparency logSecurity for context-goodies 0.1
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for context_goodies-0.1.tar.gz
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 Dec 26, 2025.
Transparency logA 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.