TUDelft-CITG / halem

HALEM is a python package for optimizing shipping routes. This package provides an algorithm for optimizing the route for a given hydrodynamic model.
https://halem.readthedocs.io
MIT License
12 stars 4 forks source link

HALEM

Hydrodynamic Algorithm for Logistic Enhancement Module: route optimisation in dynamic currents.

Documentation can be found here.

Features

This package contains route optimization for given currents. The following features are taken into account in this version:

Does not take into account:

Different routes that can be optimized are:

The Python package

The Python package is setup using PyScaffold:

pip install pyscaffold
putup halem

Make sure not to run the putup command in a Git repository clone as it will raise an exception. If you already have a Git repo to store your package, run the putup command outside the Git repository clone and copy the generated contents into that directory.

PyScaffold provides you with a full Python package, including source, test and doc directories. You can create a development environment using:

cd halem
pip install -e .[testing]

The Test environment

The .github/workflows/action.yml, pytest-full.ini and parts of the setup.cfg files form your test environment. Your test environment is built around the pytest framework. We use fixtures to configure our tests, please read about them. Also, there are basically two test environments:

The full test environment enables various extensions that ensure that your code is correct, consistent and well readible:

Github runs the full test environment on several combinations of operating systems and Python versions. By default all combinations of the latest versions of the operating systems Windows, MacOS and Ubuntu, and Python versions 3.8, 3.9 and 3.10 are tested. Github also publishes teh coverage results and documentaion to your Github project page: https://TUDelft-CITG.github.io/halem/docs/ and https://TUDelft-CITG.github.io/halem/coverage if enabled on Github (Settings -> Pages). See .github/workflows/action.yml for details.

The Dev environment

The .vscode directory forms your Dev environment. It contains configuration files that makes Visual Studio Code:

It is recommended to create a virtual Python environment for each Python package you develop. Make sure that the paths in your .vscode/settings.json file point to the right interpreters. To enable automated tasks in Visual Studio Code choose Ctrl+Shift+P -> Tasks: Manage Automated Tasks in Folder -> Allow Automated Tasks in Folder.

Python package installation

Once your code is on Github, you can tag it with a semantic version. A semantic version had the form v1.0.0, where the first number indicates a major revision, the second a minor revision, and the third a patch. The use of increments is a but subjective, but a useful rule of thumb is:

Once your code has a semantic version tagged to it, you can install it using pip (Linux/Docker syntax):

pip install halem

Or on Windows/Anaconda:

pip install halem

The Dockerfile (optional)

The Dockerfile and docker-compose.*.yml files allow you to run your code in a containerized environment. A container is like a virtual machine. It provides a workspace for you to work in, completely separate from your own laptop. The advantage of containers is that you, your colleagues and the test servers are all working in exactly the same environment. The disadvantage is that Docker requires a lot of resources from your laptop, and, if you don't know how to run Docker on bare WSL, you need a paid license.

Using containers locally is not required. But if you are used to work with Docker it might be convenient.

The Dev container

The .devcontainer directory provides a Visual Studio Code Dev environment. It leverages your Docker container environment and your Test environment in a full fletched automated Dev environment that is: