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.0.1.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.0.1-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: validir-0.0.1.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.0.1.tar.gz
Algorithm Hash digest
SHA256 1e84afeb1245a464b7da121e7d746e283b6b74b05126d4d1e66951c6e4f139c2
MD5 67917e618d60743a74a789c7b352ca46
BLAKE2b-256 dbc92a7de3caaa6ba9103233511b7a5835faf4f4aa11a79e3839c502a0f821ad

See more details on using hashes here.

File details

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

File metadata

  • Download URL: validir-0.0.1-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.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cfdd1a753f660adbf766b88a6c6488c624b4fb68b528569da76805bf89dfbc5c
MD5 9253c2785bfbd4b94c912da4dd05eb4f
BLAKE2b-256 715c31256d5916d312d8cfe0a10ab2ca45ce2c78be4a1fa1149cd82e73adcc14

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