File: Makefile

package info (click to toggle)
asyncio-dgram 3.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 192 kB
  • sloc: python: 550; makefile: 42
file content (57 lines) | stat: -rw-r--r-- 1,285 bytes parent folder | download
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
# Passed to pytest -k and used to select only tests which match the given
# substring expression
UT ?=

# When enabled, tests/type-checking will be more verbose and not capture
# stdout/err.
V ?=

# Run uv offline by default
OFFLINE ?= 1

SHELL = /usr/bin/env bash
PACKAGE := asyncio_dgram

# List of files in the repository
TEST_FILES := $(shell find test -type f -name '*.py')
PKG_FILES := $(shell find $(PACKAGE) -type f -name '*.py')
BIN_FILES := $(wildcard bin/*)

# Inferred targets from file names
LINT_TARGETS := example.py $(PKG_FILES) $(BIN_FILES) $(TEST_FILES)
TEST_TARGETS := $(TEST_FILES:test/test_%.py=test_%)

UV := uv --no-progress
ifeq ($(OFFLINE), 1)
	UV := $(UV) --offline
endif

.PHONY: \
	$(TEST_TARGETS) \
	sync \
	format \
	lint \
	type-check \
	test

default:

# Purposely ignoring $(OFFLINE) here
sync:
	@uv sync --frozen

check-format:
	@$(UV) run black --check $(LINT_TARGETS)
format:
	@$(UV) run black $(LINT_TARGETS)
lint:
	@$(UV) run flake8 --filename='*' $(LINT_TARGETS)
type-check:
	@$(UV) run mypy $(if $(V),--show-error-context) $(PACKAGE) test/  example.py
test:
	@$(UV) run pytest --log-level=DEBUG -W default -v -s
$(TEST_TARGETS):
	@$(UV) run pytest --log-cli-level=DEBUG -W default -v \
		test/$(@).py \
		$(if $(V),,-s) \
		$(if $(UT),-k $(UT))