-
Notifications
You must be signed in to change notification settings - Fork 25
/
Makefile
101 lines (81 loc) · 3.02 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
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
# Copyright (c) 2021-2024, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
.PHONY: clean clean-build clean-pyc clean-docs clean-test docs lint test coverage release dist install install-dev 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.ngc.nvidia.com
help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
clean: clean-build clean-pyc clean-test clean-docs ## 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 -f {} +
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/
docs: clean-docs ## generate site
cp CHANGELOG.md docs
cp CONTRIBUTING.md docs
cp LICENSE docs/LICENSE.md
cp examples/README.md docs/examples.md
mkdocs build --clean
docs-serve: docs
mkdocs serve
lint: ## check style with pre-commit and pytype
tox -e pre-commit,pytype --develop
test: ## run tests on every Python version with tox
tox --develop --skip-missing-interpreters
coverage: ## check code coverage quickly with the default Python
coverage run --source model_navigator -m pytest
coverage report -m
coverage html
$(BROWSER) htmlcov/index.html
dist: clean ## builds source and wheel package
python3 -m build .
ls -lh dist
twine check 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]"