storytime
storytime turns Python execution into human-readable stories and can also execute a constrained narrative DSL.
Status
This is an early MVP. The current implementation focuses on:
@narratefor traced function executionStoryandStepmodels with plain, markdown, JSON, and ELI5 outputsession()for lightweight interactive tracingrun_story()for a simple narrative DSLdescribe()for semantic hook registration
Install
pip install .
For development:
python3 -m unittest discover -s tests
Quick Start
from storytime import narrate
@narrate(style="markdown")
def process(values):
total = 0
for value in values:
total += value
return total
story = process([1, 2, 3])
print(story.to_markdown())
DSL Example
from storytime import run_story
story = run_story(
"""
Start with users
Keep only active users
Group by region
Return the result
""",
context={
"users": [
{"name": "Ada", "active": True, "region": "US"},
{"name": "Linus", "active": False, "region": "EU"},
]
},
)
Examples
Run it from the repository root with:
python3 examples/basic_usage.py
Publish
Manual PyPI publishing from your machine:
python3 -m pip install --upgrade build twine setuptools wheel
python3 -m build
python3 -m twine check dist/*
python3 -m twine upload dist/*
Before uploading:
- make sure the package name is available on PyPI
- run
python3 -m unittest discover -s tests - review the generated files in
dist/
Limitations
- Tracing is heuristic and intentionally lightweight
- The DSL is keyword-driven, not general natural language
- Async behavior and deeper semantic analysis are not implemented yet
Metadata
Release files for tadalabz-storytime 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tadalabz_storytime-1.0.0.tar.gz | 10.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tadalabz_storytime-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.4 kB
Release files / tadalabz_storytime-1.0.0.tar.gz
| Download URL | tadalabz_storytime-1.0.0.tar.gz |
|---|---|
| Size | 10.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
10942e9a7add3f0bec28560a1d20f8f1a20539958bd7acb8f96e2e003c9374eb
|
|
BLAKE2b-256 checksum How to use checksums |
c558ed3c084354c2332b945af572291643807c164932a20da126936e0ff980e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / tadalabz_storytime-1.0.0-py3-none-any.whl
| Download URL | tadalabz_storytime-1.0.0-py3-none-any.whl |
|---|---|
| Size | 11.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
352aad6a3c2073491f784548cb9e5ba9ff24579987d1e96c1500b7d4666da463
|
|
BLAKE2b-256 checksum How to use checksums |
1cd71080e454041e49455b3fc9c685a62336672775e965d50a7cf62253397478
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|