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 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
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 BSD-3-Clause 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.1.tar.gz (661.4 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.1-py3-none-any.whl (45.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pkg_infra-0.1.1.tar.gz
  • Upload date:
  • Size: 661.4 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.1.tar.gz
Algorithm Hash digest
SHA256 12cdf2a49cb9107f96a246135da69cb7919ae4aedbc3988674fc42e34fd8ea8d
MD5 eedab7f4071fdc33dd088651ed4f421a
BLAKE2b-256 f1b011b27d5a80ac11529135ded619648cdebd5bae612ef8102a88e39d2d6db7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pkg_infra-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 45.5 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 602d7527ce002371aa5a09f6c30ad0ebd78e4a9420c381916c35dc6e059f532a
MD5 a2ee83f443ff167df6d0c7e0dc7f2aa5
BLAKE2b-256 2c4b5b6dd0a3fe3ac8de4dc07f20a60071a8d1a117d76a08fc7cbe8511cd086d

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