No project description provided
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file context_goodies-0.1.tar.gz.
File metadata
- Download URL: context_goodies-0.1.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6886a3ecdf6cb199c28c0223b923436ef1f31386d77b626ef805359b941b126
|
|
| MD5 |
88d028665c0656ab813dd9561e0c9fb8
|
|
| BLAKE2b-256 |
1749fb1192a622d73d58362b20f2a410cc8650ed14d65e42dc3c56e2a8c4deef
|
Provenance
The following attestation bundles were made for context_goodies-0.1.tar.gz:
Publisher:
publish.yml on mbachry/context-goodies
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
context_goodies-0.1.tar.gz -
Subject digest:
f6886a3ecdf6cb199c28c0223b923436ef1f31386d77b626ef805359b941b126 - Sigstore transparency entry: 779920049
- Sigstore integration time:
-
Permalink:
mbachry/context-goodies@db0f202b08ad2e970969a93afbb2800fb01f4b55 -
Branch / Tag:
refs/tags/v0.1 - Owner: https://github.com/mbachry
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@db0f202b08ad2e970969a93afbb2800fb01f4b55 -
Trigger Event:
push
-
Statement type:
File details
Details for the file context_goodies-0.1-py3-none-any.whl.
File metadata
- Download URL: context_goodies-0.1-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
486017fc321ab074c847f2013f9c4f6770523886c547e58a7670675ba0f61913
|
|
| MD5 |
7aa853accc309ed58e29815be443d90d
|
|
| BLAKE2b-256 |
01757ca6d716796dbd825751f9ed89736e5e15b08be6f2823759ae6d005f05a0
|
Provenance
The following attestation bundles were made for context_goodies-0.1-py3-none-any.whl:
Publisher:
publish.yml on mbachry/context-goodies
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
context_goodies-0.1-py3-none-any.whl -
Subject digest:
486017fc321ab074c847f2013f9c4f6770523886c547e58a7670675ba0f61913 - Sigstore transparency entry: 779920050
- Sigstore integration time:
-
Permalink:
mbachry/context-goodies@db0f202b08ad2e970969a93afbb2800fb01f4b55 -
Branch / Tag:
refs/tags/v0.1 - Owner: https://github.com/mbachry
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@db0f202b08ad2e970969a93afbb2800fb01f4b55 -
Trigger Event:
push
-
Statement type: