Developers Guide

Tools

As anlearn developers, we’re using these tools.

Setting-up the developers’ environment

Nix-shell & direnv

For easy environment management, we’re using nix-shell in combination with direnv. Using these two tools reduces the time and effort required to create and maintain a deterministic environment. We highly recommend using them. Nix configuration is in the shell.nix files + nix folder and the direnv configuration is in the .envrc file.

Python tools

As for python versions currently, support is for python 3.6, 3.7, and 3.8. To ensure a similar code style choice for formating is black and isort. As a linters we use mypy and flake8.

For easier code check before committing any changes, there is an option to use the pre-commit tool. As you can see in .pre-commit-config.yaml it is using only currently installed versions of black, isort, and flake8.

Installation using poetry

We are using the poetry for packaging and dependencies managemet. To installing all developement dependencies including ones for generating documentation simply use:

poetry install -E docs
  • For pre-commit (after installing tools)

    pre-commit install
    

Tests

All tests are in test folder. We’re using a combinaiton of tox and pytest for testing. You can run tests by using the tox command directly or by using make pytest or make check commands.

Configuration files

  • Configurations for flake8 and mypy are in the setup.cfg file.

  • Configurations for isort, black, and pytest are in the pyproject.toml file.

  • Configuration for pre-commit is in the .pre-commit-config.yaml file.

  • Configuration for tox is in the tox.ini file.

Documentation

We’re using sphinx in combination with Read the Docs Sphinx Theme. For generating the documentation, you have to have anlearn[docs] installed (poetry install -E docs). You can create the documentation by using the make docs command.