Metadata-Version: 2.4
Name: pkg-infra
Version: 0.1.0
Summary: This is session handler, configuration and logging handler for Saezlab packages and applications.
Project-URL: Documentation, https://saezlab.github.io/pkg_infra
Project-URL: Homepage, https://github.com/saezlab/pkg_infra
Project-URL: Issues, https://github.com/saezlab/pkg_infra/issues
Project-URL: Repository, https://github.com/saezlab/pkg_infra
Author-email: Edwin Carreño <ecarrenolozano@gmail.com>
Maintainer-email: Edwin Carreño <ecarrenolozano@gmail.com>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Python: >=3.10
Requires-Dist: numpy>=2.2.6
Requires-Dist: omegaconf>=2.3.0
Requires-Dist: pandas>=2.3.3
Requires-Dist: platformdirs>=4.5.0
Requires-Dist: pydantic>=2.12.5
Requires-Dist: python-json-logger>=4.0.0
Requires-Dist: pyyaml>=6.0.3
Requires-Dist: toml
Provides-Extra: dev
Requires-Dist: bump2version; extra == 'dev'
Requires-Dist: distlib; extra == 'dev'
Requires-Dist: ipykernel; extra == 'dev'
Requires-Dist: pre-commit; extra == 'dev'
Requires-Dist: twine; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs-material>=9.6.14; extra == 'docs'
Requires-Dist: mkdocs<2,>=1.6; extra == 'docs'
Requires-Dist: mkdocstrings[python]<0.30,>=0.29.1; extra == 'docs'
Requires-Dist: pymdown-extensions>=10.15; extra == 'docs'
Provides-Extra: security
Requires-Dist: bandit; extra == 'security'
Provides-Extra: semantic
Requires-Dist: rdflib>=6.0.0; extra == 'semantic'
Provides-Extra: tests
Requires-Dist: codecov-cli>=10.2.0; extra == 'tests'
Requires-Dist: coverage>=6.0; extra == 'tests'
Requires-Dist: diff-cover; extra == 'tests'
Requires-Dist: pytest-cov; extra == 'tests'
Requires-Dist: pytest>=6.0; extra == 'tests'
Requires-Dist: ruff; extra == 'tests'
Requires-Dist: tox-gh>=1.5.0; extra == 'tests'
Requires-Dist: tox>=3.20.1; extra == 'tests'
Description-Content-Type: text/markdown

![project-banner](https://raw.githubusercontent.com/saezlab/pkg_infra/main/docs/assets/project-banner-readme.png)

---


[![Tests](https://img.shields.io/github/actions/workflow/status/saezlab/pkg_infra/ci-testing-unit.yml?branch=main)](https://github.com/saezlab/pkg_infra/actions/workflows/ci-testing-unit.yml)
[![Docs](https://img.shields.io/badge/docs-MkDocs-blue)](https://saezlab.github.io/pkg_infra/)
![Pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)
[![PyPI](https://img.shields.io/pypi/v/pkg_infra)](https://pypi.org/project/pkg_infra/)
![Python](https://img.shields.io/badge/dynamic/toml?url=https%3A%2F%2Fraw.githubusercontent.com%2Fsaezlab%2Fpkg_infra%2Fmain%2Fpyproject.toml&query=%24.project.requires-python&label=python)
![License](https://img.shields.io/github/license/saezlab/pkg_infra)
![Issues](https://img.shields.io/github/issues/saezlab/pkg_infra)
![Last Commit](https://img.shields.io/github/last-commit/saezlab/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
<https://saezlab.github.io/pkg_infra/>.

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.
