This release is a pre-release and may not be stable for production use.
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
# migrate WMDR1 to WMDR2 (file on disk)
pywmdr migrate /path/to/file.xml --verbosity DEBUG
# migrate WMDR1 to WMDR2 (URL)
pywmdr migrate https://example.org/path/to/file.xml --verbosity DEBUG
# migrate WMDR1 to WMDR2 (URL), write results to file
pywmdr migrate https://example.org/path/to/file.xml --output file.json
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
Metadata
Release files for pywmdr 0.2.dev12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pywmdr-0.2.dev12.tar.gz | 26.1 kB | Without provenance | Details for pywmdr-0.2.dev12.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pywmdr-0.2.dev12-py3-none-any.whl | Python 3 | none | any | Details for pywmdr-0.2.dev12-py3-none-any.whl |
Total release size: 56.9 kB
Release files / pywmdr-0.2.dev12.tar.gz
| Download URL | pywmdr-0.2.dev12.tar.gz |
|---|---|
| Size | 26.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6c05f2e279a76f75f439b40ecc422c9cc1d2e0e345379ca615fc97d1ae891b54
|
|
BLAKE2b-256 checksum How to use checksums |
bf0e7b6e581c7ead5e5c708423a6797279cb70ff4316b1cfb9be7e09f917adcb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / pywmdr-0.2.dev12-py3-none-any.whl
| Download URL | pywmdr-0.2.dev12-py3-none-any.whl |
|---|---|
| Size | 30.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7072108059f44e5e126e1293e883521af47ba71f5acd980c0fb76e855a3b4720
|
|
BLAKE2b-256 checksum How to use checksums |
c66195d534ae20a75681035e6991370000c7c072c6b3b92866405c4866a2f757
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Security for pywmdr 0.2.dev12
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.