pywis-topics is a utility to work with the WIS2 Topic Hierarchy
The easiest way to install pywis-topics is via the Python pip utility:
pip3 install pywis-topics
- Python 3
- virtualenv
Dependencies are listed in requirements.txt. Dependencies are automatically installed during pywis-topics installation.
# setup virtualenv
python3 -m venv --system-site-packages pywis-topics
cd pywis-topics
source bin/activate
# clone codebase and install
git clone https://github.com/wmo-im/pywis-topics.git
cd pywis-topics
python3 setup.py install
First check pywis-topics was correctly installed
pywis-topics --version
# sync WTH bundle
pywis-topics bundle sync
# validate a WIS2 topic hierarchy
pywis-topics topic validate origin/a/wis2/ca-eccc-msc
# validate a WIS2 topic hierarchy in no-strict mode
pywis-topics topic validate --no-strict origin/a/wis2/fake-centre-id/data/core
# list children of a given WIS2 topic hierarchy level
pywis-topics topic list wis2/a
# validate a WIS2 topic hierarchy with wildcards (needs no-strict mode)
pywis-topics topic validate origin/a/wis2/+/data/core --no-strict
# validate a centre-id
pywis-topics centre-id 123
Python examples:
from pywis_topics.centre_id import CentreId
from pywis_topics.topics import TopicHierarchy
th = TopicHierarchy()
th.validate('origin/a/wis2/ca-eccc-msc/data/core')
th.list_children('origin/a/wis2')
th.validate('origin/a/wis2/fake-centre-id/data/core', strict=False)
th.validate('origin/a/wis2/+/data/#', strict=False)
cid = CentreId('ca-centre123')
cid.validate()
# install dev requirements
pip3 install -r requirements-dev.txt
# run tests like this:
python3 tests/run_tests.py
# or this:
python3 setup.py test
# create release (x.y.z is the release version)
vi pywis_topics/__init__.py # update __version__
git commit -am 'update release version x.y.z'
git push origin main
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/pywis-topics/releases/new)
# bump version back to dev
vi pywis_topics/__init__.py # update __version__
git commit -am 'back to dev'
git push origin main
All bugs, enhancements and issues are managed on GitHub.