Metadata-Version: 2.1
Name: envclasses
Version: 0.3.0
Summary: envclasses is a library to map fields on dataclass object to environment variables
Home-page: https://yukinarit.github.io/envclasses/envclasses.html
License: MIT
Author: Yukinari Tani
Author-email: yukinarit84@gmail.com
Requires-Python: >=3.6,<4.0
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
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 :: Implementation :: CPython
Requires-Dist: dataclasses; python_version < "3.7"
Requires-Dist: pyyaml
Requires-Dist: typing-extensions; python_version < "3.8"
Requires-Dist: typing_inspect (>=0.4.0)
Project-URL: Repository, https://github.com/yukinarit/envclasses
Description-Content-Type: text/markdown

# `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, load_env
from dataclasses import dataclass

@envclass
@dataclass
class Foo:
    v: int

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

Run the script

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

Run with environment variable

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