pkg_infra provides shared infrastructure for Saezlab Python packages. It
standardizes three pieces of runtime behavior that are often reimplemented
ad hoc across projects:
- Session metadata for reproducible runs and workspace-aware execution
- Layered YAML configuration with validation and predictable precedence
- Centralized logging based on Python's standard
loggingmodule
pkg_infra.get_session(...)as the main entrypoint for initializing runtime state- Config loading from ecosystem, package default, user, working directory, environment variable, and optional custom file sources
- Pydantic-based validation for the merged settings model
- Logging configuration generation with support for file handlers, JSON output, package groups, and async queue-based logging
- A packaged baseline configuration in
pkg_infra/data/default_settings.yaml
Install the package from PyPI:
pip install pkg_infraInstall it from a local checkout with docs or test extras when developing:
pip install -e ".[docs,tests]"from pathlib import Path
from pkg_infra import get_session
session = get_session(
workspace=Path("."),
include_location=False,
)
print(session)
print(session.get_config_dict())
corneto_settings = session.get_conf("corneto")
print(corneto_settings)pkg_infra merges configuration sources in this order, where later sources
override earlier ones:
- Ecosystem config
- Packaged default config
- User config
- Working-directory config
- Config file pointed to by
PKG_INFRA_CONFIG - Explicit custom config path passed by the caller
The full documentation is published at https://saezlab.github.io/pkg_infra/.
To serve the docs locally without the current upstream Material warning banner:
source .venv/bin/activate
export NO_MKDOCS_2_WARNING=1
mkdocs serveRecommended starting points:
- Installation:
docs/installation.md - Quickstart:
docs/learn/tutorials/quickstart.md - Project context and rationale:
docs/pkg_infra-project/
Contributions are welcome. The repository includes dedicated guides for
documentation and code contributions in docs/community/.
This project is distributed under the BSD-3-Clause License. See LICENSE for details.
