Skip to main content

Directory structure template-based validation.

Project description

validir

A command line Python tool / package for directory validation: making sure a directory structure matches an expected template.


Example Usage

validir checks a local directory structure against a YAML template like the following:

# contents of template.yaml
flags:                    # top-level flags used during the verification process
  allow_extra: false      # whether or not to consider the presence of extra files and directories an error
  check_hidden: false     # whether or not to check hidden files (i.e. files starting with '.')
root:                     # beginning of expected directory structure
- optional: ["*"]         # we expect a directory called 'optional' which can have anything in it
- whoops: []              # the whoops folder must be present and completely empty
- required:               # the required directory is, well, required
  - metadata:             # the metadata directory is required
    - "*.ext"             # metadata must have the extension .ext ...
    - "sample*"           # ... or start with the keyword "sample"
  - textfiles:            # textfiles is another required directory
    - "text*.txt"         # textfiles must be named text and end with the .txt extension
    - "text*.yaml"        # people can also store corresponding yaml files
  - required.txt          # the required file is required, naturally

To verify a local directory against this template, run the following:

validir validate {DIRECTORY} template.yaml

Validir also provides an API to generate templates from a given directory. This is intended as a bootstrapping process which allows users to refine a pre-existing directory structure instead of starting from scratch:

validir generate {DIRECTORY}

For more information about any command line options, call validir --help.


Installation

Via Package Manager

python3 -m pip install validir

Via Source

To install locally, clone this repository and run the following:

git clone https://github.com/danielmohansahu/validir.git
python3 -m pip install ./validir

Installation verification is done via tox. To run the test suite:

# from within validir directory
tox

Errata

PEP8 checks:

pycodestyle --ignore=E201,E202,E203,E266 --max-line-length=100 --indent-size=2 .

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

validir-0.1.0.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

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

validir-0.1.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: validir-0.1.0.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for validir-0.1.0.tar.gz
Algorithm Hash digest
SHA256 72bdca243831ccbfa55694950c933f73786351bbddbacabdfea43905c0154f6b
MD5 4968e90215a74ea6138d50bd6b4de952
BLAKE2b-256 a2f416d4297469d36fd64acf4aa35ec78d16b395e4818016664a213b2845d874

See more details on using hashes here.

File details

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

File metadata

  • Download URL: validir-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for validir-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 792bb1f84cd24de99ecf955b009c00c0c10ac3bffaaad1d10f0eeab6d75be495
MD5 4c983a216bbddd65a4856cea8aaf5354
BLAKE2b-256 fe77ae21e1460734ac0c2bb26799f8809bc06b985734edb2d9ed333b413b82bd

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