pywcmp


Namepywcmp JSON
Version 0.8.4 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-03-31 12:40:58
maintainerTom Kralidis
docs_urlNone
authorTom Kralidis
requires_pythonNone
licenseApache Software License
keywords wmo metadata wis test suite
VCS
bugtrack_url
requirements beautifulsoup4 click jsonschema pyspellchecker python-dateutil pywis-topics
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 [WCMP 2 (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 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
```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/84/a4/fa94489e23bca5c143ea8f6b3730bc6c302bd614fe888e6f6c8580bd4b8b/pywcmp-0.8.4.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 [WCMP 2 (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 WCMP 2 metadata against abstract test suite (file on disk)\npywcmp ets validate /path/to/file.json\n\n# validate WCMP 2 metadata against abstract test suite (URL)\npywcmp ets validate https://example.org/path/to/file.json\n\n# validate WCMP 2 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.8.4",
    "project_urls": {
        "Homepage": "https://github.com/wmo-im/pywcmp"
    },
    "split_keywords": [
        "wmo",
        "metadata",
        "wis",
        "test",
        "suite"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "91b9272d024f31d1e5815f5b945e6587ba6a43850fbd2a3548786e5007b42401",
                "md5": "0d0e969ca033e5e9ae5c91ef16aff7d5",
                "sha256": "adccc8b064c95c38c01800b262f4254ad946569c0c8826384aac284d000561d3"
            },
            "downloads": -1,
            "filename": "pywcmp-0.8.4-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0d0e969ca033e5e9ae5c91ef16aff7d5",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 23490,
            "upload_time": "2024-03-31T12:40:56",
            "upload_time_iso_8601": "2024-03-31T12:40:56.614537Z",
            "url": "https://files.pythonhosted.org/packages/91/b9/272d024f31d1e5815f5b945e6587ba6a43850fbd2a3548786e5007b42401/pywcmp-0.8.4-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "84a4fa94489e23bca5c143ea8f6b3730bc6c302bd614fe888e6f6c8580bd4b8b",
                "md5": "f5d1fed5b55b43b6d010e77df475f372",
                "sha256": "28e25f5f84f06853213cd6bf57d1950535b1e98c8c5a8480e83e61faf0cc10e1"
            },
            "downloads": -1,
            "filename": "pywcmp-0.8.4.tar.gz",
            "has_sig": false,
            "md5_digest": "f5d1fed5b55b43b6d010e77df475f372",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 17904,
            "upload_time": "2024-03-31T12:40:58",
            "upload_time_iso_8601": "2024-03-31T12:40:58.549297Z",
            "url": "https://files.pythonhosted.org/packages/84/a4/fa94489e23bca5c143ea8f6b3730bc6c302bd614fe888e6f6c8580bd4b8b/pywcmp-0.8.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-31 12:40:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "wmo-im",
    "github_project": "pywcmp",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "beautifulsoup4",
            "specs": []
        },
        {
            "name": "click",
            "specs": []
        },
        {
            "name": "jsonschema",
            "specs": [
                [
                    ">",
                    "4.19"
                ]
            ]
        },
        {
            "name": "pyspellchecker",
            "specs": []
        },
        {
            "name": "python-dateutil",
            "specs": []
        },
        {
            "name": "pywis-topics",
            "specs": []
        }
    ],
    "lcname": "pywcmp"
}
        
Elapsed time: 0.23938s