Exercise: Random Rectangles#

This program creates random rectangles. Here is an example of 10 random rectangles.

10_rectangles

Installation#

Please go to the Gitlab repository: https://courses.gistools.geog.uni-heidelberg.de/advancedgeoscripting/03_best_practices

The code requires Python >=3.10 and the package pandas.

For development purposes you need to install the packages

  • pytest

  • pre-commit

  • black

  • flake8

Using anaconda:

conda install -c conda-forge black pytest flake8 pre-commit

All requirements are also given in pyproject.toml.

Usage#

To create random rectangles, run python main.py.

Contribution guidelines#

Run the tests#

To make sure that the code works fine, run the unit tests by executing

pytest test_geometry.py

Code style using pre-commit#

The package pre-commit is used to ensure consistent code style. The rules are defined in .pre-commit-config.yaml. Install the pre-commit hooks by executing

pre-commit install

Create a new branch#

Create a new branch with a unique name, e.g. issue number and your first name

git checkout -b #10-christina

You should push your commits only to this branch, not the main branch.

Create a Merge Request#

After you have solved one of the issues, create a merge request on GitLab.

Contributors#

Resources#