Skip to main content

Python SDK for NarrativeEngine, powered by Rust and PyO3.

Project description

NarrativeEngine Python SDK

The Python SDK is a thin PyO3 wrapper over the canonical Rust implementation. All domain models are generated from Rust schemas.

Installation

pip install narrativeengine
pip install "narrativeengine[pydantic]"

Usage

from narrativeengine import LabConfig, NarrativeLore, create_block, generate_candidate

block = create_block("intro", "A signal appears in the archive.")
lore = NarrativeLore(id="lore-1", title="Archive Signal", blocks=[block])
candidate = generate_candidate(lore, LabConfig(temperature=0.7, max_candidates=4, seed=7))

Development

python -m pip install -e ".[dev]"
maturin develop --manifest-path ../crates/narrativeengine-py/Cargo.toml --extras pydantic
python -m pytest
ruff check .
mypy narrativeengine

Build

maturin build --manifest-path ../crates/narrativeengine-py/Cargo.toml --release

Release

Wheels are built through GitHub Actions and published by scripts/publish-all.sh.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

narrativeengine-0.1.16-cp313-cp313-win_amd64.whl (286.5 kB view details)

Uploaded CPython 3.13Windows x86-64

narrativeengine-0.1.16-cp313-cp313-manylinux_2_34_x86_64.whl (439.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

narrativeengine-0.1.16-cp313-cp313-macosx_11_0_arm64.whl (380.4 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

File details

Details for the file narrativeengine-0.1.16-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for narrativeengine-0.1.16-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 15601f9e6e5cf6c320d544fe79f434ef646abd039df97c2d444a821a7fbf2342
MD5 ace439a07072c8932b8204ba6b5354d1
BLAKE2b-256 788cdc4c94d973fa0066c096ac403efa24eb929e2d226b0b2d65e8c254ed07c0

See more details on using hashes here.

File details

Details for the file narrativeengine-0.1.16-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for narrativeengine-0.1.16-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 a4000096f89a023ffc8d9f902ee6e79415ac4ad80bd9cc952b543226c65712bf
MD5 2bb967dd76757023551fc6a66b3a1cb0
BLAKE2b-256 8f70d65c327e841349bf1ae7dfcc3fcbc93dea0e72c26fa0658d8ed8052758a5

See more details on using hashes here.

File details

Details for the file narrativeengine-0.1.16-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for narrativeengine-0.1.16-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a24ac2296dd8f54b21ad01e13d9503a767855e6e6349573fcde89f8b19aa3981
MD5 40449b614d790ab2ef737899b9ef1381
BLAKE2b-256 75b64d80e823872b918709be031f7381aa2815db560e04abb8dfda1b607dde93

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page