-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathMakefile
More file actions
77 lines (61 loc) · 2.44 KB
/
Makefile
File metadata and controls
77 lines (61 loc) · 2.44 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
# Makefile for PyIBIS-AMI project.
#
# Original author: David Banas <capn.freako@gmail.com>
# Original date: February 11, 2019
#
# Copyright (c) 2019 David Banas; all rights reserved World wide.
.PHONY: dflt help check format lint type-check docs build upload upload_test test clean distclean
SRC_DIR := src/pyibisami
DOCS_DIR := docs
UV_EXEC := uv
UVX_EXEC := uvx --isolated
PYVERS := 3.10 3.11 3.12
PROJ_VER := $(shell ${UV_EXEC} version | cut -f 2 -d ' ')
TEST_EXP ?= tests
# Put it first so that "make" without arguments is like "make help".
dflt: help
# Prevent implicit rule searching for makefiles.
$(MAKEFILE_LIST): ;
check:
${UVX_EXEC} -w packaging>=24.2 validate-pyproject pyproject.toml
format:
${UVX_EXEC} isort src/ tests/
${UVX_EXEC} black src/ tests/
lint:
${UVX_EXEC} ruff check ${SRC_DIR}
${UVX_EXEC} flake8 --ignore=E501,E272,E241,E222,E221 ${SRC_DIR}
type-check:
${UVX_EXEC} -w mypy python -m mypy ${SRC_DIR}
docs:
pushd ${DOCS_DIR}; PROJ_VER=${PROJ_VER} ${UV_EXEC} run sphinx-build -j auto -b html source/ build/; popd
build:
${UV_EXEC} build --clear --no-create-gitignore --out-dir dist
upload: build
${UVX_EXEC} uv-publish --repo pypi dist/*
upload_test: build
${UVX_EXEC} uv-publish --repo testpypi dist/*
test:
@for VERSION in $(PYVERS); do \
$(UV_EXEC) run --python $$VERSION pytest -vv \
--cov=pyibisami --cov-report=html \
--cov-report=term-missing $(TEST_EXP); \
done
clean:
rm -rf .tox build/ docs/build/ .mypy_cache .pytest_cache .venv src/*.egg-info
distclean: clean
rm -rf dist/
help:
@echo "Available targets:"
@echo "=================="
@echo "\tcheck: Validate the 'pyproject.toml' file."
@echo "\tformat: Reformats all Python source code. USE CAUTION!"
@echo "\tlint: Run 'ruff' and 'flake8' over the source code."
@echo "\ttype-check: Run type checking, via 'mypy', on the source code."
@echo "\tdocs: Run 'sphinx' on the source code, to generate documentation."
@echo "\t\tTo view the resultant API documentation, open 'docs/build/index.html' in a browser."
@echo "\tbuild: Build both the source tarball and wheel."
@echo "\tupload: Upload both the source tarball and wheel to PyPi."
@echo "\tupload_test: Upload both the source tarball and wheel to TestPyPi."
@echo "\ttest: Run tests, using all supported Python versions."
@echo "\tclean: Remove all previous build results, virtual environments, and cache contents."
@echo "\tdistclean: Runs a 'make clean' and removes 'dist/'."