rgpycrumbs.config¶
Ecosystem-wide layered TOML config (rgpkgs suite).
Shared by rgpycrumbs, chemparseplot, and siblings — not a package-private silo. One pin/lock policy for the whole stack.
Search order for config files (later merges override earlier):
User global:
$XDG_CONFIG_HOME/rgpkgs/config.toml(default~/.config/rgpkgs/config.toml)Legacy user:
~/.config/rgpycrumbs/config.toml(still read)Project: walk upward for
rgpkgs.toml/.rgpkgs.toml, then legacyrgpycrumbs.toml/.rgpycrumbs.tomlRGPKGS_CONFIGorRGPYCRUMBS_CONFIG— explicit file (merged last)
Runtime precedence for values (highest first):
CLI flags (
--lock,--sbom,--dev, …)Environment (
RGPKGS_LOCK/RGPYCRUMBS_LOCK,RGPKGS_FORCE_UV, …)Merged TOML (project overrides global)
Built-in defaults
Example ~/.config/rgpkgs/config.toml:
# Shared across the suite (chemparseplot, rgpycrumbs, …)
[pins]
lock = "uv.lock" # or pylock.toml / CycloneDX JSON
[pins.packages]
jax = "0.4.31"
# Tool-specific (optional)
[rgpycrumbs.dispatch]
auto_deps = true
force_uv = false
# Future: [chemparseplot.plot] theme = "…"
Added in version 1.9.15.
Changed in version 1.9.16: Ecosystem identity is rgpkgs (not per-package config trees).
Attributes¶
Classes¶
Resolved configuration (files + defaults; env/CLI applied separately). |
Functions¶
|
|
|
Preferred global config: |
|
Legacy global: |
|
Existence check via os.path (not Path.is_file) to avoid class mocks. |
|
Walk from start (default CWD) upward for a project config file. |
|
|
|
|
|
|
|
|
|
|
|
Return True/False if any env is set; None if all unset. |
|
Return dispatch table from top-level or [rgpycrumbs.dispatch]. |
|
|
|
Load and merge global + project + optional explicit config files. |
|
CLI → env (RGPKGS_* / RGPYCRUMBS_*) → config file lock path. |
|
Whether to force uv isolation (False if --dev / DEV env). |
|
Return |
Module Contents¶
- rgpycrumbs.config.PROJECT_CONFIG_NAMES = ('rgpkgs.toml', '.rgpkgs.toml', 'rgpycrumbs.toml', '.rgpycrumbs.toml')[source]¶
- rgpycrumbs.config._xdg_config_home() pathlib.Path[source]¶
- rgpycrumbs.config.user_config_path() pathlib.Path[source]¶
Preferred global config:
~/.config/rgpkgs/config.toml.
- rgpycrumbs.config.user_config_path_legacy() pathlib.Path[source]¶
Legacy global:
~/.config/rgpycrumbs/config.toml.
- rgpycrumbs.config._is_file(path: pathlib.Path) bool[source]¶
Existence check via os.path (not Path.is_file) to avoid class mocks.
- rgpycrumbs.config.find_project_config(start: pathlib.Path | None = None) pathlib.Path | None[source]¶
Walk from start (default CWD) upward for a project config file.
Prefers
rgpkgs.tomlover legacyrgpycrumbs.tomlin the same directory.
- rgpycrumbs.config._load_toml_file(path: pathlib.Path) dict[str, Any][source]¶
- rgpycrumbs.config._resolve_path(raw: str, base_dir: pathlib.Path) pathlib.Path[source]¶
- rgpycrumbs.config._env_flag_any(*names: str) bool | None[source]¶
Return True/False if any env is set; None if all unset.
- class rgpycrumbs.config.RgpycrumbsConfig[source]¶
Resolved configuration (files + defaults; env/CLI applied separately).
Shared pin fields apply suite-wide; dispatch fields are rgpycrumbs CLI defaults (other tools may ignore them).
- lock_path: pathlib.Path | None = None[source]¶
- sources: list[pathlib.Path] = [][source]¶
- rgpycrumbs.config._extract_dispatch(data: dict[str, Any]) dict[str, Any][source]¶
Return dispatch table from top-level or [rgpycrumbs.dispatch].
- rgpycrumbs.config._merge_section(cfg: RgpycrumbsConfig, data: dict[str, Any], *, base_dir: pathlib.Path, source: pathlib.Path) None[source]¶
- rgpycrumbs.config.load_config(*, cwd: pathlib.Path | None = None, explicit_config: pathlib.Path | str | None = None) RgpycrumbsConfig[source]¶
Load and merge global + project + optional explicit config files.
- rgpycrumbs.config.resolve_lock_path_layered(*, cli_lock: str | None = None, cli_sbom: str | None = None, config: RgpycrumbsConfig | None = None, cwd: pathlib.Path | None = None) pathlib.Path | None[source]¶
CLI → env (RGPKGS_* / RGPYCRUMBS_*) → config file lock path.
- rgpycrumbs.config.resolve_force_uv(*, is_dev: bool, config: RgpycrumbsConfig | None = None, cwd: pathlib.Path | None = None) bool[source]¶
Whether to force uv isolation (False if –dev / DEV env).
- rgpycrumbs.config.resolve_auto_deps_default(*, config: RgpycrumbsConfig | None = None, cwd: pathlib.Path | None = None) str[source]¶
Return
'1'or'0'for default AUTO_DEPS when env unset.