A standalone JSON Schema based validator for XDI files used to save XAS data aiming to be fully compliant with the XDI/1.0 specification..
Project description
XDI-Validator
What is it?
XDI-Validator is a standalone JSON Schema based validator for XDI files. XDI (*.xdi) is a format used to save XAS data. This validator aiming to be fully compliant with the XDI/1.0 specification, as detailed in the documents XAS Data Interchange Format Draft Specification, version 1.0 and Dictionary of XAS Data Interchange Metadata.
Usage
As simple as it gets :
# import the functionality from the module
from xdi_validator import validate, XDIEndOfHeaderMissingError
# open the xdi file
with open('filename.xdi', 'r') as xdi_document:
# Validate the file. If there is no end-of-header token
# an exception is raised
try:
xdi_errors, xdi_dict = validate(xdi_document)
except XDIEndOfHeaderMissingError as ex:
print(ex.message)
# check if there are errors
if xdi_errors:
print('XDI is invalid!')
for error in xdi_errors:
print(error)
else:
print('XDI is valid!')
print(xdi_dict)
Note: Sure, users can also to use the library for parsing and converting XDI files into json.
How to install?
XDI-Validator is available in PyPI. The project page is https://pypi.org/project/xdi-validator/.
To install XDI-Validator on your development environment, just issue the command:
pip install xdi-validator
To build and install from the source code do:
- Clone the repository:
git clone https://github.com/AAAlvesJr/XDI-Validator.git - Go the project directory:
cd XDI-Validator - Build the package:
python3 -m build - Install the wheel:
pip install dist/xdi_validator-{VERSION}-py3-none-any.whl
where VERSION is the package version.
Source code
Access to the source code is granted via the project GitHub repository at the url https://github.com/AAAlvesJr/XDI-Validator.
Dependencies
XDI-Validator's only external dependency is jsonschema package.
How to contribute
Please, submit a pull request. PR adding new features should implement the correspondind unit test. Aside that, please, feel free to open issues for bugs and features requests.
License
XDI-Validator is available under the MIT license. See the LICENSE file for more info.
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 xdi_validator-1.0.4b0.tar.gz.
File metadata
- Download URL: xdi_validator-1.0.4b0.tar.gz
- Upload date:
- Size: 16.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11b13e1e9be9f687d5ebec38cd14c9873527e6bbd0034c99105c27148cd05b1d
|
|
| MD5 |
e43740390910fdeb76195a18b42bca79
|
|
| BLAKE2b-256 |
160dcab11dadfd5b5c9194a01af73854354db04839a6ded3274450156bc2c14b
|
File details
Details for the file xdi_validator-1.0.4b0-py3-none-any.whl.
File metadata
- Download URL: xdi_validator-1.0.4b0-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6058aa078d18aa34f06e1fa4b8f576e65ee44943ed3b0e9c8864a2120ed61554
|
|
| MD5 |
c76aa21739f00d349e15a5717d0e3901
|
|
| BLAKE2b-256 |
4987f3df08e106575c4a8f6714a11a38fe01e626a7b49c3fe827573530ae20e1
|