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_val=cli_arg] -->|wins if not None| R[ScitexConfig.resolve]
    Y["yaml: config/app.yaml<br/>database.url"] -->|2nd| R
    E["env: SCITEX_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 / dictionary / env / default] --> PC[PriorityConfig.resolve]
    PC --> VAL[resolved value]
    PC --> LOG[resolution log]
    ENV[.env files] --> OSenv[os.environ]
    OSenv --> PC
    YAML[default.yaml or explicit YAML] --> SC[ScitexConfig]
    SC --> VAL

Figure 2. Architecture. PriorityConfig resolves dictionary inputs; ScitexConfig supplies YAML-backed dotted-path reads.

1 Interfaces

Python API
import scitex_config as cfg

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

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

# Explicit YAML file; nested keys use dot notation.
config = cfg.ScitexConfig(config_path="config/app.yaml")
db_url = config.resolve(
    "database.url",
    direct_val=None,  # pass an explicit override here when supplied
    default="postgresql://localhost/dev",
)

# Dictionary primitive: direct > dictionary > environment > default.
pc = cfg.PriorityConfig(config_dict={"port": 8000}, env_prefix="APP_")
port = pc.resolve("port", direct_val=None, default=3000, type=int)

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.9

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.9
File Size Uploaded Provenance Actions
scitex_config-0.3.9.tar.gz 38.4 kB Without provenance Details for scitex_config-0.3.9.tar.gz

Built distribution (wheel)

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

Total release size: 80.3 kB

Release files / scitex_config-0.3.9.tar.gz

Download URL scitex_config-0.3.9.tar.gz
Size 38.4 kB
Tags Source
SHA-256 checksum
How to use checksums
495d3b1611182672a0f54ebdfffc3c164916056c602ac46ec1736c81c6cfcef3
BLAKE2b-256 checksum
How to use checksums
e7e3c6e9286d7de4639efc230a7092527df128eebb42055879703cf81233faea
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.9-py3-none-any.whl

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

Security for scitex-config 0.3.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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