Facilitates waterflow gauge data ingest from several endpoints. Dependency to several other projects.
Project description
Gague Getter
Description
Gague getter provides a unified and simple interface to the following state water portals:
State | Site | Source |
---|---|---|
NSW | realtimedata.waternsw.com.au | CP |
QLD | water-monitoring.information.qld.gov.au | PUBLISH |
VIC | data.water.vic.gov.au | AT |
The tool is configured to abstract away the details specific to each state water poral and return a consistent structure. By default it will return a daily mean of a flow in Ml/day for a given gauge number, but level and other intervals and aggregations are available
Example of its use can be seen in Gauge_getter_example.ipynb notebook, contact ben.bradshaw@mdba.gov.au for more details.
Setup / Packaging
The module has been packaged using setuptools
-
https://setuptools.readthedocs.io/en/latest/userguide/index.html
To install from source, run python3 setuptools.py install
To build a redistributable package (for upload to pip, or a locally managed software repository) use
python3 setup.py build
. Pip doesn't respect requirements.txt
so the setup will need to have
install_requires - https://packaging.python.org/discussions/install-requires-vs-requirements/ .
Installation
- Install dependencies with
pip3 install -r requirements.txt
- (Optionally) install dev dependencies with
pip3 install -r requirements-dev.txt
- Run
python3 setup.py install
to install the module
Development Tools
- To run unit tests, execute
PYTHONPATH="./" python3 -m coverage run --source=mdba_gauge_getter -m pytest
- To run coverage reports, execute
PYTHONPATH="./" python3 -m coverage report -m
, this must be run after pytest has been executed. - To run pylint (to get a code quality rating), run
pylint --output-format=text mdba_gauge_getter/ tests
- To run mypy (a type checker) run
mypy mdba_gauge_getter
These can be wrapped in the execute-on-change.py
tool in a Linux environment (requires
pip3 install inotify
).
CI
A ci script has been created located at /ci.py
. It can be run with PYTHONOPATH="./" python3 ci.py
The script executes unit tests, pylint and mypy, updating README.md with the output. It can be plugged into Azure DevOps Pipelines or similar, or run manially prior to git push.
Unit Tests
Unit tests, with 100% code coverage were used. Code coverage does not mean code is bug-free but is a good indicator that code is well tested. There are many benefits of Unit tests:
- You can assert your intentions when writing the code are correctly implemented
- You are forced to logically think through code structures to build testable code
- You can assert future changes do not break existing behaviour
Unit tests have been built with the pytest library, on a Unix operating system to run them
execute PYTHONPATH="./" pytest-3 --cov=mdba_gauge_getter --cov-report term-missing
.
The reason we set the PYTHONPATH
environment variable is to force pytest to
load the local directory, rather than any other version that is installed on the computer.
CI
The script ci.py
has been built with the intent of being used in Continuous Integration - it
executes tests and patches this README.txt file. It could be plugged into a CI engine such as
Azure DevOps Pipelines or GitHub Actions - from there it could be explicitly configured to reject
commits which fail some metrics (such as failing unit tests, or reduced code coverage).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for mdba_gauge_getter-0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 913c9afa2d4145c4b92ea4741df9cb39ef3104f55c8803aa0007702f2dd8e10e |
|
MD5 | 7b61af587554563c8253831f0b18add2 |
|
BLAKE2b-256 | 1de0db3627171752d4b7ac8a21a1a3160a6522aa636582f43fa7022d28e7acda |