Skip to main content

CLI for sufleur — type-safe codegen for versioned LLM prompts.

Project description

sufleur-cli

The CLI for Sufleur — the registry where you author, version, and publish LLM prompts. This is the consumer side: it installs prompts from your Sufleur workspace into your project the way pip installs packages — declared in sufleur.yaml, locked to sufleur-lock.yaml, generated into one Python module with full types and runtime helpers.

Create a workspace and start authoring prompts at https://sufleur.com.

What you call from your code

from generated.prompts import get_prompt

review = get_prompt("@my-workspace/code-review")

rendered = review.render("en", {"diff": "...", "language": "go"})
prompt: str = rendered["prompt"]  # ready-to-send prompt string

result = review.parse_output(llm_response_text)
if result["success"]:
    result["data"]  # Pydantic model, validated against the prompt's output schema
else:
    result["error"]

"@my-workspace/code-review" is checked at type-check time (mypy / pyright): typos fail, the entrypoint name "en" is narrowed against the prompt's available entrypoints (via @overload), and the input is a TypedDict derived from the JSON Schema declared on that entrypoint. The version that resolves at codegen time is pinned in sufleur-lock.yaml.

Install

pip install sufleur-cli
sufleur --help

Or with pipx for an isolated install:

pipx install sufleur-cli

The wrapper ships the prebuilt binary inside a per-platform wheel — pip selects the right one via PEP 425 platform tags. There's no Python interpreter in the invocation hot path; sufleur is the native binary on your PATH.

Quick start

mkdir my-app && cd my-app
sufleur init                                  # creates sufleur.yaml interactively
sufleur add @my-workspace/code-review ^1.0.0  # add + fetch + lock
sufleur generate                              # writes ./generated/prompts.py

The generated module imports two runtime peers. Install them with the [generated] extra:

pip install 'sufleur-cli[generated]'

…or add chevron (Mustache templating) and pydantic (output-schema validation, only needed when prompts have output schemas) directly to your project's dependencies. The CLI itself has no Python runtime deps; the [generated] extra exists so users who run init/add/install but never generate aren't forced to install code they don't use.

The generated code targets Python 3.10+ (PEP 604 union syntax).

What sufleur generate emits

A single .py module containing every prompt inlined (no runtime fetches). The public API is get_prompt(name), which returns a result object with:

  • render(entrypoint, input){"prompt": str} — Chevron renders the entrypoint template against input. The signature is narrowed via @overload per entrypoint, so type checkers reject the wrong input shape.
  • metadata — a TypedDict containing version, your workspace's custom metadata, and (when applicable) output_schema.
  • parse_output(raw) (only present if the prompt has an output schema) — strips ``` fences, JSON-parses, and validates with a Pydantic model generated from the prompt's JSON Schema. Returns {"success": True, "data": <Model>} or `{"success": False, "error": str}`.

Plus generated TypedDicts per entrypoint, with field docstrings for any schema property that has a description:

class CodeReview_EnInput(TypedDict):
    diff: str
    """The unified diff to review."""
    language: str

Prompts published with DRAFT status emit a warnings.warn(...) when their get_prompt is called.

sufleur.yaml

The manifest. Looks like:

api_keys:
  my-workspace: ${MY_WORKSPACE_API_KEY}

prompts:
  '@my-workspace/greeting': '*'
  '@my-workspace/code-review': '^2.0.0'
  # alias: keep two pinned versions side-by-side under different names
  '@my-workspace/code-review-strict': '@my-workspace/code-review@~1.4.0'

output:
  language: python
  file: ./generated/prompts.py

Constraints are npm-style semver ranges (^, ~, >=, exact, *). The resolution is recorded in sufleur-lock.yaml. Commit both filessufleur.yaml is the source of truth, sufleur-lock.yaml is the receipt.

CI usage

sufleur install --frozen   # fail if lockfile is stale
sufleur generate

--frozen is the pip-compile-equivalent: refuses to update the lockfile, hard-errors if the manifest and lockfile disagree.

Commands

Command Description
sufleur init Interactive scaffolding for sufleur.yaml.
sufleur add @ws/name [range] Add a prompt, fetch it, update the lockfile. --alias <name> keeps multiple versions; --force overwrites an existing entry.
sufleur remove @ws/name Remove a prompt from the manifest and prune its cache (kept if another alias still resolves to the same version).
sufleur install Resolve the manifest, fetch what's missing, refresh the lockfile. --frozen for CI.
sufleur update [@ws/name] Re-resolve constraints — one prompt or all.
sufleur generate Regenerate the output file from the lockfile + cache.

-v / --verbose enables HTTP request/response logs on any command. Variables in .env are loaded automatically; per-workspace API keys can be referenced as ${ENV_VAR_NAME} in sufleur.yaml.

Invocation modes

The sufleur command on your PATH is the Go binary itself. For tools that prefer module-style invocation:

python -m sufleur_cli --help

This goes through a tiny Python wrapper that locates the binary and os.execvps it (POSIX) or subprocess.runs it (Windows). Slightly slower because Python boots first, but useful when invoking the CLI programmatically from a Python tool that wants to be sure it's calling the binary in the active environment.

The find_sufleur_bin() helper is also importable:

from sufleur_cli import find_sufleur_bin
print(find_sufleur_bin())  # absolute path to the binary

Supported platforms

OS Architectures
macOS x86_64, arm64
Linux x86_64, aarch64 (manylinux 2.17 / glibc 2.17+)
Windows x86_64, arm64

Alpine / musl libc is currently unsupported (no musllinux wheel) — pip will refuse with "no matching distribution" rather than silently producing a broken install. There is no source distribution.

Links

License

MIT.

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.

sufleur_cli-0.1.0-py3-none-win_arm64.whl (6.3 MB view details)

Uploaded Python 3Windows ARM64

sufleur_cli-0.1.0-py3-none-win_amd64.whl (6.8 MB view details)

Uploaded Python 3Windows x86-64

sufleur_cli-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.7 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

sufleur_cli-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.2 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

sufleur_cli-0.1.0-py3-none-macosx_11_0_x86_64.whl (6.6 MB view details)

Uploaded Python 3macOS 11.0+ x86-64

sufleur_cli-0.1.0-py3-none-macosx_11_0_arm64.whl (6.3 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

File details

Details for the file sufleur_cli-0.1.0-py3-none-win_arm64.whl.

File metadata

  • Download URL: sufleur_cli-0.1.0-py3-none-win_arm64.whl
  • Upload date:
  • Size: 6.3 MB
  • Tags: Python 3, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sufleur_cli-0.1.0-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 8b42ea0613942f5e715652eb1f23e5773ead513b79be0ecc6519dde4fd787df8
MD5 cd9f74b6422fd715bb7eaa614473297e
BLAKE2b-256 bf3d217c6f964251530dd7c6def33875ec22762a0ffdb0b7bfed2f057b72e830

See more details on using hashes here.

Provenance

The following attestation bundles were made for sufleur_cli-0.1.0-py3-none-win_arm64.whl:

Publisher: release.yml on sufleur/cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sufleur_cli-0.1.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: sufleur_cli-0.1.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 6.8 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sufleur_cli-0.1.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 f8c48cf62edc8d249f666bf688161e7b7af9811354ae376e5302193f59cfcce4
MD5 cd52fe94121692a9e39e09417d154ea9
BLAKE2b-256 a232badd41b492e8e1d13e6d440acbca72b8f8455c81b7cbe04778fc14e10da7

See more details on using hashes here.

Provenance

The following attestation bundles were made for sufleur_cli-0.1.0-py3-none-win_amd64.whl:

Publisher: release.yml on sufleur/cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sufleur_cli-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for sufleur_cli-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a968408b549783164a3b0171dedce102bdb84a4accb9c69cf8ac6918f0b94ae0
MD5 e43578f42dec6d0c1cbf0ecd3953627a
BLAKE2b-256 0f810a8acc492db0d860ded8cb835a4071430da322616b77833816e5f2d50dfc

See more details on using hashes here.

Provenance

The following attestation bundles were made for sufleur_cli-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on sufleur/cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sufleur_cli-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for sufleur_cli-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c2568ad88672f3d5357a07b33786bdb9a99d48083780fbf5aca132dee5dda9fc
MD5 9b6dcc8747f57c4e83bda67a3b2e1b32
BLAKE2b-256 c488075b3b68fd5de6d49f75f979756ab9e58b8ec66aa4131c3976993cbdba81

See more details on using hashes here.

Provenance

The following attestation bundles were made for sufleur_cli-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on sufleur/cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sufleur_cli-0.1.0-py3-none-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for sufleur_cli-0.1.0-py3-none-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 2e7c2a2893409871c26f1b9eaa8caec9d53572652d61c1844e5dcdf1b5beae1b
MD5 a98681fa344f6b07c15a42bc7d54063d
BLAKE2b-256 75bd1a43eddb0c2af5349438181204af7a4683d5cb1c70716a9593efc76b4fbf

See more details on using hashes here.

Provenance

The following attestation bundles were made for sufleur_cli-0.1.0-py3-none-macosx_11_0_x86_64.whl:

Publisher: release.yml on sufleur/cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sufleur_cli-0.1.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for sufleur_cli-0.1.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e740e1e78cc5e3dcc63ce8c4a2c1248ded258cbc3726deaf4868255f87812afa
MD5 3d3dadf4c5df3503f11415017713a2eb
BLAKE2b-256 299b979f6b5c52014e9d23027c7be0a850f557faac57a8d9925fae2b8a3b1c8c

See more details on using hashes here.

Provenance

The following attestation bundles were made for sufleur_cli-0.1.0-py3-none-macosx_11_0_arm64.whl:

Publisher: release.yml on sufleur/cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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