Skip to main content

This is session handler, configuration and logging handler for Saezlab packages and applications.

Project description

project-banner


Tests Docs Pre-commit PyPI Python PyPI Python License Issues Last Commit

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:

pip install pkg_infra

Install it from a local checkout with docs or test extras when developing:

pip install -e ".[docs,tests]"

Quick Example

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:

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pkg_infra-0.0.1.tar.gz (641.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pkg_infra-0.0.1-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

Details for the file pkg_infra-0.0.1.tar.gz.

File metadata

  • Download URL: pkg_infra-0.0.1.tar.gz
  • Upload date:
  • Size: 641.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pkg_infra-0.0.1.tar.gz
Algorithm Hash digest
SHA256 18c5faf0234ed4db6d05330d3a00eccf48808a4d0a5e6e344eea34aa7e9c5ec6
MD5 4f0356ae05274e5dda7791961e24668a
BLAKE2b-256 60bf53779ee77d703f84fab583b91d6755684e16afdc6bdd216d92ff825469c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pkg_infra-0.0.1.tar.gz:

Publisher: publish-pypi.yml on saezlab/pkg_infra

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pkg_infra-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pkg_infra-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 23.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pkg_infra-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 192266d8c818b141baafcb2a414d6b51e7dbec55311695d2a697d79040fcf59e
MD5 81f1475f99bd9bd6fe34866bcea09d72
BLAKE2b-256 b30a978ef03538b4eea0b7340e54831e2e97c00fee47494268d9025006956415

See more details on using hashes here.

Provenance

The following attestation bundles were made for pkg_infra-0.0.1-py3-none-any.whl:

Publisher: publish-pypi.yml on saezlab/pkg_infra

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page