Development
DAN uses different tools during its development.
Linter
Code syntax is analyzed before submitting the code.
To run the linter tools suite you may use pre-commit.
pip install pre-commit
pre-commit run -a
Tests
Unit tests
Tests are executed with tox using pytest.
pip install tox
tox
To recreate tox virtual environment (e.g. a dependencies update), you may run tox -r
.
Commands
As unit tests do not test everything, it is sometimes necessary to use DAN commands directly to test developments.
The library already has all the documents needed to run the training command on a minimalist dataset. You can use the configuration available at configs/tests.json
. It is already populated with the parameters used in the unit tests.
teklia-dan train --config configs/tests.json
The library already has all the documents needed to run the predict command with a minimalist model. In the tests/data/prediction
directory, you can run the following command and add any extra parameters you need:
teklia-dan predict \
--image-dir images/ \
--image-extension png \
--model popp_line_model.pt \
--parameters parameters.yml \
--charset charset.pkl \
--output /tmp/dan-predict
Documentation
This documentation uses Sphinx and was generated using MkDocs and mkdocstrings.
Setup
Add the docs
extra when installing teklia-dan
:
# In a clone of the Git repository
pip install .[docs]
Build the documentation using mkdocs serve -v
. You can then write in Markdown in the relevant docs/*.md
files, and see live output on http://localhost:8000.
Linter
This documentation is subject to linting using:
-
doc8
, the linting rules applied can be found on its documentation, -
mdformat
, the formatting rules applied can be found on its documentation.