Skip to main content

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

Project description

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

pip install deardir

Or if you are developing locally:

poetry install

🧪 Example Schema

schema.yml

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

🧰 Usage

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

import asyncio

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

asyncio.run(dd.live(interval=10, duration=60))

CLI

deardir
deardir --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

📄 License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deardir-0.1.2.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deardir-0.1.2-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file deardir-0.1.2.tar.gz.

File metadata

  • Download URL: deardir-0.1.2.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.10.17 Linux/6.11.0-1014-azure

File hashes

Hashes for deardir-0.1.2.tar.gz
Algorithm Hash digest
SHA256 270805c6d50d51f2b87b4493b4defe3984679452802b66c85fd042c1fe7bd0a1
MD5 ea72b0b2583ef6e0924a6eea82c03b4f
BLAKE2b-256 0797229d13c9d4b64b35bfbcff5df55ae4c8c21b698183782fa6e8d579517239

See more details on using hashes here.

File details

Details for the file deardir-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: deardir-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.10.17 Linux/6.11.0-1014-azure

File hashes

Hashes for deardir-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f08067318e1d553a21d2a34c59a2fb46b2cf0b9600125ced692f3726720ad620
MD5 06a453af08833fe946b67b1a691577d6
BLAKE2b-256 b4aad9cf79d855d2a9e7101f5cdf1c54add4ae47c1f93a6659604911aebedabe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page