Metadata-Version: 2.4
Name: pedros
Version: 0.13.0
Summary: Small utility package for my projects.
Project-URL: Homepage, https://github.com/pierrelapolla/pedros
Project-URL: Repository, https://github.com/pierrelapolla/pedros
Project-URL: Issues, https://github.com/pierrelapolla/pedros/issues
Project-URL: Documentation, https://github.com/pierrelapolla/pedros#readme
Author: Pierre LAPOLLA
License: MIT License
        
        Copyright (c) [2025] [Pierre LAPOLLA]
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: decorators,logging,progress-bar,python,utilities
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: <3.16,>=3.10
Requires-Dist: wrapt>=2.1.1
Provides-Extra: all
Requires-Dist: rich>=14.3.3; extra == 'all'
Provides-Extra: rich
Requires-Dist: rich>=14.3.3; extra == 'rich'
Description-Content-Type: text/markdown

# Pedros

[![PyPI](https://img.shields.io/pypi/v/pedros)](https://pypi.org/project/pedros/)
![Ruff](https://img.shields.io/badge/ruff-enabled-brightgreen)
![License](https://img.shields.io/badge/license-MIT-green)

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

```bash
pip install pedros
```

OR

```bash
uv add pedros
```

Optional features:

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

## Quickstart

```python
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](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:
```bash
uv run pre-commit run --all-files
```

## Support

For questions or support, please open a GitHub issue.
