-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
127 lines (103 loc) · 3.51 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
.PHONY: help clean clean-build clean-pyc clean-translations clean-frontend lint test test-all coverage release release-test release-sign release-sign-test dist install develop babel-extract babel-update babel-compile frontend frontend-build
PYTHON?=python3
PIP?=pip3
POETRY?=poetry
FIND?=find
YARN?=yarn
help:
@echo "mini_fiction"
@echo
@echo "clean - remove all build, test, coverage, frontend and Python artifacts"
@echo "clean-build - remove build artifacts"
@echo "clean-pyc - remove Python file artifacts"
@echo "clean-translations - remove gettext *.mo files"
@echo "clean-frontend - remove frontend build"
@echo "lint - check style with pylint"
@echo "format - reformat with black"
@echo "test - run tests quickly with the default Python with pytest"
@echo "test-all - run tests on every Python version with tox"
@echo "coverage - check code coverage quickly with the default Python and pytest"
@echo "release - package and upload a release to PyPI using twine"
@echo "release-test - package and upload a release to TestPyPI using twine"
@echo "release-sign - package, sign and upload a release to PyPI using twine"
@echo "release-sign-test - package, sign and upload a release to TestPyPI using twine"
@echo "dist - package"
@echo "install - install the package to the active Python's site-packages"
@echo "develop - install the package for development as editable"
@echo "babel-extract - create messages.pot translation template"
@echo "babel-update - update .po translation files"
@echo "babel-compile - compile .po translation files to .mo"
@echo "frontend - build development bundle"
@echo "frontend-build - build production bundle"
clean: clean-build clean-pyc clean-translations clean-frontend
clean-build:
rm -fr build/
rm -fr dist/
rm -fr .eggs/
rm -fr .tox/
rm -fr *.egg-info
rm -fr *.egg
clean-pyc:
$(FIND) . -name '*.pyc' -exec rm -f {} +
$(FIND) . -name '*.pyo' -exec rm -f {} +
$(FIND) . -name '*~' -exec rm -f {} +
$(FIND) . -name '__pycache__' -exec rm -fr {} +
clean-translations:
rm -f mini_fiction/translations/*/LC_MESSAGES/*.mo
clean-frontend:
rm -rf mini_fiction/static/build
lint:
pylint mini_fiction/logic
mypy
flake8 mini_fiction/logic
pyright
format:
isort mini_fiction/logic
black mini_fiction/logic
test:
pybabel compile -d mini_fiction/translations
pytest
test-all:
pybabel compile -d mini_fiction/translations
tox
coverage:
pytest --cov=mini_fiction --cov-report=html --cov-branch tests
ls -lh htmlcov/index.html
release: dist
twine upload dist/*
release-test: dist
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
release-sign: dist
twine upload --sign --sign-with gpg dist/*
release-sign-test: dist
twine upload --sign --sign-with gpg --repository-url https://test.pypi.org/legacy/ dist/*
dist: clean
pybabel compile -d mini_fiction/translations
cd frontend && $(YARN) build
$(POETRY) build -f wheel
ls -lh dist
install: clean
$(PIP) install .
develop:
$(POETRY) install
$(POETRY) run pybabel compile -d mini_fiction/translations
cd frontend && $(YARN)
cd frontend && $(YARN) webpack
babel-extract:
pybabel extract \
-F babel.cfg \
-k lazy_gettext \
-o messages.pot \
--project mini_fiction \
--copyright-holder andreymal \
--version 0.0.4 \
--msgid-bugs-address [email protected] \
mini_fiction
babel-update: babel-extract
pybabel update -i messages.pot -d mini_fiction/translations
babel-compile:
pybabel compile -d mini_fiction/translations
frontend:
cd frontend && $(YARN) webpack
frontend-build:
cd frontend && $(YARN) build