Metadata-Version: 2.4
Name: py-configr
Version: 0.1.0
Summary: A flexible, type-safe configuration management library for Python
Author-email: Corinna Wieken <5384689+cwieken@users.noreply.github.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/cieken/configr
Project-URL: Bug Tracker, https://github.com/cwieken/configr/issues
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: <3.14,>=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: yaml
Requires-Dist: pyyaml>=6.0; extra == "yaml"
Dynamic: license-file

# Configr

A flexible, type-safe configuration management library for Python.

Configr simplifies configuration management by leveraging Python's dataclasses and type hints to provide a robust, type-safe approach to application configuration.

[![Run Tests](https://github.com/cwieken/configr/actions/workflows/run-tests.yml/badge.svg)](https://github.com/cwieken/configr/actions/workflows/run-tests.yml)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python Versions](https://img.shields.io/badge/Python-3.10%20|%203.11%20|%203.12%20|%203.13-blue)](https://www.python.org/)


- **Type Safety**: Leverage Python's type hints for configuration validation
- **Dataclass Integration**: Seamlessly map configuration files to Python dataclasses
- **Multiple Format Support**: Load configuration from JSON and YAML files
- **Extendable**: Easily add support for custom configuration formats
- **Simple API**: Convenient decorator-based approach for defining configuration classes

## Requirements
- Python 3.10 or higher


## Installation

```bash
pip install py-configr

# For YAML support
pip install py-configr[yaml]
```

## Quick Start

Define your configuration class:

```python
from configr import config_class, ConfigBase

@config_class(file_name="database.json")
class DatabaseConfig:
    host: str
    port: int = 5432
    username: str
    password: str
    database: str

# Load configuration
db_config = ConfigBase.load(DatabaseConfig)

# Use configuration
print(f"Connecting to {db_config.database} at {db_config.host}:{db_config.port}")
```

Create a configuration file in `_config/database.json`:

```json
{
  "host": "localhost",
  "username": "admin",
  "password": "secure_password",
  "database": "my_app"
}
```

## Documentation

For complete documentation, visit [our documentation site](https://cwieken.github.io/configr/).

- [Getting Started](https://cwieken.github.io/configr/getting-started/)
- [API Reference](https://cwieken.github.io/configr/api/config-base/)
- [Examples](https://cwieken.github.io/configr/examples/)

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## License

This project is licensed under the MIT License - see the LICENSE file for details.
