pywcmp
WMO Core Metadata Profile Test Suite
pywcmp provides validation and quality assessment capabilities for the WMO WIS Core Metadata Profile (WCMP).
- validation against WCMP 2 (draft), specifically Annex A: Conformance Class Abstract Test Suite, implementing an executable test suite against the ATS
- quality assessement against the WCMP Key Performance Indicators
Installation
pip
Install latest stable version from PyPI.
pip3 install pywcmp
From source
Install latest development version.
python3 -m venv pywcmp
cd pywcmp
. bin/activate
git clone https://github.com/wmo-im/pywcmp.git
cd pywcmp
pip3 install -r requirements.txt
python3 setup.py install
Running
From command line:
# fetch version
pywcmp --version
# sync supporting configuration bundle (schemas, topics, etc.)
pywcmp bundle sync
# abstract test suite
# validate WCMP 2 metadata against abstract test suite (file on disk)
pywcmp ets validate /path/to/file.json
# validate WCMP 2 metadata against abstract test suite (URL)
pywcmp ets validate https://example.org/path/to/file.json
# validate WCMP 2 metadata against abstract test suite (URL), but turn JSON Schema validation off
pywcmp ets validate https://example.org/path/to/file.json --no-fail-on-schema-validation
# adjust debugging messages (CRITICAL, ERROR, WARNING, INFO, DEBUG) to stdout
pywcmp ets validate https://example.org/path/to/file.json --verbosity DEBUG
# write results to logfile
pywcmp ets validate https://example.org/path/to/file.json --verbosity DEBUG --logfile /tmp/foo.txt
# key performance indicators
# all key performance indicators at once
pywcmp kpi validate https://example.org/path/to/file.json --verbosity DEBUG
# all key performance indicators at once, but turn ETS validation off
pywcmp kpi validate https://example.org/path/to/file.json --no-fail-on-ets --verbosity DEBUG
# all key performance indicators at once, in summary
pywcmp kpi validate https://example.org/path/to/file.json --verbosity DEBUG --summary
# selected key performance indicator
pywcmp kpi validate --kpi title /path/to/file.json -v INFO
Using the API
>>> # test a file on disk
>>> import json
>>> from pywcmp.wcmp2.ets import WMOCoreMetadataProfileTestSuite2
>>> with open('/path/to/file.json') as fh:
... data = json.load(fh)
>>> # test ETS
>>> ts = WMOCoreMetadataProfileTestSuite2(datal)
>>> ts.run_tests() # raises ValueError error stack on exception
>>> # 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() # raises ValueError error stack on exception
>>> # handle pywcmp.errors.TestSuiteError
>>> # pywcmp.errors.TestSuiteError.errors is a list of errors
>>> try:
... ts.run_tests()
... except pywcmp.errors.TestSuiteError as err:
... print('\n'.join(err.errors))
>>> ...
>>> # test KPI
>>> from pywcmp.kpi import WMOCoreMetadataProfileKeyPerformanceIndicators
>>> kpis = WMOCoreMetadataProfileKeyPerformanceIndicators(data)
>>> results = kpis.evaluate()
>>> results['summary']
Development
python3 -m venv pywcmp
cd pywcmp
source bin/activate
git clone https://github.com/wmo-im/pywcmp.git
pip3 install -r requirements.txt
pip3 install -r requirements-dev.txt
python3 setup.py install
Running tests
# via setuptools
python3 setup.py test
# manually
python3 tests/run_tests.py
Releasing
# create release (x.y.z is the release version)
vi pywcmp/__init__.py # update __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 setup.py sdist bdist_wheel --universal
twine upload dist/*
# publish release on GitHub (https://github.com/wmo-im/pywcmp/releases/new)
# bump version back to dev
vi pywcmp/__init__.py # update __version__
git commit -am 'back to dev'
git push origin master
Code Conventions
Issues
Issues are managed at https://github.com/wmo-im/pywcmp/issues
Contact
Metadata
Release files for pywcmp 0.8.3
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 | |
|---|---|---|---|---|
| pywcmp-0.8.3.tar.gz | 17.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pywcmp-0.8.3-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 41.2 kB
Release files / pywcmp-0.8.3.tar.gz
| Download URL | pywcmp-0.8.3.tar.gz |
|---|---|
| Size | 17.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aba83c6a46604095c0b69d6215b5e234ba7cb603b4c33b22d5b9dd2eee8db275
|
|
BLAKE2b-256 checksum How to use checksums |
e29c271e4d702cf759d808ceea0b0d029cd0320e1e0bea35608bd40e9c418fc9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/1.1.3 pkginfo/1.9.6 requests/2.28.2 requests-toolbelt/0.8.0 tqdm/4.64.1 CPython/3.7.12
|
Release files / pywcmp-0.8.3-py2.py3-none-any.whl
| Download URL | pywcmp-0.8.3-py2.py3-none-any.whl |
|---|---|
| Size | 23.4 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
7bef7665dc269c4d2cd969f8889d0d06d02691690b8a26132e34e7ce59ef643a
|
|
BLAKE2b-256 checksum How to use checksums |
add357b0eeebb30f1bb78e9eee2324ccc975506805ca86d7875386d0a9ab3c5b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/1.1.3 pkginfo/1.9.6 requests/2.28.2 requests-toolbelt/0.8.0 tqdm/4.64.1 CPython/3.7.12
|
Security for pywcmp 0.8.3
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.