Skip to main content

This is a library that provides simple type checking for YAML.

Project description

Index

  • English Document

    English Document <- Here

  • Japanese Document

    Japanese Document

  • Annotation YAML(ANOY)

    A YAML file that allows type checking for Map types.

    More about ANOY

  • Configuration YAML(Config YAML)

    A YAML file that defines the data types usable in Annotation YAML.

    More about Config YAML

  • ANOY CLI

    A CLI application that verifies whether Annotation YAML adheres to the data type defined in Configuration YAML.

    More about ANOY CLI

Introduction

YAML maps often become nested and complex.

And these requests have come up.

  • Detecting typos in map keys.
  • Verifying the data type of map values.
  • Ensuring the map's nested structure is appropriate.

This library satisfies these requests.

Installing

pip install anoy

Package Dependencies

The following packages may not work properly if they are not installed:

  • PyYAML: Most popular YAML parser for Python.

Usage

library_config.yaml

"@Books":
  "@Summary": List the book titles.
  "!Child": "!FreeMap"
"@Author":
  "@Summary": Author of the book.
  "!Child": "!Str"
"@PublishYear":
  "@Summary": The year of the publishment.
  "!Child": "!Int"
"@Country":
  "@Summary": The author's native language.
  "!Child": "!Str"

valid_library.yaml:

"@Books":
  "Alice's Adventures in Wonderland":
    "@Author": Lewis Carroll
    "@PublishYear": 1865
    "@Country": UK
  "The Little Prince":
    "@Author": Antonie de Saint-Exupéry
    "@PublishYear": 1945
    "@Country": France
  "Harry Potter":
    "@Author": J.K.Rowling
    "@PublishYear": 1997
    "@Country": UK

Use the anoy command to verify data types.

If data type issues are not found, it outputs nothing.

>>> anoy library_config.yaml library.yaml
>>> 

If you mistyped @Auther as @Auther.

invalid_library.yaml:

"@Books":
  "Alice's Adventures in Wonderland":
    "@Auther": Lewis Carroll
    "@PublishYear": 1865
    "@Country": UK
  "The Little Prince":
    "@Auther": Antonie de Saint-Exupéry
    "@PublishYear": 1945
    "@Country": France
  "Harry Potter":
    "@Auther": J.K.Rowling
    "@PublishYear": 1997
    "@Country": UK

When there is an issue with the annotation YAML, anoy outputs as follows.

>>> anoy library_config.yaml library.yaml
>>> Traceback (most recent call last):
    ... (omission) ...
    src.anoyModule.anoyErrors.ConfigYamlError: `@Auther` is not defined.

For Developers

Testing

This project uses pytest.

If you want to test, put in following command.

pytest tests\unit\test_dictTraversal.py

Next To Do

  • READMEの詳細documentの更新。

Ideas

- key01
- key02
- key03

- {key01:value01}
- {key02:value02}
- {key03:value03}

を等価に扱うsystemが欲しい。

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

anoy-0.3.3.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

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

anoy-0.3.3-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file anoy-0.3.3.tar.gz.

File metadata

  • Download URL: anoy-0.3.3.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.3

File hashes

Hashes for anoy-0.3.3.tar.gz
Algorithm Hash digest
SHA256 2fc095cbe8765b8d6adf29d97e5ebc8ec460ed333c58297fe9dd9b9cf517618f
MD5 97a4516ef2c33b43d97c7ddd4208be35
BLAKE2b-256 8f075e74c0175a2c4c7d56ad76380ddc7c3f6cb9c4a57a2351aafb8e0bdc5709

See more details on using hashes here.

File details

Details for the file anoy-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: anoy-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.3

File hashes

Hashes for anoy-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b7443fb9367f7e7bd7b5ac0dc3cbe82b54bf0f1748d5abcc8e34bebe3857bb8e
MD5 679827be91e6326a9a9951152c847fa5
BLAKE2b-256 7a7cb07cc3a3ac3843941e6b5dbfa8eed5bbb3857ffee3c2291e7c2c5c06fb7d

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