Skip to main content

A Python implementation of the test suite for WMO Core Metadata Profile

Project description

Build Status

WMO Core Metadata Profile Test Suite

This library implements validation against WMO Core Metadata Profile 1.3, specifically Part 2, Section 2.

Installation

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 build
python3 setup.py install

Running

From command line:

# fetch version
pywcmp --version

# abstract test suite

# validate metadata against abstract test suite (file on disk)
pywcmp ats validate --file /path/to/file.xml

# validate metadata against abstract test suite (URL)
pywcmp ats validate --url http://example.org/path/to/file.xml

# adjust debugging messages (CRITICAL, ERROR, WARNING, INFO, DEBUG) to stdout
pywcmp ats validate --url http://example.org/path/to/file.xml --verbosity DEBUG

# write results to logfile
pywcmp ats validate --url http://example.org/path/to/file.xml --verbosity DEBUG --logfile /tmp/foo.txt

# key performance indicators # note: running KPIs automatically runs the ats
pywcmp kpi validate --url http://example.org/path/to/file.xml --verbosity DEBUG

Using the API

# test a file on disk
>>> from lxml import etree
>>> from pywcmp.ats import ats
>>> exml = etree.parse('/path/to/file.xml')
>>> ts = ats.WMOCoreMetadataProfileTestSuite13(exml)
>>> ts.run_tests()  # raises ValueError error stack on exception
# test a URL
>>> from urllib2 import urlopen
>>> from StringIO import StringIO
>>> content = StringIO(urlopen('http://....').read())
>>> exml = etree.parse(content)
>>> ts = ats.WMOCoreMetadataProfileTestSuite13(exml)
>>> ts.run_tests()  # raises ValueError error stack on exception
# handle ats.TestSuiteError
# ats.TestSuiteError.errors is a list of errors
>>> try:
...    ts.run_tests()
... except ats.TestSuiteError as err:
...    print('\n'.join(err.errors))
>>> ...
>>> from pywcmp.kpi import WMOCoreMetadataProfileKeyPerformanceIndicators
>>> kpis = WMOCoreMetadataProfileKeyPerformanceIndicators(exml)
>>> kpis['totals']

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

python3 setup.py sdist bdist_wheel --universal
twine upload dist/*

Code Conventions

PEP8

Issues

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

Contact

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pywcmp-0.2.0.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

pywcmp-0.2.0-py2.py3-none-any.whl (15.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pywcmp-0.2.0.tar.gz.

File metadata

  • Download URL: pywcmp-0.2.0.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.6

File hashes

Hashes for pywcmp-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b5f2c85e3968381804c30499a34373d1a7cfe896c3d33e36fc1b8df757ef9fad
MD5 30e6c1bc364f3d24edc7c053ed86a23e
BLAKE2b-256 7de9a97490d923302f437c6cef6449f632cb225ad5c36ceefba2412c5adb5cc9

See more details on using hashes here.

File details

Details for the file pywcmp-0.2.0-py2.py3-none-any.whl.

File metadata

  • Download URL: pywcmp-0.2.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.6

File hashes

Hashes for pywcmp-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 97c130569a94847fa45991c51e98147f291da333fd24eabb62816b4ff84849ea
MD5 7344af063ad0f4beac4d3b046cec909d
BLAKE2b-256 f4d1d5b60ec1923c7cac71de93c6ba2f559dbbfe1b86ef68c29113b7aa6554cd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page