semvec/pypi-packages huggingface dataset:
dictconf 0.1.0
A simple, file-composition-based configuration library.
License: MIT License
Requires Python: >=3.8

Of course. Here is a very simple, clean Markdown README that you can copy and paste directly.

-----

# dictconf

A simple, file-composition-based configuration library for Python, inspired by Hydra.

## Installation

Install the library using pip:

```bash
pip install dictconf
```

To include optional features like `dacite` support, install with the extra:

```bash
pip install "dictconf[dacite]"
```

For development, install all tools with:

```bash
pip install -e ".[dev]"
```

-----

## Quick Start

This library works by composing configuration from multiple YAML files.

### 1\. Create Your Config Files

Create a directory structure like this:

```
your_project/
├── conf/
│   ├── config.yaml
│   └── db/
│       ├── mysql.yaml
│       └── sqlite.yaml
└── main.py
```

**`conf/config.yaml`**

This is your main entry point. It defines the default components to use and can override any value.

```yaml
# Define the default components to load
defaults:
  - db: sqlite

# Define or override configuration values
server:
  host: 127.0.0.1
  port: 8080
  url: "http://${server.host}:${server.port}" # Variable interpolation
```

**`conf/db/sqlite.yaml`** (The default database)

```yaml
db:
  driver: sqlite
  path: /var/data/app.db
  timeout: 5000
```

**`conf/db/mysql.yaml`** (An alternative database)

```yaml
db:
  driver: mysql
  host: db.prod.local
  user: root
  password: "changeme"
```

### 2\. Load the Configuration in Python

**`main.py`**

```python
from config import load_config
import sys

# Load config from the 'conf' directory.
# CLI arguments are automatically used for overrides.
cfg = load_config("conf")

# Access values with dot notation
print(f"Database Driver: {cfg.db.driver}")
print(f"Server URL: {cfg.server.url}")

if cfg.db.driver == "mysql":
    print(f"Database User: {cfg.db.user}")
```

### 3\. Run Your Application

**Run with default settings:**

```bash
$ python main.py
Database Driver: sqlite
Server URL: http://127.0.0.1:8080
```

**Run with command-line overrides:**

You can swap components (`db=mysql`) and override specific values (`server.port=9000`).

```bash
$ python main.py db=mysql server.port=9000 db.user=admin
Database Driver: mysql
Server URL: http://127.0.0.1:9000
Database User: admin
```

-----

## Key Features

  * **YAML Composition**: Build your configuration from small, reusable files.
  * **CLI Overrides**: Easily swap components or change any value from the command line.
  * **Variable Interpolation**: Reference other config values using `${...}` syntax.
  * **Dot-Notation Access**: Access nested configuration values easily (e.g., `cfg.db.host`).