This is a library that provides simple type checking for YAML.
Project description
Index
-
English Document
English Document <- Here
-
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.
"!ChildValue": FreeDict
"@Author":
"@Summary": Author of the book.
"!ChildValue": Str
"@PublishYear":
"@Summary": The year of the publishment.
"!ChildValue": Int
"@Country":
"@Summary": The author's native language.
"!ChildValue": 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.ConfigurationYamlError: `@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
- test caseを全てのdata型に拡大。
-
!Floatのtest. -
!AnnoMapのtest. -
!FreeMapのtest.
Ideas
- key01
- key02
- key03
と
- {key01:value01}
- {key02:value02}
- {key03:value03}
を等価に扱うsystemが欲しい。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file anoy-0.2.1a1.tar.gz.
File metadata
- Download URL: anoy-0.2.1a1.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99a703137ad937a53a22de68fe446de420895bbda646c403ae1d48d918bd8125
|
|
| MD5 |
0965af3e6b4d9e279d39cf3c5c065f02
|
|
| BLAKE2b-256 |
49185a8e4d9c4889a2a4bec1c219611a70f1f7c7411de72051fb293d94c56e72
|
File details
Details for the file anoy-0.2.1a1-py3-none-any.whl.
File metadata
- Download URL: anoy-0.2.1a1-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
111efa476ec5a70bae0a2f10e7a3f771102bcc93628313fd50518659145a547d
|
|
| MD5 |
b7118bb71e245f27b8c50e7e81f5f1e5
|
|
| BLAKE2b-256 |
d2b6b6f6e1da64449b7da8c64a0991b72fc1dc7ca56e4452a7dd66e96ad998b9
|