symfonic.cli.examples¶
examples ¶
symfonic examples -- copy a runnable example into the user's project.
Examples are not importable modules shipped in the wheel; they are bundled
as data under symfonic/cli/example_data/ (via a build-time hatch
force-include mapping the repo-root examples/ tree). This command copies
a curated example out into the caller's working directory so an installed-only
consumer -- someone who ran pip install symfonic-core and never cloned the
repo -- can run it in seconds, without us shipping the whole codebase inside the
package.
Two resolution roots are supported so the command behaves identically in a wheel install and in a source checkout / editable install:
- Packaged data --
symfonic/cli/example_data/(present in built wheels). - Repo checkout fallback -- the sibling
examples/tree at the repo root (present in editable installs and when running the tests).
Both roots carry the same relative layout for the curated set, so the
:data:CURATED specs resolve against either without branching.
ExampleSpec
dataclass
¶
ExampleSpec(name: str, summary: str, run: str, srcdir: str | None = None, srcfile: str | None = None, requires: str | None = None, domain: str | None = None)
A curated, copy-out example.
srcdir and srcfile are mutually exclusive and are given relative to
the resolved examples root. Exactly one must be set.
domain
class-attribute
instance-attribute
¶
The :data:JOURNEY_DOMAINS rung this example is the canonical answer
for, or None for the older single-topic examples. Exactly one spec may
claim a domain — an example set where two files both claim to be the
memory example is a set with no canonical memory example.
requires
class-attribute
instance-attribute
¶
Human note on prerequisites (extra + credentials), or None for
a base-install example that runs on MockModelProvider.
ExamplesError ¶
Bases: RuntimeError
Raised when an example cannot be listed or copied.
add_example ¶
Copy the curated example name into dest_dir/<name>/.
Returns the created target directory. Raises :class:ExamplesError for an
unknown name, a missing source, or an existing target when force is
False.
Source code in symfonic/cli/examples.py
available_examples ¶
journeys ¶
Return the twelve journey rungs, in ladder order.
Ordered by :data:JOURNEY_DOMAINS rather than by declaration, so the
ladder has exactly one definition. Raises when a domain has no spec —
silently returning eleven rungs would be the failure worth catching.
Source code in symfonic/cli/examples.py
resolve_examples_root ¶
Locate the directory that holds the curated example sources.
Prefers the packaged example_data (wheel installs); falls back to the
repo-root examples/ tree (editable installs / source checkouts).