1- include openfisca_make/install.mk
2- include openfisca_make/lint.mk
3- include openfisca_make/publish.mk
4- include openfisca_make/serve.mk
5- include openfisca_make/test_code.mk
6- include openfisca_make/test_doc.mk
1+ include openfisca_tasks/test_code.mk
2+ include openfisca_tasks/test_doc.mk
73
84help = sed -n "/^$1/ { x ; p ; } ; s/\# \#/[⚙]/ ; s/\./.../ ; x" ${MAKEFILE_LIST}
95
@@ -14,3 +10,59 @@ all: test
1410
1511# # Run all lints and tests.
1612test : clean lint test-code
13+
14+ # # Install project dependencies.
15+ install :
16+ @$(call help,$@ :)
17+ @pip install --upgrade pip twine wheel
18+ @pip install --editable .[dev] --upgrade --use-deprecated=legacy-resolver
19+
20+ # # Uninstall project dependencies.
21+ uninstall :
22+ @$(call help,$@ :)
23+ @pip freeze | grep -v " ^-e" | sed " s/@.*//" | xargs pip uninstall -y
24+
25+ # # Delete builds and compiled python files.
26+ clean : \
27+ $(shell ls -d * | grep "build\|dist") \
28+ $(shell find . -name "* .pyc")
29+ @$(call help,$@ :)
30+ @rm -rf $?
31+
32+ # # Install openfisca-core for deployment and publishing.
33+ build : setup.py
34+ @# # This allows us to be sure tests are run against the packaged version
35+ @# # of openfisca-core, the same we put in the hands of users and reusers.
36+ @$(call help,$@ :)
37+ @python $? bdist_wheel
38+ @find dist -name " *.whl" -exec pip install --force-reinstall {}[dev] \;
39+
40+ # # Lint the codebase.
41+ lint : check-syntax-errors check-style check-types
42+
43+ # # Compile python files to check for syntax errors.
44+ check-syntax-errors : .
45+ @$(call help,$@ :)
46+ @python -m compileall -q $?
47+
48+ # # Run linters to check for syntax and style errors.
49+ check-style : $(shell git ls-files "* .py")
50+ @$(call help,$@ :)
51+ @flake8 $?
52+
53+ # # Run static type checkers for type errors.
54+ check-types : openfisca_core openfisca_web_api
55+ @$(call help,$@ :)
56+ @mypy $?
57+
58+ # # Run code formatters to correct style errors.
59+ format-style : $(shell git ls-files "* .py")
60+ @$(call help,$@ :)
61+ @autopep8 $?
62+
63+ # # Serve the openfisca Web API.
64+ api :
65+ @$(call help,$@ :)
66+ @openfisca serve \
67+ --country-package openfisca_country_template \
68+ --extensions openfisca_extension_template
0 commit comments