rgpycrumbs.cli

Attributes

Functions

_env_flag(→ bool)

_in_env_stack_ready(→ bool)

True when the active interpreter already has the eOn plot/readcon stack.

_prefer_in_env_interpreter(→ bool)

Decide whether to run scripts with sys.executable instead of uv run.

_normalize_dist_name(→ str)

PEP 503-ish normalize for comparing package names.

_pyproject_project_name(→ str | None)

Return [project].name from a pyproject.toml, if present.

_find_editable_source(→ pathlib.Path | None)

Return the local project root for an editable install of package_name.

_uv_editable_sources(→ list[pathlib.Path])

Return local editable roots that should satisfy script dependencies.

_get_scripts_in_folder(→ list[str])

Returns a sorted list of CLI script names (without extension) in a folder.

_load_lock_pins_or_exit(→ dict[str, str])

Load PyPI pins from uv.lock / pylock / CycloneDX; exit on failure.

_dispatch(group, script_name, script_args[, is_dev, ...])

Sets up the environment and runs the target script via 'uv run'.

_make_script_command(→ click.Command)

Creates a click command that dispatches to a PEP 723 script.

main(ctx, dev, verbose, lock_path, sbom_path)

Dispatcher for PEP 723 scripts (preferred entry; not raw uv run).

config_cmd(→ None)

Show merged suite config (rgpkgs.toml + ~/.config/rgpkgs/…).

Module Contents

rgpycrumbs.cli.PACKAGE_ROOT[source]
rgpycrumbs.cli._IN_ENV_STACK_MODULES = ('readcon', 'matplotlib', 'polars', 'ase', 'chemparseplot')[source]
rgpycrumbs.cli._env_flag(name: str) bool[source]
rgpycrumbs.cli._in_env_stack_ready() bool[source]

True when the active interpreter already has the eOn plot/readcon stack.

Prefer this over uv run isolation: a host uv cache can pull a different Python (e.g. 3.12) while site-packages still hold 3.13 extension modules (numpy), which breaks plotting of readcon-core CON outputs from eOn 2.16+.

rgpycrumbs.cli._prefer_in_env_interpreter(is_dev: bool, *, force_uv: bool | None = None) bool[source]

Decide whether to run scripts with sys.executable instead of uv run.

rgpycrumbs.cli._normalize_dist_name(name: str) str[source]

PEP 503-ish normalize for comparing package names.

rgpycrumbs.cli._pyproject_project_name(pyproject: pathlib.Path) str | None[source]

Return [project].name from a pyproject.toml, if present.

rgpycrumbs.cli._find_editable_source(package_name: str) pathlib.Path | None[source]

Return the local project root for an editable install of package_name.

Wheel installs under site-packages must never map to an unrelated monorepo pyproject.toml above the env (e.g. eOn root named eon-akmc when looking up chemparseplot). Only return a path when:

  1. The module lives outside site-/dist-packages (true editable / src layout), and

  2. The nearest pyproject.toml has [project].name matching package_name.

eOn tooling only needs eon-schema + pyeonclient; never imply eon-akmc.

rgpycrumbs.cli._uv_editable_sources() list[pathlib.Path][source]

Return local editable roots that should satisfy script dependencies.

Only true editable checkouts of chemparseplot (name-matched). Never the eOn monorepo / eon-akmc tree.

rgpycrumbs.cli._get_scripts_in_folder(folder_name: str) list[str][source]

Returns a sorted list of CLI script names (without extension) in a folder.

Excludes library modules (hdf5_io, plotting) and internal files (__init__, _*). Includes actual CLI entry point scripts.

rgpycrumbs.cli._load_lock_pins_or_exit(lock_path: str | pathlib.Path) dict[str, str][source]

Load PyPI pins from uv.lock / pylock / CycloneDX; exit on failure.

rgpycrumbs.cli._dispatch(group: str, script_name: str, script_args: tuple, is_dev: bool = False, is_verbose: bool = False, lock_path: str | None = None, sbom_path: str | None = None)[source]

Sets up the environment and runs the target script via ‘uv run’.

Preferred entry is this dispatcher (rgpycrumbs / python -m rgpycrumbs.cli). Raw uv run <script.py> is not the primary path.

Pins/lock resolution (highest wins): CLI --lock/--sbom → env RGPYCRUMBS_LOCK/_SBOM → project rgpycrumbs.toml → user ~/.config/rgpycrumbs/config.toml. Formats: uv.lock, PEP 751 pylock, CycloneDX. TOML [pins.packages] merge on top of the lock file.

rgpycrumbs.cli._make_script_command(group_name: str, script_stem: str) click.Command[source]

Creates a click command that dispatches to a PEP 723 script.

For full option help, run the script directly:

python -m rgpycrumbs.<group>.<script> –help

rgpycrumbs.cli.main(ctx, dev, verbose, lock_path, sbom_path)[source]

Dispatcher for PEP 723 scripts (preferred entry; not raw uv run).

Each tool is a self-contained script. Prefer:

rgpycrumbs eon plt-neb ...
python -m rgpycrumbs.cli eon plt-neb ...

Suite config (shared with chemparseplot and other rgpkgs): project rgpkgs.toml and user ~/.config/rgpkgs/config.toml for lock pins and dispatch defaults. Legacy rgpycrumbs.toml paths still work.

rgpycrumbs.cli._valid_groups[source]
rgpycrumbs.cli._file_stems = [][source]
rgpycrumbs.cli.config_cmd(action: str) None[source]

Show merged suite config (rgpkgs.toml + ~/.config/rgpkgs/…).