Metadata-Version: 2.4
Name: pureconfig
Version: 0.1.0
Summary: simple setting decorator framework and platform-independent path library
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.11
Description-Content-Type: text/markdown

# pureconfig

> Document Specification
> * System Version: 0.1.0
> * Document Version: v1.0.0
> * Last Modified: 2026-07-09

# Installation
```
pip install pureconfig
```

# Quick Start
## path library

this is a function return the path of app home.

```python
from pureconfig import get_app_home

# case 1:
# get a platform home path
app = get_app_home()
print(app)
# returns a native home path

# case 2:
# get a 
get_app_home('My Module')
# returns .../My Module
```

this function returns native `pathlib.Path` instance

### Supported Platforms and Mapping

- on Windows: `%LocalAppData%`
- on Linux: `~/.config` or custom `$XDG_CONFIG_HOME`
- on Mac: `~/Library/Application Support`
- on AOS, IOS: app container path

for Windows, Linux, Mac:

when `moduleName` attribute is not `None`,   
given modultName is extended to default mapping.

- on Windows: `C:/Users/<user>/AppData/Local/My Module`
- on Linux: `~/.config/My Module`
- on Mac: `~/Library/Application Support/My Module`

## configuration decorator

this is a decorator function that construct class automatically.

```python
from pureconfig import configurate

def your_function_here(key: str) -> Any:
    if key == 'yourSetting':
        return 'setting-value'
    elif key == 'yourPath':
        return 'some/path/here'
    elif key == 'yourOption':
        return True
    elif key == 'yourID':
        return 100

@configurate(your_function_here)
class MySetting:
    yourSetting: str
    yourPath: Path
    yourOption: bool
    yourID: int
```
this equivalant with:
```python
class MySetting:
    yourSetting = str('setting-value')
    yourPath = Path('some/path/here')
    yourOption = bool(True)
    yourID = int(100)
```

## why this useful?
this decorator is built to handle variant option(s) under setting. so, you can do like this:
```python
from pureconfig import configurate

# to handle Path, pathlib should import.
from pathlib import Path

# setting some value provider
setting_values = {
    "name": "james",
    "email": "example@example.exp",
    "department": "Customer Service",
    "db_access": False,
    "on_work": True,
    "ID": 95,
    "pc_home": "C:/Users/james"
}

# since value provider is dictionary, so i wrapped with lambda function.
# provider function should be take 1 str, return 1 data for given key.
# the "key" argument transfer the string value same as attribute that defined under your class definition.
@configurate(lambda key: setting_values[key])
class Information:
    # this class now only has name, email, department field.
    name: str
    email: str
    department: str

@configurate(lambda key: setting_values[key])
class PCSetting:
    # this class now only has name, db_access, ID, pc_home field.
    name: str
    db_access: bool
    ID: int
    pc_home: Path
@configurate(lambda key: setting_values[key])
class AllConfig:
    # this class now have all keys from setting_values
    name: str
    email: str
    department: str
    db_access: bool
    on_work: bool
    ID: int
    pc_home: Path
```

you can make any combination of field name for configuration, with single value provider function.   
or, you can pass any custom-provider-function to use different value.

# Future Update
- frozen option
- instantize option
