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 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.1.0.tar.gz (661.2 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.1.0-py3-none-any.whl (45.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pkg_infra-0.1.0.tar.gz
  • Upload date:
  • Size: 661.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"26.05","id":"yarara","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pkg_infra-0.1.0.tar.gz
Algorithm Hash digest
SHA256 508cef7ed21055ed2eca100725a783a7a63c194eb96b476e4a0487786cd95643
MD5 5d7defb535b6b3c58dae2bbb17fb1c41
BLAKE2b-256 648f452c671eff71323bc925b508cd58d8d49ffcf92f8a93709b8d144f1e710b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pkg_infra-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 45.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"26.05","id":"yarara","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pkg_infra-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bfea6ba198fe89f1ac5015293c4c78e14916d06d9c848e589894ba9460e9ad68
MD5 7dd3626f3fccf5166378f6fae2c1c990
BLAKE2b-256 0a601bdc8e9665dee55c63b808dd02037051a9619bb04aa2c3edd16f30ce4951

See more details on using hashes here.

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