https://github.com/hpcflow/valida
Comprehensive validation library for nested data structures.
https://github.com/hpcflow/valida
Last synced: 4 months ago
JSON representation
Comprehensive validation library for nested data structures.
- Host: GitHub
- URL: https://github.com/hpcflow/valida
- Owner: hpcflow
- License: mit
- Created: 2022-01-10T22:10:59.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-11-14T14:09:46.000Z (over 1 year ago)
- Last Synced: 2025-01-18T07:17:00.529Z (over 1 year ago)
- Language: Python
- Size: 272 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README

**Validation for nested data structures**
[](https://pypi.org/project/valida)

[](https://pypi.org/project/valida)
[](https://github.com/hpcflow/valida/blob/main/LICENSE)
[](https://zenodo.org/badge/latestdoi/446597552)
## Installing
`pip install valida`
## A simple example
```python
from valida import Data, Value, Rule
# Define some data that we want to validate:
my_data = Data({'A': 1, 'B': [1, 2, 3], 'C': {'c1': 8.2, 'c2': 'hello'}})
# Define a rule as a path within the data and a condition at that path:
rule = Rule(
path=('C', 'c2'),
condition=Value.dtype.equal_to(str),
)
# Test the rule
rule.test(my_data).is_valid # `True` => The rule tested successfully
```
## Acknowledgements
Valida was developed using funding from the [LightForm](https://lightform.org.uk/) EPSRC programme grant ([EP/R001715/1](https://gow.epsrc.ukri.org/NGBOViewGrant.aspx?GrantRef=EP/R001715/1))
