Skip to main content

scitex-config

SciTeX

Configuration + path management with `direct → yaml → env → default` priority cascade.

Full Documentation · uv pip install scitex-config[all]

pypi python docs

tests install-check quality cov


Problem and Solution

# Problem Solution
1 Config values come from many sources (CLI flags, YAML files, env vars, hard-coded defaults) and ad-hoc precedence rules drift between scripts. PriorityConfig.resolve() enforces a single direct → yaml → env → default cascade with a resolution log.
2 Runtime directories (cache, logs, sessions) get hardcoded to ~/.cache/<pkg>/ and ignore the user's $SCITEX_DIR. get_paths() / ScitexPaths roots directories at $SCITEX_DIR; _ecosystem.local_state.runtime_path() resolves per-package <pkg>/runtime/ paths canonically.
3 .env loading is reinvented per project (cwd-only, no walk-up, silent override of process env). load_dotenv(walk_up=True) walks parents to $HOME, never overrides existing process env, and returns a boolean status.

Quick Start

import scitex_config as cfg

config = cfg.get_config()
log_level = config.resolve("logging.level", default="INFO")

paths = cfg.get_paths()
print(paths.cache)            # ~/.scitex/cache

# SciTeX-ecosystem packages: use the per-package state resolver
from scitex_config._ecosystem import local_state
log_path = local_state.runtime_path("hpc", "dispatch.log")
print(log_path)               # ~/.scitex/hpc/runtime/dispatch.log

Demo

flowchart LR
    D[direct=cli_arg] -->|wins if not None| R[PriorityConfig.resolve]
    Y["yaml: config/app.yaml<br/>database.url"] -->|2nd| R
    E["env: DATABASE_URL"] -->|3rd| R
    F["default='postgresql://localhost/dev'"] -->|fallback| R
    R --> V["resolved value"]

Figure 1. Demo. Priority cascade: direct argument wins, then YAML, then env var, then default.

Installation

uv pip install "scitex-config[all]"
Extras
Extra Enables
all Everything below (dev + docs)
dev Test/lint tools (pytest, ruff, scitex-dev)
docs Sphinx build (sphinx, theme/parser extensions)

Architecture

flowchart LR
    SRC[direct / yaml / env / default] --> PC[PriorityConfig.resolve]
    PC --> VAL[resolved value]
    PC --> LOG[resolution log]
    ENV[.env files] --> OSenv[os.environ]
    OSenv --> PC
    YAML[default.yaml] --> SC[ScitexConfig]

Figure 2. Architecture. Sources flow into PriorityConfig.resolve; ScitexConfig serves YAML-backed dotted-path reads.

1 Interfaces

Python API
import scitex_config as cfg

# YAML-based (recommended)
config = cfg.get_config()
print(config.MY_KEY)
log_level = config.resolve("logging.level", default="INFO")

# Path resolution
paths = cfg.get_paths()
paths.function_cache       # ~/.scitex/cache/function/...

# Layered priority cascade (direct > yaml > env > default)
pc = cfg.PriorityConfig(yaml_path="config/app.yaml")
db_url = pc.resolve(
    direct=cli_arg,
    key="database.url",
    env_var="DATABASE_URL",
    default="postgresql://localhost/dev",
)

Status

Standalone fork of scitex.config. Core deps are PyYAML + scitex-logging. The umbrella package's scitex.config import path is preserved via a sys.modules-alias bridge.

Part of SciTeX

scitex-config is part of SciTeX. Install via the umbrella with pip install scitex[config] to use as scitex.config (Python) or scitex config ... (CLI).

Four Freedoms for Research

  1. The freedom to run your research anywhere — your machine, your terms.
  2. The freedom to study how every step works — from raw data to final manuscript.
  3. The freedom to redistribute your workflows, not just your papers.
  4. The freedom to modify any module and share improvements with the community.

AGPL-3.0 — because we believe research infrastructure deserves the same freedoms as the software it runs on.

License

AGPL-3.0-only (see LICENSE).


SciTeX

Metadata

Release files for scitex-config 0.3.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scitex-config 0.3.7
File Size Uploaded
scitex_config-0.3.7.tar.gz 37.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for scitex-config 0.3.7
File Interpreter ABI Platform
scitex_config-0.3.7-py3-none-any.whl Python 3 none any Details

Total release size: 79.0 kB

Release files / scitex_config-0.3.7.tar.gz

Download URL scitex_config-0.3.7.tar.gz
Size 37.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c14ccad3457fac30b15fc3a45b7efef7cca21d4100f2c281d3e297387bf2ac77
BLAKE2b-256 checksum
How to use checksums
00844d250aa3a380b1eb56701e7d5631dec4ab5a8fae82aa378ca5a28fe41720
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / scitex_config-0.3.7-py3-none-any.whl

Download URL scitex_config-0.3.7-py3-none-any.whl
Size 41.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
acdb05ca4687adaf621a21d336f481898ba45804809fea83b7cd2ec08907857b
BLAKE2b-256 checksum
How to use checksums
0ba714a5b0315af8af87b67ab357cb631d60fda26a87a6d37b8899c6f27eb513
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.14

Release history Release notifications | RSS feed

This release

0.3.7 This release

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page