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.


🚀 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 check . --schema schema.yml
deardir watch . --schema schema.yml --interval 10 --create

📄 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.0.tar.gz (5.0 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.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: deardir-0.1.0.tar.gz
  • Upload date:
  • Size: 5.0 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.0.tar.gz
Algorithm Hash digest
SHA256 4842eae659109876cf614d309c41ddbf55d7657214145ca3ffe2dee9c7a613e0
MD5 9432a4bb615c0f428c2a5885f9bd07d1
BLAKE2b-256 83dab75486c147a668688f121dc5281dd38669a4b75c616f6351c22584a5ac84

See more details on using hashes here.

File details

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

File metadata

  • Download URL: deardir-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b67fc42718d0190c9f8f3a6c9fcc676e7332264e7fa0efeb925196fc225080d3
MD5 4812a6608aeddf4e4e6dc5730122edb3
BLAKE2b-256 3d8291a290aa071f34c23efbb58ec8c5e123f36947055604406dc27988d479b0

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