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/python-bindings/Cargo.toml --extras pydantic
python -m pytest
ruff check .
mypy narrativeengine

Build

maturin build --manifest-path ../crates/python-bindings/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 Distribution

narrativeengine-0.1.0.tar.gz (56.9 kB view details)

Uploaded Source

Built Distribution

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

narrativeengine-0.1.0-cp313-cp313-macosx_11_0_arm64.whl (342.1 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

File details

Details for the file narrativeengine-0.1.0.tar.gz.

File metadata

  • Download URL: narrativeengine-0.1.0.tar.gz
  • Upload date:
  • Size: 56.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.14.0

File hashes

Hashes for narrativeengine-0.1.0.tar.gz
Algorithm Hash digest
SHA256 43d0f5cf68dc04e341dddff7a73170e61b087ff7b65d1ede498ce4e6d2dab982
MD5 ef3862f3778ff82b4837c39daad722de
BLAKE2b-256 ebb39eafc07c2fdf3c1b2e0f76256981996e39c2bed8d917577654ebb2901c26

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for narrativeengine-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 96bb9d11cb43cec462de10f7ef3958592be93f04cbd28fdd041b2a24ea53f39e
MD5 3db376c6646fecbda5e0d46de6dfe149
BLAKE2b-256 828b88167a5ce468780ba31300bdd39fe8a811686af98835dbce042855b77b09

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