Metadata-Version: 2.3
Name: deardir
Version: 0.1.4
Summary: Validate and optionally create directory structures from YAML or JSON schema files.
License: MIT
Author: Dennis Weiß
Author-email: dellen2203@googlemail.com
Requires-Python: >=3.8,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Dist: pyyaml (>=6.0,<7.0)
Requires-Dist: toml (>=0.10.2,<0.11.0)
Description-Content-Type: text/markdown

[![PyPI Downloads](https://static.pepy.tech/badge/deardir)](https://pepy.tech/projects/deardir)
[![codecov](https://codecov.io/gh/deardir/deardir/branch/main/graph/badge.svg)](https://codecov.io/gh/deardir/deardir)

# deardir

**Validate and optionally create project directory structures from JSON or YAML schema files.**

pypi ref: https://pypi.org/project/deardir/

---

## ➡️ Features

- Validate file/folder structures using declarative schema files
- Supports `.json`, `.yaml`, `.yml`, Python `dict` or `list` objects
- Optionally auto-creates missing directories and files
- Async live mode to continuously monitor a structure
- Python API and CLI interface

---

## ➡️ Installation

```bash
pip install deardir
```

Or if you are developing locally:

```bash
poetry install
```

---

## ➡️ Example Schema

### `schema.yml`

```yaml
- data
- src:
    - __init__.py
    - main.py
    - utils:
        - helpers.py
- README.md
- pyproject.toml
```

---

## ➡️ Usage

### Python

```python
from deardir import DearDir
from pathlib import Path

dd = DearDir(root_paths=[Path(".")], schema=Path("schema.yml"))
dd.create_missing = True
dd.validate()

print(dd.missing)   # Set of missing paths
print(dd.created)   # Set of paths that were created
```

### Async live mode

```python

dd = DearDir([Path(".")], "schema.yml")
dd.create_missing = True

dd.live(interval=10, duration=60, mode=1)

# Thread
dd.live(interval=10, duration=60, mode=2)

# Synchron
dd.live(interval=10, duration=60, mode=0)

```

---

### CLI

```bash
deardir
deardir --help
deardir check --help
deardir --version
deardir check ./Tests --schema schema.yaml 
deardir check ./Tests --schema schema.yaml --create
#ASYNC LIVE WATCHER:
deardir watch ./Tests --schema schema.yaml --create --interval 1 --duration 10
```

---

## ➡️ Future Ideas (help wanted!)

- Improved CLI and JSON/HTML/Markdown reporting with colorized output  
- Support for optional files/folders and conditional rules in schema  
- Custom user-defined validation hooks  
- Auto-fix mode (e.g. create from templates, autofill missing entries)  
- File system watch mode with live validation (`--watch`)  
- GUI or web interface for drag-and-drop validation  
- GitHub Action / CI/CD integration  
- Multi-language support (English, German, ...)

---

## 📄 License

MIT

