File: Makefile

package info (click to toggle)
python-cloup 2.0.0.post1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 944 kB
  • sloc: python: 5,193; makefile: 116
file content (128 lines) | stat: -rw-r--r-- 3,382 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
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
.DEFAULT_GOAL := help

REMOVE = python scripts/remove.py
BROWSER = python scripts/browser.py
COPYTREE = python scripts/copytree.py

DOCS_HTML_DIR = docs/_build/html
DOCS_HTML_STATIC = $(DOCS_HTML_DIR)/_static

.PHONY: help
help:
	@python scripts/make-help.py < $(MAKEFILE_LIST)

.PHONY: venv
venv: ## creates a virtualenv using tox
	tox -e dev

.PHONY: install
install: clean ## install the package in dev mode
	pip install -e .

.PHONY: mypy
mypy: ## check code, tests and examples with mypy
	mypy cloup --strict
	mypy tests examples

.PHONY: lint
lint: ## check code, tests and examples with flake8
	flake8 cloup tests examples

.PHONY: test
test: install ## run tests quickly with the default Python
	pytest --cov=cloup -vv

.PHONY: coverage
coverage: test ## check code coverage quickly with the default Python
	coverage report -m
	coverage html
	$(BROWSER) htmlcov/index.html

.PHONY: clean-docs
clean-docs: ## clean the documentation
	$(MAKE) -C docs clean
	$(REMOVE) docs/autoapi

.PHONY: docs
docs: ## generate Sphinx HTML documentation
	$(MAKE) -C docs html

.PHONY: view-docs
view-docs: docs ## open the built docs in the default browser
	$(BROWSER) $(DOCS_HTML_DIR)/index.html

.PHONY: re-docs
re-docs: clean-docs view-docs ## (re)generate Sphinx HTML documentation from scratch

LIVE_DOCS = sphinx-autobuild docs $(DOCS_HTML_DIR) \
	--watch ./**.rst \
	--watch ./cloup/**.py \
	--ignore ./docs/autoapi/**.rst \
	--open-browser

.PHONY: live-docs
live-docs:   ## watch docs files and rebuild the docs when they change
	$(LIVE_DOCS)

.PHONY: live-docs-all
live-docs-all:   ## write all files (useful when working on html/css)
	$(LIVE_DOCS) -a

.PHONY: update-docs-static
update-docs-static:   ## copy docs static files into the build folder
	$(COPYTREE) docs/_static $(DOCS_HTML_STATIC)

.PHONY: update-docs-css
update-docs-css:   ## copy docs css files into the build folder
	$(COPYTREE) docs/_static/styles $(DOCS_HTML_STATIC)/styles

.PHONY: clean
clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts

.PHONY: clean-build
clean-build: ## remove build artifacts
	$(REMOVE) build dist .eggs
	$(REMOVE) -r './**/*.egg-info'
	$(REMOVE) -r './**/*.egg'

.PHONY: clean-pyc
clean-pyc: ## remove Python file artifacts
	$(REMOVE) -r './**/__pycache__'
	$(REMOVE) -r './**/*.pyc'
	$(REMOVE) -r './**/*.pyo'

.PHONY: clean-test
clean-test: ## remove test and coverage artifacts
	$(REMOVE) .tox .coverage htmlcov .pytest_cache

.PHONY: dist
dist: clean-build ## builds source and wheel package
	python setup.py sdist bdist_wheel
	twine check dist/*

.PHONY: release
release: dist ## package and upload a release
	twine upload dist/*

.PHONY: test-release
test-release: dist   ## package and upload a release
	twine upload --repository testpypi dist/*

.PHONY: pip-compile
pip-compile:  ## pin dependencies in requirements/ using the current env
	pip-compile requirements/test.in
	pip-compile requirements/docs.in
	pip-compile requirements/dev.in

.PHONY: pip-upgrade
pip-upgrade:   ## upgrade pip and dependencies
	python -m pip install -U pip
	pip-compile --upgrade requirements/test.in
	pip-compile --upgrade requirements/docs.in
	pip-compile --upgrade requirements/dev.in

.PHONY: pip-sync
pip-sync:  ## sync development environment with requirements/dev.txt
	pip install -U pip-tools
	pip-sync requirements/dev.txt
	pip install -e .