Metadata-Version: 2.1
Name: envclasses
Version: 0.2.5
Summary: A library to map dataclass and environmental variables
Home-page: https://github.com/yukinarit/envclasses
Author: yukinarit
Author-email: yukinarit84@gmail.com
License: MIT
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Provides-Extra: docs
Provides-Extra: test
License-File: LICENSE

# `envclasses`

[![image](https://img.shields.io/pypi/v/envclasses.svg)](https://pypi.org/project/envclasses/)
[![image](https://img.shields.io/pypi/pyversions/envclasses.svg)](https://pypi.org/project/envclasses/)
![Test](https://github.com/yukinarit/envclasses/workflows/Test/badge.svg)

*`envclasses` is a library to map fields on dataclass object to environment variables.*

## Installation

```bash
pip install envclasses
```

## Usage

Declare a class with `dataclass` and `envclass` decorators.

```python
from envclasses import envclass
from dataclasses import dataclass

@envclass
@dataclass
class Foo:
    v: int

foo = Foo(i=10)
load_env(foo, prefix='foo')
print(foo)
```

Run the script

```
$ python foo.py
Foo(i=10)
```

Run with environment variable

```
$ FOO_V=100 python foo.py
Foo(i=100)
```

