A Python implementation of the test suite for WIGOS Metadata Record
Project description
pywmdr
WIGOS Metadata Record Test Suite
pywmdr provides validation and quality assessment capabilities for the WIGOS Metadata Record (WMDR2) standard.
- validation against WMDR2, specifically Annex A: Conformance Class Abstract Test Suite), implementing an executable test suite against the ATS
Installation
pip
Install latest stable version from PyPI.
pip3 install pywmdr
From source
Install latest development version.
python3 -m venv pywmdr
cd pywmdr
. bin/activate
git clone https://github.com/wmo-im/pywmdr.git
cd pywmdr
pip3 install .
Running
From command line:
# fetch version
pywmdr --version
# sync supporting configuration bundle (schemas, topics, etc.)
pywmdr bundle sync
# abstract test suite
# validate WMDR2 metadata against abstract test suite (file on disk)
pywmdr ets validate /path/to/file.json
# validate WMDR2 metadata against abstract test suite (URL)
pywmdr ets validate https://example.org/path/to/file.json
# validate WMDR2 metadata against abstract test suite (URL), but turn JSON Schema validation off
pywmdr ets validate https://example.org/path/to/file.json --no-fail-on-schema-validation
# adjust debugging messages (CRITICAL, ERROR, WARNING, INFO, DEBUG) to stdout
pywmdr ets validate https://example.org/path/to/file.json --verbosity DEBUG
# write results to logfile
pywmdr ets validate https://example.org/path/to/file.json --verbosity DEBUG --logfile /tmp/foo.txt
Using the API
>>> # test a file on disk
>>> import json
>>> from pywmdr.wmdr2.ets import WIGOSMetadataRepresentationTestSuite2
>>> from pywmdr.errors import TestSuiteError
>>> with open('/path/to/file.json') as fh:
... data = json.load(fh)
>>> # test ETS
>>> ts = WMOCoreMetadataProfileTestSuite2(datal)
>>> ts.run_tests()
>>> ts.raise_for_status() # raises pywmdr.errors.TestSuiteError on exception with list of errors captured in .errors property
>>> # test a URL
>>> from urllib2 import urlopen
>>> from StringIO import StringIO
>>> content = StringIO(urlopen('https://....').read())
>>> data = json.loads(content)
>>> ts = WMOCoreMetadataProfileTestSuite2(data)
>>> ts.run_tests()
>>> ts.raise_for_status() # raises pywmdr.errors.TestSuiteError on exception with list of errors captured in .errors property
Development
python3 -m venv pywmdr
cd pywmdr
source bin/activate
git clone https://github.com/World-Meteorological-Organization/pywmdr.git
pip3 install .
pip3 install ".[dev]"
Running tests
pytest tests
Releasing
# create release (x.y.z is the release version)
vi pyproject.toml # update [project]/version
git commit -am 'update release version x.y.z'
git push origin master
git tag -a x.y.z -m 'tagging release version x.y.z'
git push --tags
# upload to PyPI
rm -fr build dist *.egg-info
python3 -m build
twine upload dist/*
# publish release on GitHub (https://github.com/wmo-im/pywmdr/releases/new)
# bump version back to dev
vi pyproject.toml # update [project]/version
git commit -am 'back to dev'
git push origin master
Code Conventions
Issues
Issues are managed at https://github.com/wmo-im/pywmdr/issues
Contact
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 pywmdr-0.2.dev0.tar.gz.
File metadata
- Download URL: pywmdr-0.2.dev0.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e967a6c91c147f6ba9897d77e2bb3d5338a4d8332318f9645791d9466e4c559
|
|
| MD5 |
06946bae2a506f6015ce4e533c68163d
|
|
| BLAKE2b-256 |
9c9fb6809d3595a38e2ebc830ca37e9c191298bf34d23a7bc243a769cbe695cc
|
File details
Details for the file pywmdr-0.2.dev0-py3-none-any.whl.
File metadata
- Download URL: pywmdr-0.2.dev0-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7dc40a4c561199d4fc1413f886d72f9e72ddcc170a8a79fb3d05127a69626ada
|
|
| MD5 |
142b0c06ab83cfee271027f681010274
|
|
| BLAKE2b-256 |
aff3cf712eaa0f5ca0d45b1f1da069e3ec3cebfe033646f6c366d5445a3fefc7
|