forked from edelvalle/djhtmx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
122 lines (92 loc) · 2.89 KB
/
Makefile
File metadata and controls
122 lines (92 loc) · 2.89 KB
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
CARGO_HOME ?= $(HOME)/.cargo
PATH := $(HOME)/.local/bin:$(CARGO_HOME)/bin:$(PATH)
PYTHON_VERSION ?= 3.12
SHELL := /bin/bash
PROJECT_NAME := djhtmx
UV ?= uv
UV_RUN ?= uv run
UV_PYTHON_PREFERENCE ?= only-managed
RUN ?= $(UV_RUN)
REQUIRED_UV_VERSION ?= 0.7.3
bootstrap:
@INSTALLED_UV_VERSION=$$(uv --version 2>/dev/null | awk '{print $$2}' || echo "0.0.0"); \
DETECTED_UV_VERSION=$$(printf '%s\n' "$(REQUIRED_UV_VERSION)" "$$INSTALLED_UV_VERSION" | sort -V | head -n1); \
if [ "$$DETECTED_UV_VERSION" != "$(REQUIRED_UV_VERSION)" ]; then \
uv self update $(REQUIRED_UV_VERSION) || curl -LsSf https://astral.sh/uv/$(REQUIRED_UV_VERSION)/install.sh | sh; \
fi
@echo $(PYTHON_VERSION) > .python-version
.PHONY: bootstrap
install: bootstrap
@$(UV) sync --python-preference=$(UV_PYTHON_PREFERENCE) --frozen $(sync_extra_args) \
|| $(UV) sync --python-preference=$(UV_PYTHON_PREFERENCE) $(sync_extra_args)
.PHONY: install
sync_extra_args ?=
sync: bootstrap
@$(UV) sync --python-preference=$(UV_PYTHON_PREFERENCE) --frozen $(sync_extra_args)
.PHONY: sync
lock: bootstrap
ifdef update_all
@$(UV) sync -U $(sync_extra_args)
else
@$(UV) sync $(sync_extra_args)
endif
.PHONY: lock
upgrade update: bootstrap
@$(MAKE) lock update_all=1
.PHONY: update upgrade
format-python:
@$(RUN) ruff check --fix src/
@$(RUN) ruff format src/
format: format-python format-rescript
.PHONY: format format-python format-rescript
lint:
@$(RUN) ruff check src/$(PROJECT_NAME)
@$(RUN) ruff format --check src/$(PROJECT_NAME)
.PHONY: lint
PYRIGHT_FILES ?= src/$(PROJECT_NAME)
pyright:
@$(RUN) basedpyright $(PYRIGHT_FILES)
.PHONY: pyright
run: install
@$(RUN) python src/tests/manage.py migrate
@cd src/tests; $(RUN) uvicorn --reload --reload-include="*.html" --reload-dir=../ fision.asgi:application
.PHONY: run
test:
@cd src/tests; $(RUN) coverage run --rcfile=../../pyproject.toml -m manage test
.PHONY: test
coverage-html: test
@cd src/tests; $(RUN) coverage html --rcfile=../../pyproject.toml
coverage: test
@cd src/tests; $(RUN) coverage report --rcfile=../../pyproject.toml
.PHONY: coverage
coverage-xml: test
@cd src/tests; $(RUN) coverage xml --rcfile=../../pyproject.toml
.PHONY: coverage-xml
makemigrations:
@$(RUN) python src/tests/manage.py makemigrations
.PHONY: makemigrations
py:
@$(RUN) ipython
.PHONY: py
SHELL_CMD ?= shell_plus
shell:
@$(RUN) python src/tests/manage.py $(SHELL_CMD) || @$(RUN) src/tests/manage.py shell
.PHONY: shell
# PyPI publishing targets
build:
@rm -rf dist/
@$(UV) build
.PHONY: build
publish-test: build
@echo "Publishing to TestPyPI..."
@$(UV) publish --index-url https://test.pypi.org/simple/
.PHONY: publish-test
publish: build
@echo "Publishing to PyPI..."
@$(UV) publish
.PHONY: publish
check-dist: build
@echo "Distribution files built successfully:"
@ls -la dist/
@echo "Note: Skipping twine check due to version compatibility issue with new metadata fields"
.PHONY: check-dist