Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

pywmdr

Build Status

WIGOS Metadata Record Test Suite

pywmdr provides validation and quality assessment capabilities for the WIGOS Metadata Record (WMDR2) standard.

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

PEP8

Issues

Issues are managed at https://github.com/wmo-im/pywmdr/issues

Contact

Metadata

Release files for pywmdr 0.2.dev5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pywmdr 0.2.dev5
File Size Uploaded
pywmdr-0.2.dev5.tar.gz 18.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pywmdr 0.2.dev5
File Interpreter ABI Platform
pywmdr-0.2.dev5-py3-none-any.whl Python 3 none any Details

Total release size: 40.9 kB

Release files / pywmdr-0.2.dev5.tar.gz

Download URL pywmdr-0.2.dev5.tar.gz
Size 18.0 kB
Tags Source
SHA-256 checksum
How to use checksums
c05bb6655ccbcf31d0d8685a89d581e91d5f4e7d92c48f1c06cb44c53652895c
BLAKE2b-256 checksum
How to use checksums
ad3c73ae68fc052aadf25cd5bddc96da735ae55c31bfb08d5bf5a43f2b453576
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.dev5-py3-none-any.whl

Download URL pywmdr-0.2.dev5-py3-none-any.whl
Size 22.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e69547dbe773381c96d3cdd02bdb567fc8b3cfaaec2f17654d97d49fa9a6297e
BLAKE2b-256 checksum
How to use checksums
a5a5e17d58323c8461c7fc693e2775614d402d55c0c97cbc20e0276c75f07973
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page