Turn Python execution into structured human-readable stories.
Project description
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
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 tadalabz_storytime-1.0.0.tar.gz.
File metadata
- Download URL: tadalabz_storytime-1.0.0.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10942e9a7add3f0bec28560a1d20f8f1a20539958bd7acb8f96e2e003c9374eb
|
|
| MD5 |
f5fb10a83101d05d5141a2087faed0a6
|
|
| BLAKE2b-256 |
c558ed3c084354c2332b945af572291643807c164932a20da126936e0ff980e7
|
File details
Details for the file tadalabz_storytime-1.0.0-py3-none-any.whl.
File metadata
- Download URL: tadalabz_storytime-1.0.0-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
352aad6a3c2073491f784548cb9e5ba9ff24579987d1e96c1500b7d4666da463
|
|
| MD5 |
aee199f68f16cf886ab82941ba01318e
|
|
| BLAKE2b-256 |
1cd71080e454041e49455b3fc9c685a62336672775e965d50a7cf62253397478
|