• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.github/H30-Dec-2020-13580

docs/H03-May-2022-2,0781,220

examples/H30-Dec-2020-118

pykwalify/H30-Dec-2020-3,0042,346

tests/H30-Dec-2020-5,4584,827

.gitignoreH A D30-Dec-2020494 5041

.travis.ymlH A D30-Dec-2020644 3530

LICENSEH A D30-Dec-20201 KiB2319

MANIFEST.inH A D30-Dec-2020232 1010

MakefileH A D30-Dec-20201.3 KiB4838

README.mdH A D30-Dec-20204.2 KiB9662

conftest.pyH A D30-Dec-202023 42

pytest.iniH A D30-Dec-2020142 65

setup.cfgH A D30-Dec-202063 64

setup.pyH A D30-Dec-20201.3 KiB4744

tox.iniH A D30-Dec-2020584 1713

README.md

1# pyKwalify
2
3YAML/JSON validation library
4
5This framework is a port with a lot of added functionality of the Java version of the framework kwalify that can be found at http://www.kuwata-lab.com/kwalify/
6
7The original source code can be found at http://sourceforge.net/projects/kwalify/files/kwalify-java/0.5.1/
8
9The source code of the latest release that has been used can be found at https://github.com/sunaku/kwalify. Please note that source code is not the original authors code but a fork/upload of the last release available in Ruby.
10
11The schema this library is based on and extended from: http://www.kuwata-lab.com/kwalify/ruby/users-guide.01.html#schema
12
13
14# Usage
15
16Create a data file. `Json` and `Yaml` formats are both supported.
17
18```yaml
19- foo
20- bar
21```
22
23Create a schema file with validation rules.
24
25```yaml
26type: seq
27sequence:
28  - type: str
29```
30
31Run validation from cli.
32
33```bash
34pykwalify -d data.yaml -s schema.yaml
35```
36
37
38## Examples
39
40The documentation describes in detail how each keyword and type works and what is possible in each case.
41
42But there is a lot of real world examples that can be found in the test data/files. It shows a lot of examples of how all keywords and types work in practice and in combination with each other.
43
44The files can be found here and show both schema/data combinations that will work and that will fail.
45
46 - `tests/files/success/`
47 - `tests/files/fail/`
48 - `tests/files/partial_schemas/`
49
50
51# YAML parser
52
53`ruamel.yaml` is the default YAMl parser installed with pykwalify.
54
55Ruamel.yaml is more supported in the yaml 1.2 spec and is more actively developed.
56
57Depending on how both libraries are developed, this can change in the future in any major update.
58
59
60
61## UTF-8 and data encoding
62
63If you have problems with unicode values not working properly when running pykwalify on Python 3.6x then try to add this environment variable to your execution:
64
65```
66PYTHONIOENCODING=UTF-8 pykwalify ...
67```
68
69and it might help to force UTF-8 encoding on all string objects. If this does not work please open up an issue with your schema and data that can be used to track down the problem in the source code.
70
71
72# Project details
73
74|   |   |
75|---|---|
76| python support         | 3.6, 3.7, 3.8, 3.9 |
77| Source                 | https://github.com/Grokzen/pykwalify |
78| Docs (Latest release)  | http://pykwalify.readthedocs.io/en/master/ |
79| Docs (Unstable branch) | http://pykwalify.readthedocs.io/en/unstable/ |
80| Gitter (Free Chat)     | [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Grokzen/pykwalify?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) |
81| Changelog              | https://github.com/Grokzen/pykwalify/blob/unstable/docs/release-notes.rst |
82| Upgrade instructions   | https://github.com/Grokzen/pykwalify/blob/unstable/docs/upgrade-instructions.rst |
83| Issues                 | https://github.com/Grokzen/pykwalify/issues |
84| Travis (master)        | [![Build Status](https://travis-ci.org/Grokzen/pykwalify.svg?branch=master)](https://travis-ci.org/Grokzen/pykwalify) https://travis-ci.org/Grokzen/pykwalify |
85| Travis (unstable)      | [![Build Status](https://travis-ci.org/Grokzen/pykwalify.svg?branch=unstable)](https://travis-ci.org/Grokzen/pykwalify) https://travis-ci.org/Grokzen/pykwalify |
86| Test coverage          | [![Coverage Status](https://coveralls.io/repos/Grokzen/pykwalify/badge.png?branch=master)](https://coveralls.io/r/Grokzen/pykwalify) https://coveralls.io/github/Grokzen/pykwalify |
87| pypi                   | https://pypi.python.org/pypi/pykwalify/ |
88| Open Hub               | https://www.openhub.net/p/pykwalify |
89| License                | `MIT` https://github.com/Grokzen/pykwalify/blob/unstable/docs/license.rst |
90| Copyright              | `Copyright (c) 2013-2017 Johan Andersson` |
91| git repo               | `git clone git@github.com:Grokzen/pykwalify.git` |
92| install stable         | `pip install pykwalify` |
93| install dev            | `$ git clone git@github.com:Grokzen/pykwalify.git pykwalify`<br>`$ cd ./pykwalify`<br>`$ virtualenv .venv`<br>`$ source .venv/bin/activate`<br>`$ pip install -r dev-requirements.txt`<br>`$ pip install -e .` |
94| required dependencies  | `docopt >= 0.6.2`<br> `python-dateutil >= 2.4.2` |
95| supported yml parsers  | `ruamel.yaml >= 0.11.0` |
96