|
| 1 | +SRC_APP=app |
| 2 | +SRC_CORE=fastvector |
| 3 | +SRC_TEST=tests |
| 4 | +SRC_DOC=documentation |
| 5 | + |
| 6 | +ifeq ($(OS), Windows_NT) |
| 7 | + PYTHON=python |
| 8 | + PIP=pip |
| 9 | + RM=del /Q |
| 10 | + FixPath=$(subst /,\,$1) |
| 11 | +else |
| 12 | + PYTHON=python3 |
| 13 | + PIP=pip3 |
| 14 | + RM=rm -f |
| 15 | + FixPath=$1 |
| 16 | +endif |
| 17 | + |
| 18 | +help: |
| 19 | + @echo "Some available commands:" |
| 20 | + @echo " * run - Run code." |
| 21 | + @echo " * test - Run unit tests and test coverage." |
| 22 | + @echo " * doc - Document code (pydoc)." |
| 23 | + @echo " * clean - Cleanup (e.g. pyc files)." |
| 24 | + @echo " * code-pylint - Check code pylint." |
| 25 | + @echo " * code-flake8 - Check code flake8." |
| 26 | + @echo " * code-mypy - Check code mypy" |
| 27 | + @echo " * code-lint - Check code lints (pylint, flake8, mypy)." |
| 28 | + @echo " * code-isort - Sort the import statements." |
| 29 | + @echo " * code-autopep8 - Auto format the code for pep8." |
| 30 | + @echo " * code-format - Format code (isort, autopep8)." |
| 31 | + @echo " * deps-install - Install dependencies (see requirements.txt)." |
| 32 | + @echo " * deps-dev-install - Install dev. dependencies (see requirements-dev.txt)." |
| 33 | + |
| 34 | +run: |
| 35 | + @$(PYTHON) $(SRC_APP)/main.py |
| 36 | + |
| 37 | +test: |
| 38 | + @coverage run --source . -m $(SRC_TEST).test_vector |
| 39 | + @coverage report |
| 40 | + |
| 41 | +doc: |
| 42 | + @build_docs.bat |
| 43 | + |
| 44 | +clean: |
| 45 | + @$(RM) $(call FixPath,$(SRC_CORE)/*.pyc) |
| 46 | + @$(RM) $(call FixPath,$(SRC_CORE)/__pycache__) |
| 47 | + @$(RM) $(call FixPath,$(SRC_TEST)/*.pyc) |
| 48 | + @$(RM) $(call FixPath,$(SRC_TEST)/__pycache__) |
| 49 | + |
| 50 | +code-pylint: |
| 51 | + @pylint $(SRC_CORE) |
| 52 | + |
| 53 | +code-mypy: |
| 54 | + @mypy $(SRC_CORE) |
| 55 | + |
| 56 | +code-lint: code-pylint code-mypy |
| 57 | + |
| 58 | +code-isort: |
| 59 | + cd $(SRC_CORE) |
| 60 | + @isort --recursive . |
| 61 | + cd $(SRC_TEST) |
| 62 | + @isort --recursive . |
| 63 | + |
| 64 | +code-pep8: |
| 65 | + @autopep8 -i -r $(SRC_CORE) |
| 66 | + |
| 67 | +code-format: code-isort code-pep8 |
| 68 | + |
| 69 | +deps-install: |
| 70 | + @$(PIP) install -r requirements.txt |
| 71 | + |
| 72 | +deps-dev-install: |
| 73 | + @$(PIP) install -r requirements-dev.txt |
0 commit comments