Skip to main content

pywis-topics is a utility to work with the WIS2 Topic Hierarchy

Project description

flake8 main

pywis-topics

Overview

pywis-topics is a utility to work with the WIS2 Topic Hierarchy

Installation

The easiest way to install pywis-topics is via the Python pip utility:

pip3 install pywis-topics

Requirements

Dependencies

Dependencies are listed in requirements.txt. Dependencies are automatically installed during pywis-topics installation.

Installing pywis-topics

# 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

Running

First check pywis-topics was correctly installed

pywis-topics --version

# sync WTH bundle
pywis-topics bundle sync

Listing and validation

# 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

Centre identification validation

# validate a centre-id
pywis-topics centre-id 123

Using the API

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()

Development

Running Tests

# install dev requirements
pip3 install -r requirements-dev.txt

# run tests like this:
python3 tests/run_tests.py

# or this:
python3 setup.py test

Releasing

# 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

Code Conventions

Bugs and Issues

All bugs, enhancements and issues are managed on GitHub.

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

pywis-topics-0.3.5.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

pywis_topics-0.3.5-py2.py3-none-any.whl (19.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pywis-topics-0.3.5.tar.gz.

File metadata

  • Download URL: pywis-topics-0.3.5.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for pywis-topics-0.3.5.tar.gz
Algorithm Hash digest
SHA256 b8d21d80c02f4d8c64b3ca3bf3c9d405f5ad3c06c10b918e4ccb9619fa567c1b
MD5 0f40e50eeafe83d98cf8b32f4b41d7aa
BLAKE2b-256 9cb1587564200e11fd45201a34cbaf3bb6e37cc8ace9309609f093f4bd1b6d73

See more details on using hashes here.

File details

Details for the file pywis_topics-0.3.5-py2.py3-none-any.whl.

File metadata

  • Download URL: pywis_topics-0.3.5-py2.py3-none-any.whl
  • Upload date:
  • Size: 19.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using 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

File hashes

Hashes for pywis_topics-0.3.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4cf1afcb4d0c3fdfca43759ce92a03f3e0c62703dab5ab12e43ddc02d8f6e99e
MD5 778b039d5f0100af4a18139d87232e40
BLAKE2b-256 14827fe738be4b1a7302dfbbfb4b3047f21a1feccdd6d5f7cb114e91fc27bf55

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