IHEWAreport¶
This is the documentation of IHEWAreport.
IHEWAreport is a Reportion of tools to write standard report. This project is fully developed by Water Accounting team at IHE-Delft.
MiKTeX is required to generate tex and pdf file.
pandoc is used to generate word document.
.py -> latexmk -> .tex & .run.xml
.tex -> pdflatex -> .bcf
.bcf -> biber -> .bbl
.bbl -> pdflatex -> .pdf 1st time
.bbl -> pdflatex -> .pdf 2ed time, make sure
Installation¶
Install from pip¶
IHEWAreport Python package is hosted on Python Package Index (PyPI).
Install from pip.
$ pip install IHEWAreport
Install from source code¶
Download source code from Github.
$ git clone https://github.com/wateraccounting/IHEWAreport.git
$ cd IHEWAreport
Install from source code.
$ python setup.py install
Uninstall IHEWAreport¶
$ pip uninstall IHEWAreport
Docker¶
Set “System -> Base Memory” to max capacity in Virtual Machine.
Set “Shared Folders” in Virtual Machine.
Folder Path: D:\IHEWAreport
Folder Name: d/IHEWAreport
Auto-mount: Yes
Make Permanent: Yes
Download source code from Github.
$ git clone https://github.com/wateraccounting/IHEWAreport.git
$ cd IHEWAreport
Restart Docker Virtual Machine image.
$ docker-machine restart
Pull the IHEWAreport image.
$ docker pull wateraccounting/ihewareport
Or build from source code.
$ docker build -t wateraccounting/ihewareport .
Check images.
$ docker images
Check ip address.
$ docker-machine env
export DOCKER_HOST="tcp://192.168.99.100:2376"
Run the image with Jupyter Notebook. To access Jupyter http://192.168.99.100:8888/
$ docker run -it --name ihewareport -p 8888:8888 -v /d/IHEWAreport:/notebooks wateraccounting/ihewareport
Check running image (container), in the new cmd window.
$ docker container list
Access to running image, in the new cmd window.
$ docker exec -it ihewareport bash
$ cd /notebooks/
$ python3 setup.py install
$ python3 ./examples/ex_CFSR_GRIB.py
Clean running cache.
$ docker system prune -f && docker volume prune -f && docker container prune -f
Remove image.
$ docker rmi wateraccounting/ihewareport
Use¶
Examples can be found at examples.
import os
import IHEWAreport
path = os.getcwd()
config = 'config.yml'
file_config = os.path.join(path, config)
if os.path.exists(file_config):
IHEWAreport.Report(workspace=path,
config=config)
)
Development¶
In the PyCharm, change “Project Structure -> Source Folders” to “src”
Download source code from Github.
$ git clone https://github.com/wateraccounting/IHEWAreport.git
$ cd IHEWAreport
From the root of the project
$ python setup.py --version
Format scripts by PEP8
$ autopep8 --in-place --aggressive src/IHEWAreport/base/base.py
Flake8, pre-commit
$ pre-commit install
$ pre-commit run --all-files
[INFO] Initializing environment for git://github.com/pre-commit/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/pre-commit/mirrors-isort.
[INFO] Installing environment for git://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pre-commit/mirrors-isort.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
Unit test
$ python setup.py test
Read the Docs
$ python setup.py doctest
$ python setup.py docs
Upload to PyPI
In IDE, commit the changes “v0.0.1”
In IDE, Version Control -> Log, select this commit
In IDE, add version tag, select VCS -> Git -> tag
In IDE, Tag window -> Tag Name, type “v0.0.1”
In cmd, build package, type
python setup.py sdist bdist_wheel
In cmd, validate build, type
twine check dist/IHEWAreport-0.0.1*
In cmd, upload build, type
twine upload dist/IHEWAreport-0.0.1*
In IDE, push the commit, with Tag label: “HEAD”, “master”, “v0.0.1”
In Github, select Release to “create a new release” or “Draft a new release”
In Github, Tag version, type “v0.0.1”
In Github, @ Target, select this commit
In Github, Publish release
Code of Conduct¶
Be friendly and patient
Be welcoming
Be considerate
Be respectful
Be careful in the words that you choose
When we disagree, try to understand why