-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
209 lines (158 loc) · 5.73 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# Update version ONLY here
VERSION := 0.10.5
SHELL := /bin/bash
# Makefile for project
VENV := ~/.virtualenvs/fake.py/bin/activate
UNAME_S := $(shell uname -s)
# Build documentation using Sphinx and zip it
build_docs:
source $(VENV) && sphinx-build -n -a -b html docs builddocs
cd builddocs && zip -r ../builddocs.zip . -x ".*" && cd ..
rebuild_docs:
source $(VENV) && sphinx-apidoc . --full -o docs -H 'fake.py' -A 'Artur Barseghyan <[email protected]>' -f -d 20
cp docs/conf.py.distrib docs/conf.py
cp docs/index.rst.distrib docs/index.rst
build_docs_epub:
$(MAKE) -C docs/ epub
build_docs_pdf:
$(MAKE) -C docs/ latexpdf
auto_build_docs:
source $(VENV) && sphinx-autobuild docs docs/_build/html
pre-commit:
pre-commit run --all-files
## Format code using Black
#black:
# source $(VENV) && black .
#
## Sort imports using isort
#isort:
# source $(VENV) && isort . --overwrite-in-place
doc8:
source $(VENV) && doc8
# Run ruff on the codebase
ruff:
source $(VENV) && ruff check .
# Serve the built docs on port 5001
serve_docs:
source $(VENV) && cd builddocs && python -m http.server 5001
# Install the project
install:
source $(VENV) && pip install -e .[all]
test: clean
source $(VENV) && pytest -vrx -s
test-all: test \
customization-test \
dataclasses-test \
django-test \
hypothesis-test \
lazyfuzzy-test \
pydantic-test \
sqlalchemy-test \
sqlmodel-test \
tortoise-test
customization-test:
source $(VENV) && cd examples/customization/ && python manage.py test
dataclasses-test:
source $(VENV) && cd examples/dataclasses/ && python manage.py test
django-test:
source $(VENV) && cd examples/django/ && ./manage.py test
hypothesis-test:
source $(VENV) && cd examples/hypothesis/ && python manage.py test
lazyfuzzy-test:
source $(VENV) && cd examples/lazyfuzzy/ && python manage.py test
pydantic-test:
source $(VENV) && cd examples/pydantic/ && python manage.py test
sqlalchemy-test:
source $(VENV) && cd examples/sqlalchemy/ && python manage.py test
sqlmodel-test:
source $(VENV) && cd examples/sqlmodel/ && python manage.py test
tortoise-test:
source $(VENV) && cd examples/tortoise/ && python manage.py test
shell:
source $(VENV) && ipython
customization-shell:
source $(VENV) && cd examples/customization/ && python manage.py shell
customization-address-cli:
@echo Running Python script: $(filter-out $@,$(MAKECMDGOALS))
source $(VENV) && cd examples/customization/ && python address_cli.py $(filter-out $@,$(MAKECMDGOALS))
customization-band-cli:
@echo Running Python script: $(filter-out $@,$(MAKECMDGOALS))
source $(VENV) && cd examples/customization/ && python band_cli.py $(filter-out $@,$(MAKECMDGOALS))
customization-custom-data-cli:
@echo Running Python script: $(filter-out $@,$(MAKECMDGOALS))
source $(VENV) && cd examples/customization/ && python custom_data_cli.py $(filter-out $@,$(MAKECMDGOALS))
dataclasses-shell:
source $(VENV) && cd examples/dataclasses/ && python manage.py shell
django-shell:
source $(VENV) && python examples/django/manage.py shell
django-runserver:
source $(VENV) && python examples/django/manage.py runserver 0.0.0.0:8000 --traceback -v 3
django-makemigrations:
source $(VENV) && python examples/django/manage.py makemigrations
django-apply-migrations:
source $(VENV) && python examples/django/manage.py migrate
lazyfuzzy-shell:
source $(VENV) && cd examples/lazyfuzzy/ && python manage.py shell
pydantic-shell:
source $(VENV) && cd examples/pydantic/ && python manage.py shell
sqlalchemy-shell:
source $(VENV) && cd examples/sqlalchemy/ && python manage.py shell
sqlmodel-shell:
source $(VENV) && cd examples/sqlmodel/ && python manage.py shell
tortoise-shell:
source $(VENV) && cd examples/tortoise/ && python manage.py shell
create-secrets:
source $(VENV) && detect-secrets scan > .secrets.baseline
detect-secrets:
source $(VENV) && detect-secrets scan --baseline .secrets.baseline
# Clean up generated files
clean:
find . -type f -name "*.pyc" -exec rm -f {} \;
find . -type f -name "builddocs.zip" -exec rm -f {} \;
find . -type f -name "*.py,cover" -exec rm -f {} \;
find . -type f -name "*.orig" -exec rm -f {} \;
find . -type f -name "*.db" -exec rm -f {} \;
find . -type d -name "__pycache__" -exec rm -rf {} \; -prune
rm -rf build/
rm -rf dist/
rm -rf .cache/
rm -rf htmlcov/
rm -rf builddocs/
rm -rf testdocs/
rm -rf .coverage
rm -rf .pytest_cache/
rm -rf .mypy_cache/
rm -rf .ruff_cache/
rm -rf dist/
rm -rf fake.py.egg-info/
compile-requirements-pip-tools:
source $(VENV) && python -m piptools compile --all-extras -o docs/requirements.txt pyproject.toml
compile-requirements-upgrade-pip-tools:
source $(VENV) && python -m piptools compile --all-extras -o docs/requirements.txt pyproject.toml --upgrade
compile-requirements:
source $(VENV) && uv pip compile --all-extras -o docs/requirements.txt pyproject.toml
compile-requirements-upgrade:
source $(VENV) && uv pip compile --all-extras -o docs/requirements.txt pyproject.toml --upgrade
update-version:
#sed -i 's/version = "[0-9.]\+"/version = "$(VERSION)"/' pyproject.toml
#sed -i 's/__version__ = "[0-9.]\+"/__version__ = "$(VERSION)"/' fake.py
@echo "Updating version in pyproject.toml and fake.py"
@if [ "$(UNAME_S)" = "Darwin" ]; then \
gsed -i 's/version = "[0-9.]\+"/version = "$(VERSION)"/' pyproject.toml; \
gsed -i 's/__version__ = "[0-9.]\+"/__version__ = "$(VERSION)"/' fake.py; \
else \
sed -i 's/version = "[0-9.]\+"/version = "$(VERSION)"/' pyproject.toml; \
sed -i 's/__version__ = "[0-9.]\+"/__version__ = "$(VERSION)"/' fake.py; \
fi
build:
source $(VENV) && python -m build .
check-build:
source $(VENV) && twine check dist/*
release:
source $(VENV) && twine upload dist/* --verbose
test-release:
source $(VENV) && twine upload --repository testpypi dist/*
mypy:
source $(VENV) && mypy fake.py
%:
@: