-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
68 lines (51 loc) · 1.52 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
.PHONY: clean lint bandit black check mypy pycodestyle ruff test build api-docs docs
PKG := hexabyte
SRC_DIR := $(PKG)
BUILD_DIR := build
ARTIFACT_DIR := dist
TEST_DIR := tests
DOCS_DIR := docs
DOCS_SRC_DIR := $(DOCS_DIR)/source
DOCS_SRC_FILES := $(wildcard $(DOCS_SRC_DIR)/*.rst)
DOCS_SRC_FILES += $(wildcard $(DOCS_SRC_DIR)/*.md)
DOCS_HTML_DIR := $(BUILD_DIR)/html
build: .venv
@echo "*****Packaging $(PKG)*****"
@poetry build -n
.venv:
@echo "*****Creating Python Virtual Environment*****"
@poetry install -q -n
clean:
@rm -rf $(BUILD_DIR) $(ARTIFACT_DIR) .mypy_cache .pytest_cache ./*/__pycache__ reports .coverage
check: .venv
@echo "*****Pre-Commit Checks*****"
@pre-commit run --all-files
lint: bandit black ruff pydocstyle pycodestyle
analyze: pylint mypy
bandit: .venv
@echo "*****Bandit*****"
bandit -r --exit-zero $(SRC_DIR)
bandit_ci: .venv
bandit -r -v -f xml -o reports/bandit.xml $(SRC_DIR)
black: .venv
@echo "*****Black*****"
@black --check $(SRC_DIR)
mypy: .venv
@echo "*****Mypy*****"
@mypy --pretty --disable-error-code import $(SRC_DIR)
pydocstyle: .venv
@echo "*****Pydocstyle*****"
@pydocstyle $(SRC_DIR)
pylint: .venv
@echo "*****Pylint*****"
@pylint .
ruff: .venv
@echo "*****Ruff*****"
@ruff check --config pyproject.toml --show-source -e .
test: .venv
@echo "*****Pytest*****"
@pytest
api-docs:
sphinx-apidoc --ext-autodoc --ext-doctest --ext-todo --ext-coverage --ext-githubpages -o $(DOCS_SRC_DIR) $(SRC_DIR)
docs: $(DOCS_SRC_FILES)
sphinx-build -b html $(DOCS_SRC_DIR) $(DOCS_HTML_DIR)