pywcmp


Namepywcmp JSON
Version 0.10.1 PyPI version JSON
download
home_pagehttps://github.com/wmo-im/pywcmp
SummaryA Python implementation of the test suite for WMO Core Metadata Profile
upload_time2024-08-28 19:43:24
maintainerTom Kralidis
docs_urlNone
authorTom Kralidis
requires_pythonNone
licenseApache Software License
keywords wmo metadata wis test suite
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pywcmp

[![Build Status](https://github.com/wmo-im/pywcmp/workflows/build%20%E2%9A%99%EF%B8%8F/badge.svg)](https://github.com/wmo-im/pywcmp/actions)

# WMO Core Metadata Profile Test Suite

pywcmp provides validation and quality assessment capabilities for the [WMO
WIS](https://community.wmo.int/activity-areas/wis/wis-overview) Core Metadata
Profile (WCMP).

- validation against [WCMP2 (draft)](https://github.com/wmo-im/wcmp2), specifically [Annex A: Conformance Class Abstract Test Suite](https://wmo-im.github.io/wcmp2/standard/wcmp2-DRAFT.html#_conformance_class_abstract_test_suite_normative), implementing an executable test suite against the ATS
- quality assessement against the [WCMP Key Performance Indicators](https://community.wmo.int/activity-areas/wis/wis-metadata-kpis)

## Installation

### pip

Install latest stable version from [PyPI](https://pypi.org/project/pywcmp).

```bash
pip3 install pywcmp
```

### From source

Install latest development version.

```bash
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:
```bash
# fetch version
pywcmp --version

# sync supporting configuration bundle (schemas, topics, etc.)
pywcmp bundle sync

# abstract test suite

# validate WCMP2 metadata against abstract test suite (file on disk)
pywcmp ets validate /path/to/file.json

# validate WCMP2 metadata against abstract test suite (URL)
pywcmp ets validate https://example.org/path/to/file.json

# validate WCMP2 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
```pycon
>>> # 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

```bash
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

```bash
# via setuptools
python3 setup.py test
# manually
python3 tests/run_tests.py
```

## Releasing

```bash
# 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

[PEP8](https://www.python.org/dev/peps/pep-0008)

## Issues

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

## Contact

* [Tom Kralidis](https://github.com/tomkralidis)
* [Ján Osuský](https://github.com/josusky)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/wmo-im/pywcmp",
    "name": "pywcmp",
    "maintainer": "Tom Kralidis",
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": "tomkralidis@gmail.com",
    "keywords": "WMO Metadata WIS Test Suite",
    "author": "Tom Kralidis",
    "author_email": "tomkralidis@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c5/75/628d452191501bb5fa01a73e813d66f5e6fb5ee0df383a5231c8829d2e5e/pywcmp-0.10.1.tar.gz",
    "platform": "all",
    "description": "# pywcmp\n\n[![Build Status](https://github.com/wmo-im/pywcmp/workflows/build%20%E2%9A%99%EF%B8%8F/badge.svg)](https://github.com/wmo-im/pywcmp/actions)\n\n# WMO Core Metadata Profile Test Suite\n\npywcmp provides validation and quality assessment capabilities for the [WMO\nWIS](https://community.wmo.int/activity-areas/wis/wis-overview) Core Metadata\nProfile (WCMP).\n\n- validation against [WCMP2 (draft)](https://github.com/wmo-im/wcmp2), specifically [Annex A: Conformance Class Abstract Test Suite](https://wmo-im.github.io/wcmp2/standard/wcmp2-DRAFT.html#_conformance_class_abstract_test_suite_normative), implementing an executable test suite against the ATS\n- quality assessement against the [WCMP Key Performance Indicators](https://community.wmo.int/activity-areas/wis/wis-metadata-kpis)\n\n## Installation\n\n### pip\n\nInstall latest stable version from [PyPI](https://pypi.org/project/pywcmp).\n\n```bash\npip3 install pywcmp\n```\n\n### From source\n\nInstall latest development version.\n\n```bash\npython3 -m venv pywcmp\ncd pywcmp\n. bin/activate\ngit clone https://github.com/wmo-im/pywcmp.git\ncd pywcmp\npip3 install -r requirements.txt\npython3 setup.py install\n```\n\n## Running\n\nFrom command line:\n```bash\n# fetch version\npywcmp --version\n\n# sync supporting configuration bundle (schemas, topics, etc.)\npywcmp bundle sync\n\n# abstract test suite\n\n# validate WCMP2 metadata against abstract test suite (file on disk)\npywcmp ets validate /path/to/file.json\n\n# validate WCMP2 metadata against abstract test suite (URL)\npywcmp ets validate https://example.org/path/to/file.json\n\n# validate WCMP2 metadata against abstract test suite (URL), but turn JSON Schema validation off\npywcmp ets validate https://example.org/path/to/file.json --no-fail-on-schema-validation\n\n# adjust debugging messages (CRITICAL, ERROR, WARNING, INFO, DEBUG) to stdout\npywcmp ets validate https://example.org/path/to/file.json --verbosity DEBUG\n\n# write results to logfile\npywcmp ets validate https://example.org/path/to/file.json --verbosity DEBUG --logfile /tmp/foo.txt\n\n# key performance indicators\n\n# all key performance indicators at once\npywcmp kpi validate https://example.org/path/to/file.json --verbosity DEBUG\n\n# all key performance indicators at once, but turn ETS validation off\npywcmp kpi validate https://example.org/path/to/file.json --no-fail-on-ets --verbosity DEBUG\n\n# all key performance indicators at once, in summary\npywcmp kpi validate https://example.org/path/to/file.json --verbosity DEBUG --summary\n\n# selected key performance indicator\npywcmp kpi validate --kpi title /path/to/file.json -v INFO\n```\n\n## Using the API\n```pycon\n>>> # test a file on disk\n>>> import json\n>>> from pywcmp.wcmp2.ets import WMOCoreMetadataProfileTestSuite2\n>>> with open('/path/to/file.json') as fh:\n...     data = json.load(fh)\n>>> # test ETS\n>>> ts = WMOCoreMetadataProfileTestSuite2(datal)\n>>> ts.run_tests()  # raises ValueError error stack on exception\n>>> # test a URL\n>>> from urllib2 import urlopen\n>>> from StringIO import StringIO\n>>> content = StringIO(urlopen('https://....').read())\n>>> data = json.loads(content)\n>>> ts = WMOCoreMetadataProfileTestSuite2(data)\n>>> ts.run_tests()  # raises ValueError error stack on exception\n>>> # handle pywcmp.errors.TestSuiteError\n>>> # pywcmp.errors.TestSuiteError.errors is a list of errors\n>>> try:\n...    ts.run_tests()\n... except pywcmp.errors.TestSuiteError as err:\n...    print('\\n'.join(err.errors))\n>>> ...\n>>> # test KPI\n>>> from pywcmp.kpi import WMOCoreMetadataProfileKeyPerformanceIndicators\n>>> kpis = WMOCoreMetadataProfileKeyPerformanceIndicators(data)\n>>> results = kpis.evaluate()\n>>> results['summary']\n```\n\n## Development\n\n```bash\npython3 -m venv pywcmp\ncd pywcmp\nsource bin/activate\ngit clone https://github.com/wmo-im/pywcmp.git\npip3 install -r requirements.txt\npip3 install -r requirements-dev.txt\npython3 setup.py install\n```\n\n### Running tests\n\n```bash\n# via setuptools\npython3 setup.py test\n# manually\npython3 tests/run_tests.py\n```\n\n## Releasing\n\n```bash\n# create release (x.y.z is the release version)\nvi pywcmp/__init__.py  # update __version__\ngit commit -am 'update release version x.y.z'\ngit push origin master\ngit tag -a x.y.z -m 'tagging release version x.y.z'\ngit push --tags\n\n# upload to PyPI\nrm -fr build dist *.egg-info\npython3 setup.py sdist bdist_wheel --universal\ntwine upload dist/*\n\n# publish release on GitHub (https://github.com/wmo-im/pywcmp/releases/new)\n\n# bump version back to dev\nvi pywcmp/__init__.py  # update __version__\ngit commit -am 'back to dev'\ngit push origin master\n```\n\n## Code Conventions\n\n[PEP8](https://www.python.org/dev/peps/pep-0008)\n\n## Issues\n\nIssues are managed at https://github.com/wmo-im/pywcmp/issues\n\n## Contact\n\n* [Tom Kralidis](https://github.com/tomkralidis)\n* [J\u00e1n Osusk\u00fd](https://github.com/josusky)\n",
    "bugtrack_url": null,
    "license": "Apache Software License",
    "summary": "A Python implementation of the test suite for WMO Core Metadata Profile",
    "version": "0.10.1",
    "project_urls": {
        "Homepage": "https://github.com/wmo-im/pywcmp"
    },
    "split_keywords": [
        "wmo",
        "metadata",
        "wis",
        "test",
        "suite"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2f37facbdeb175efdcc471c195b780c92c749605d7d7e0be611f35fadbb93d55",
                "md5": "81804c136baef8b18fc1bda486b9a874",
                "sha256": "72ddad48327b961c13a782e9faabaa0cb94e9626848c80e5bb034b8cccbe22fa"
            },
            "downloads": -1,
            "filename": "pywcmp-0.10.1-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "81804c136baef8b18fc1bda486b9a874",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 24231,
            "upload_time": "2024-08-28T19:43:23",
            "upload_time_iso_8601": "2024-08-28T19:43:23.134206Z",
            "url": "https://files.pythonhosted.org/packages/2f/37/facbdeb175efdcc471c195b780c92c749605d7d7e0be611f35fadbb93d55/pywcmp-0.10.1-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c575628d452191501bb5fa01a73e813d66f5e6fb5ee0df383a5231c8829d2e5e",
                "md5": "12b61005a37f77e3f21d307e503565fa",
                "sha256": "e2c36bf949b334574b7709791afbb17f07803c9fc9e015f15dad1c11c5375615"
            },
            "downloads": -1,
            "filename": "pywcmp-0.10.1.tar.gz",
            "has_sig": false,
            "md5_digest": "12b61005a37f77e3f21d307e503565fa",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 18547,
            "upload_time": "2024-08-28T19:43:24",
            "upload_time_iso_8601": "2024-08-28T19:43:24.492101Z",
            "url": "https://files.pythonhosted.org/packages/c5/75/628d452191501bb5fa01a73e813d66f5e6fb5ee0df383a5231c8829d2e5e/pywcmp-0.10.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-28 19:43:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "wmo-im",
    "github_project": "pywcmp",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "pywcmp"
}
        
Elapsed time: 0.52627s