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

Uploaded CPython 3.13Windows x86-64

narrativeengine-0.1.20-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.20-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.20-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for narrativeengine-0.1.20-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d76d6b979ad622f37a71ae34fc5610356e9053de25ef41b2f71bce3d203f3890
MD5 9ce3cb336cb8177bd815c5dc58090d54
BLAKE2b-256 fa3b5ae8d3389dcdd72012b19c09c078c1a4d2fb1adc0dc7152be3e4aedcb4a7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for narrativeengine-0.1.20-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 61583f4aa031e91b9fd5fa29bde9fcb158c3673051c7f132d0c4c6c71d19dcc3
MD5 82e43e2f847a379d5d039eb44fadaab6
BLAKE2b-256 0c9ac50125227850eb76a0d77e912dc901dbbedb4bf363f2e63fc408e3117e33

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for narrativeengine-0.1.20-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4d77d298feb94e2b99c1b43620a85ce473c42951c24eb3467d99cd8785f4574a
MD5 9e67bf8b317149a33db287b5912022f8
BLAKE2b-256 18a0acac5871013ffa5e41ed20b44a69846d5eda5aff4d66e323456c3113e90d

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