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.23-cp313-cp313-win_amd64.whl (287.0 kB view details)

Uploaded CPython 3.13Windows x86-64

narrativeengine-0.1.23-cp313-cp313-manylinux_2_34_x86_64.whl (439.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

narrativeengine-0.1.23-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.23-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for narrativeengine-0.1.23-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 a2bf90893303dfdc48aed651d319bcf7392ef17fcd0fcc8bd38cd4ad9d9b2bf4
MD5 e95b7fd16cd910faf3d706018d734bf2
BLAKE2b-256 b0f9aa30c3058c063513ed14399a48f0b95304ff512f7fc806c45f5f245569ff

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for narrativeengine-0.1.23-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 d35a70a4ba16431f3bdb97c1f0e64d7e3265cbf87dc3a1df837d747a9782f576
MD5 b2fa93b15d37ea9ef2b7f2d0895d4183
BLAKE2b-256 84210bdda464f66ee9fcc2fa63a939efaaee8717a4c574ff24e9e316a10acedb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for narrativeengine-0.1.23-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0096452edbae18982fad110793c52a61fd539ef3e74e99235b96002e041497af
MD5 45c4fa331e6c15e039f11e3ed4979b93
BLAKE2b-256 4fe0b0a68ae1680198ac8d27049f37bf16106318950466366715e323664cd97b

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