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 pyproject.toml. 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/World-Meteorological-Organization/pywis-topics.git
cd pywis-topics
pip3 install .

Running

First check pywis-topics was correctly installed

pywis-topics --version

# sync WTH bundle
pywis-topics bundle sync

Listing and validating topics for subscription

# validate a WIS2 topic hierarchy
pywis-topics topic validate subscription origin/a/wis2/ca-eccc-msc

# validate a WIS2 topic hierarchy in no-strict mode
pywis-topics topic validate subscription --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 subscription origin/a/wis2/+/data/core --no-strict

Validating topics for publication

# validate a WIS2 topic hierarchy
pywis-topics topic validate publication origin/a/wis2/ca-eccc-msc
pywis-topics topic validate publication origin/a/wis2/ca-eccc-msc/ocean
pywis-topics topic validate publication origin/a/wis2/us-noaa-nws/data/core/weather/surface-based-observations/synop
# validate a WIS2 topic hierarchy in no-strict mode
pywis-topics topic validate publication --no-strict origin/a/wis2/fake-centre-id/data/core

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

python3 tests/run_tests.py

Releasing

# create release (x.y.z is the release version)
vi pyproject.toml  # update [project]/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 -m build
twine upload dist/*

# publish release on GitHub (https://github.com/World-Meteorological-Organization/pywis-topics/releases/new)

# bump version back to dev
vi pyproject.toml  # update [project]/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.5.0.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pywis_topics-0.5.0-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file pywis_topics-0.5.0.tar.gz.

File metadata

  • Download URL: pywis_topics-0.5.0.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for pywis_topics-0.5.0.tar.gz
Algorithm Hash digest
SHA256 6dfcd20a2bfe5c90ceaa5141406f2cba64c092dbc1020e39d7b2cfe510950275
MD5 5536fc5e2c20da0c7a141e1bad2dc683
BLAKE2b-256 1389031ed8bd25b865ba01e1ac249188da18658e9233132d8b6d3f06408176b3

See more details on using hashes here.

File details

Details for the file pywis_topics-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: pywis_topics-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 18.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for pywis_topics-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4b63cca273ed22095de80298ffce153775dda319d51ee2adb748bb0b29ee8227
MD5 8a27b993438e448cce4eed9896549f6d
BLAKE2b-256 d7fedd7228af02dd2f2088469e20edf0178e01eaa988b258ab21ac67553b5512

See more details on using hashes here.

Supported by

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