Skip to main content

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:

  • @narrate for traced function execution
  • Story and Step models with plain, markdown, JSON, and ELI5 output
  • session() for lightweight interactive tracing
  • run_story() for a simple narrative DSL
  • describe() 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

See examples/basic_usage.py.

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)

Source distribution for tadalabz-storytime 1.0.0
File Size Uploaded
tadalabz_storytime-1.0.0.tar.gz 10.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tadalabz-storytime 1.0.0
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page