Arkindex Tasks
This repository holds various scripts used as asynchronous tasks via Ponos. Those scripts use the Arkindex API client and can run on any remote worker safely.
Dev setup
Start by creating a new virtualenv, using Python 3:
mkvirtualenv tasks -a .
You can then install the project's dependencies:
pip install -e .
Linting
We use pre-commit with black to automatically format the Python source code of this project.
To be efficient, you should run pre-commit before committing (hence the name...).
To do that, run once :
pip install pre-commit
pre-commit install
The linting workflow will now run on modified files before committing, and will fix issues for you.
If you want to run the full workflow on all the files: pre-commit run -a
.
Unit tests
We use tox to run unit tests. You can install it globally on your system with pip install tox
.
- Run all tests:
tox
- Run a single test package, module or class:
tox -- -s tests.import_files.test_base
. Take care of the--
or your arguments are sent totox
instead of the test module. - Code coverage is automatically generated when running tests, you can view stats in your console, or by opening
htmlcov/index.html
in your preferred browser
Using local dependencies
This project relies on several internal dependencies. If you are editing the Arkindex API client or the Transkribus client and want to test its changes with this repository, you can register your clones of those dependencies as tasks' dependencies:
git clone git@gitlab.com:teklia/arkindex/api-client.git ../api-client
git clone git@gitlab.com:teklia/arkindex/transkribus.git ../transkribus
workon tasks
cd ../api-client
pip install -e .
cd ../transkribus
pip install -e .
To run the unit tests with tox
, you will have to use an argument to switch its environment to the one named local
, which will use your local repositories as dependencies:
tox -e local