Monkay
Monkay is a production-focused module lifecycle toolkit for Python packages. It helps you ship lazy imports, settings loading, extension orchestration, and context-isolated state without fragile import-time side effects.
Why Monkay
Monkay is designed for libraries and applications that need to:
- expose stable public imports while deferring expensive imports,
- run controlled startup preloads and settings evaluation,
- apply pluggable extensions with deterministic conflict behavior,
- isolate mutable state per thread/task for safe tests and request scopes,
- validate module export consistency during development.
Installation
pip install monkay
Runtime requirement: Python 3.10+.
60-Second Example
# yourpkg/__init__.py
from monkay import Monkay
monkay = Monkay(
globals(),
lazy_imports={
"json_dumps": "json:dumps",
},
)
__all__ = ["json_dumps", "monkay"]
# yourpkg/main.py
from yourpkg import json_dumps
payload = {"status": "ok"}
print(json_dumps(payload))
json_dumps is resolved lazily on first access and cached by default.
Core Capabilities
Monkay: lifecycle coordinator for imports, settings, instances, and extensionsload,load_any,absolutify_import: import/path helpersCage,TransparentCage: context-isolated mutable proxiesLifespan,LifespanHook: ASGI lifespan utilitiesfind_missing,sorted_exports: export inspection and debugging helpers
Public API Stability
Monkay keeps top-level public imports stable via monkay.__all__:
MonkayDeprecatedImportPRE_ADD_LAZY_IMPORT_HOOKExtensionProtocolload,load_any,absolutify_importInGlobalsDict,UnsetError,get_value_from_settingsCage,TransparentCage
Documentation
Full docs: monkay.dymmond.com
Recommended order:
Development Quickstart
Monkay uses hatch, ruff, ty, pytest, and mkdocs/zensical.
pip install hatch
hatch run lint
hatch run check_types
hatch test
hatch run docs:build
If you use Task, Monkay ships both Taskfile.yml and Taskfile.yaml:
task check
task coverage
task docs
task docs:serve
Contributing
See Contributing for setup, quality gates, docs workflow, and pull request expectations.
Metadata
Release files for monkay 0.5.3
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 | Actions |
|---|---|---|---|---|
| monkay-0.5.3.tar.gz | 71.3 kB | Without provenance | Details for monkay-0.5.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| monkay-0.5.3-py3-none-any.whl | Python 3 | none | any | Details for monkay-0.5.3-py3-none-any.whl |
Total release size: 104.6 kB
Release files / monkay-0.5.3.tar.gz
| Download URL | monkay-0.5.3.tar.gz |
|---|---|
| Size | 71.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4601797cfae1c80deafeeca7de24796c8bf53b7bb0d182af2c6acbefaf27bcac
|
|
BLAKE2b-256 checksum How to use checksums |
038d2a2bd4278801e99b601d24f67706c083ea2c79938cab0d67ee7a9d13048a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Hatch/1.16.5 cpython/3.10.20 HTTPX/0.28.1
|
Release files / monkay-0.5.3-py3-none-any.whl
| Download URL | monkay-0.5.3-py3-none-any.whl |
|---|---|
| Size | 33.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
effe438b07fad650ef2d534f07f3d00fb5b8a61917767cfa26156b80e1b51240
|
|
BLAKE2b-256 checksum How to use checksums |
114b2130545528bd2ba250e9e63456c315e1812498830bd7b2e52c08c619380c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
Hatch/1.16.5 cpython/3.10.20 HTTPX/0.28.1
|
Security for monkay 0.5.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.