IHEWAengine¶
This is the documentation of IHEWAengine.
IHEWAengine is part of water accounting tools. This project is fully developed by Water Accounting team at IHE-Delft.
Installation¶
Install from pip¶
IHEWAengine Python package is hosted on Python Package Index (PyPI).
Install from pip.
$ pip install IHEWAengine
Install from source code¶
Download source code from Github.
$ git clone https://github.com/wateraccounting/IHEWAengine.git
$ cd IHEWAengine
Install from source code.
$ python setup.py install
Uninstall IHEWAengine¶
$ pip uninstall IHEWAengine
Docker¶
Set “System -> Base Memory” to max capacity in Virtual Machine.
Set “Shared Folders” in Virtual Machine.
Folder Path: D:\IHEWAengine
Folder Name: d/IHEWAengine
Auto-mount: Yes
Make Permanent: Yes
Download source code from Github.
$ git clone https://github.com/wateraccounting/IHEWAengine.git
$ cd IHEWAengine
Restart Docker Virtual Machine image.
$ docker-machine restart
Pull the IHEWAengine image.
$ docker pull wateraccounting/ihewaengine
Or build from source code.
$ docker build -t wateraccounting/ihewaengine .
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 ihewaengine -p 8888:8888 -v /d/IHEWAengine:/notebooks wateraccounting/ihewaengine
Check running image (container), in the new cmd window.
$ docker container list
Access to running image, in the new cmd window.
$ docker exec -it ihewaengine bash
$ cd /notebooks/
$ python3 setup.py install
$ python3 ./examples/ex_engine2_Hyperloop.py
Clean running cache.
$ docker system prune -f && docker volume prune -f && docker container prune -f
Remove image.
$ docker rmi wateraccounting/ihewaengine
Use¶
Examples can be found at examples.
import os
import IHEWAengine
path = os.getcwd()
config = 'config.yml'
file_config = os.path.join(path, config)
if os.path.exists(file_config):
IHEWAengine.Engine(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/IHEWAengine.git
$ cd IHEWAengine
From the root of the project
$ python setup.py --version
Format scripts by PEP8
$ autopep8 --in-place --aggressive src/IHEWAengine/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_wheelIn cmd, validate build, type
twine check dist/IHEWAengine-0.0.1*In cmd, upload build, type
twine upload dist/IHEWAengine-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