-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
113 lines (85 loc) · 3.24 KB
/
Makefile
File metadata and controls
113 lines (85 loc) · 3.24 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
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
.PHONY: clean clean-build clean-pyc clean-docs clean-test clean-notebooks docs lint test coverage release dist install install-dev install-dev-deps help
.DEFAULT_GOAL := help
define BROWSER_PYSCRIPT
import os, webbrowser, sys
from urllib.request import pathname2url
webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
endef
export BROWSER_PYSCRIPT
define PRINT_HELP_PYSCRIPT
import re, sys
for line in sys.stdin:
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
print("%-20s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT
BROWSER := python -c "$$BROWSER_PYSCRIPT"
PIP_INSTALL := pip install --extra-index-url https://pypi.nvidia.com
help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
clean: clean-build clean-pyc clean-test clean-docs clean-notebooks ## remove all build, test, docs, coverage and Python artifacts
clean-build: ## remove build artifacts
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -not -path "./.cache/*" -exec rm -fr {} +
find . -name '*.egg' -not -path "./.cache/*" -exec rm -fr {} +
clean-pyc: ## remove Python file artifacts
find . -name '*.pyc' -not -path "./.cache/*" -exec rm -f {} +
find . -name '*.pyo' -not -path "./.cache/*" -exec rm -f {} +
find . -name '*~' -not -path "./.cache/*" -exec rm -f {} +
find . -name '__pycache__' -not -path "./.cache/*" -exec rm -fr {} +
clean-docs: ## remove test and coverage artifacts
rm -rf site
clean-test: ## remove test and coverage artifacts
rm -fr .tox/
rm -f .coverage
rm -fr htmlcov/
rm -fr .pytest_cache
rm -fr .pytype/
rm -fr .coverage*
rm -f *-report.xml
clean-notebooks: ## remove Jupyter notebook output cells
@echo "Cleaning notebook outputs..."
find . -name '*.ipynb' -not -path "./.cache/*" -exec jupyter nbconvert --clear-output --inplace {} \;
docs: # TBD: uncomment after vdr clean-docs ## generate site
cp CHANGELOG.md docs
cp CONTRIBUTING.md docs
cp LICENSE docs/LICENSE.md
@mkdir -p docs/examples
cp examples/README.md docs/examples/examples.md
# Copy example subdirectory READMEs with directory structure
@find examples -maxdepth 2 -mindepth 2 -name 'README.md' -type f | while read -r file; do \
subdir=$$(dirname "$$file" | sed 's|^examples/||'); \
mkdir -p "docs/examples/$$subdir"; \
cp "$$file" "docs/examples/$$subdir/README.md"; \
done
mkdocs build --clean
docs-serve: docs
mkdocs serve
lint: ## check style with pre-commit and pytype
pre-commit run --all-files
pytype aitune tests -j auto
test: ## run tests on
pytest
all-tests: ## run all tests for all python versions
tox --develop --skip-missing-interpreters
coverage: ## check code coverage quickly with the default Python
coverage run --source aitune -m pytest
coverage report -m
coverage html
$(BROWSER) htmlcov/index.html
dist: clean ## builds source and wheel package
python3 -m build .
ls -lh dist
install: clean ## install the package to the active Python's site-packages
$(PIP_INSTALL) --upgrade pip
$(PIP_INSTALL) .
install-dev: clean-build clean-pyc clean-test
$(PIP_INSTALL) --upgrade pip
$(PIP_INSTALL) -e ".[dev]"
-include *.mk