Metadata-Version: 2.4
Name: philiprehberger-env-file
Version: 0.1.6
Summary: .env file parser with interpolation and multi-file support
Project-URL: Homepage, https://github.com/philiprehberger/py-env-file#readme
Project-URL: Repository, https://github.com/philiprehberger/py-env-file
Project-URL: Issues, https://github.com/philiprehberger/py-env-file/issues
Project-URL: Changelog, https://github.com/philiprehberger/py-env-file/blob/main/CHANGELOG.md
Author: Philip Rehberger
License-Expression: MIT
License-File: LICENSE
Keywords: configuration,dotenv,env,environment,interpolation
Classifier: Development Status :: 3 - Alpha
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.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# philiprehberger-env-file

[![Tests](https://github.com/philiprehberger/py-env-file/actions/workflows/publish.yml/badge.svg)](https://github.com/philiprehberger/py-env-file/actions/workflows/publish.yml)
[![PyPI version](https://img.shields.io/pypi/v/philiprehberger-env-file.svg)](https://pypi.org/project/philiprehberger-env-file/)
[![License](https://img.shields.io/github/license/philiprehberger/py-env-file)](LICENSE)

.env file parser with interpolation and multi-file support.

## Installation

```bash
pip install philiprehberger-env-file
```

## Usage

### Load into Environment

```python
from philiprehberger_env_file import load_env

# Load .env (default)
load_env()

# Load multiple files (later files override earlier)
load_env(".env", ".env.local")

# Don't override existing env vars
load_env(override=False)
```

### Parse Without Modifying Environment

```python
from philiprehberger_env_file import parse_env_file

config = parse_env_file(".env")
print(config["DATABASE_URL"])
```

### Supported Syntax

```bash
# Comments
KEY=value
export KEY=value

# Quoted values
SINGLE='no interpolation here'
DOUBLE="supports\nnewlines"

# Variable interpolation
BASE_URL=https://api.example.com
API_URL=${BASE_URL}/v1

# Empty values
EMPTY_VAR=

# Inline comments (unquoted values only)
HOST=localhost # this is a comment
```

## API

| Function / Class | Description |
|------------------|-------------|
| `load_env(*paths, override=True)` | Load .env files into `os.environ`, returns dict of loaded vars |
| `parse_env_file(path)` | Parse a .env file, returns dict without modifying environment |


## Development

```bash
pip install -e .
python -m pytest tests/ -v
```

## License

MIT
