Skip to main content

Small utility package for my projects.

Project description

Pedros

PyPI Ruff License

A small package of reusable Python utilities for Python projects.

Features

  • Dependency Management: Smart detection of optional dependencies (rich, tqdm)
  • Logging: Simplified logging setup with optional Rich support
  • Progress Bars: Unified progress bar API with multiple backends
  • Decorators: Robust decorators for timing (@timed) and error handling (@safe)
  • Type Safe: Comprehensive type hints and PEP 561 compliance

Installation

pip install pedros

OR

uv add pedros

Optional features:

pip install "pedros[rich]"   # Rich logging/progress backend
pip install "pedros[all]"    # all optional backends

Quickstart

from pedros import setup_logging, get_logger, progbar, timed, safe

# Configure logging for pedros
setup_logging()
logger = get_logger()

# Or configure another package logger without touching root logging
setup_logging(logger_name="my_package")
logger = get_logger("my_package")

# Use progress bar (auto-selects backend: rich > tqdm > basic)
for item in progbar(range(10), desc="Processing"):
    pass

# Time function execution
@timed(logger="my_package")
def process_data():
    return "result"


process_data()  # Logs: "process_data took 1.23 ms to execute."


# Safely handle errors
@safe(re_raise=False, logger="my_package")
def risky_operation():
    raise ValueError("Something went wrong")


risky_operation()  # Logs the error but doesn't crash

License

This project is licensed under the MIT License.

Contributing

Contributions are welcome! Please open issues or pull requests on GitHub. Before submitting contributions via pull requests, make sure the pre-commit hooks are installed. Run them manually with:

uv run pre-commit run --all-files

Support

For questions or support, please open a GitHub issue.

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

pedros-0.13.0.tar.gz (80.3 kB view details)

Uploaded Source

Built Distribution

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

pedros-0.13.0-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file pedros-0.13.0.tar.gz.

File metadata

  • Download URL: pedros-0.13.0.tar.gz
  • Upload date:
  • Size: 80.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pedros-0.13.0.tar.gz
Algorithm Hash digest
SHA256 ebb8cff581f416465666d9316ad8c13340be99cf2abadee65ef655d40f70d9a0
MD5 779d19e956efac7b6a72588f5e5f154a
BLAKE2b-256 632e8be1a2ea3608eee52b47ea91bdc7572f9702268ceaaf0605ed1c0946f338

See more details on using hashes here.

Provenance

The following attestation bundles were made for pedros-0.13.0.tar.gz:

Publisher: python-publish.yml on PierreLapolla/pedros

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

File details

Details for the file pedros-0.13.0-py3-none-any.whl.

File metadata

  • Download URL: pedros-0.13.0-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pedros-0.13.0-py3-none-any.whl
Algorithm Hash digest
SHA256 09f24a3bfce6bace3c18b33d26b5d9fa2ea7403b2b1b645fcefeb7080717e474
MD5 e99245dc90e42e23a7933f2908f3b557
BLAKE2b-256 60ad16ac0b669241496fa40d722ff4dcae24a2935c90b688b4ffae27536c8a75

See more details on using hashes here.

Provenance

The following attestation bundles were made for pedros-0.13.0-py3-none-any.whl:

Publisher: python-publish.yml on PierreLapolla/pedros

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