https://github.com/saezlab/pkg_infra
This is session handler, configuration and logging handler for Saezlab packages and applications.
https://github.com/saezlab/pkg_infra
best-practices software-engineering
Last synced: 3 months ago
JSON representation
This is session handler, configuration and logging handler for Saezlab packages and applications.
- Host: GitHub
- URL: https://github.com/saezlab/pkg_infra
- Owner: saezlab
- License: mit
- Created: 2025-11-28T10:18:47.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2026-04-02T07:23:41.000Z (3 months ago)
- Last Synced: 2026-04-04T04:52:30.510Z (3 months ago)
- Topics: best-practices, software-engineering
- Language: Python
- Homepage: https://saezlab.github.io/pkg_infra
- Size: 1.32 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

---
[](https://github.com/saezlab/pkg_infra/actions/workflows/ci-testing-unit.yml)
[](https://saezlab.github.io/pkg_infra/)

[](https://pypi.org/project/pkg_infra/)




`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 `logging` module
## What it includes
- `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
`src/pkg_infra/data/default_settings.yaml`
## Installation
Install the package from PyPI:
```bash
pip install pkg_infra
```
Install it from a local checkout with docs or test extras when developing:
```bash
pip install -e ".[docs,tests]"
```
## Quick Example
```python
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)
```
## Configuration Precedence
`pkg_infra` merges configuration sources in this order, where later sources
override earlier ones:
1. Ecosystem config
2. Packaged default config
3. User config
4. Working-directory config
5. Config file pointed to by `PKG_INFRA_CONFIG`
6. Explicit custom config path passed by the caller
## Documentation
The full documentation is published at
.
To serve the docs locally without the current upstream Material warning banner:
```bash
source .venv/bin/activate
export NO_MKDOCS_2_WARNING=1
PYTHONPATH=src mkdocs serve
```
Recommended starting points:
- Installation: `docs/installation.md`
- Quickstart: `docs/learn/tutorials/quickstart.md`
- Project context and rationale: `docs/pkg_infra-project/`
## Contributing
Contributions are welcome. The repository includes dedicated guides for
documentation and code contributions in `docs/community/`.
## License
This project is distributed under the MIT License. See `LICENSE` for details.