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

Uploaded CPython 3.13Windows x86-64

narrativeengine-0.1.21-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.21-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.21-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for narrativeengine-0.1.21-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 b9104e1c95a46e10c588271e89bb61e6c51416c3ce5a31e29cdb16f8632ef96b
MD5 80422861a6a6b98f7382743aa135a65c
BLAKE2b-256 49f9c106de1f08f135206e4b12d39e4648830dea174d604d7f77092552ff6145

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for narrativeengine-0.1.21-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 9e256602b004af24279bd6fdbc5e290bf7abea75c86f669898d1a80f0347ea8e
MD5 200fb5ffbcf73de2c1841690c7e816a3
BLAKE2b-256 03da2398c46c0165d17c2d6eb80e439df87c27e25517e5ab1542b2bc29b08a0f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for narrativeengine-0.1.21-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 615cddd913e1a3167d1d5330dba87eb92404cd002faeffce4f6de4c6750b3385
MD5 dc4c3720bdcfaf06a95a5cb04af5b7a5
BLAKE2b-256 1f2b5882dc75f3ee1039da5f1118eaa5111dfaadfc40bc38c32eee27d680e548

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