File: Makefile

package info (click to toggle)
python-toonapi 0.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 224 kB
  • sloc: python: 708; xml: 325; makefile: 97
file content (114 lines) | stat: -rw-r--r-- 2,984 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
.DEFAULT_GOAL := help
export VENV := $(abspath venv)
export PATH := ${VENV}/bin:${PATH}

define BROWSER_PYSCRIPT
import os, webbrowser, sys

try:
	from urllib import pathname2url
except:
	from urllib.request import pathname2url

webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
endef
export BROWSER_PYSCRIPT

BROWSER := python -c "$$BROWSER_PYSCRIPT"

.PHONY: help
help: ## Shows this message.
	@echo "Asynchronous Python client for the Quby ToonAPI."; \
	echo; \
	echo "Usage:"; \
	awk -F ':|##' '/^[^\t].+?:.*?##/ {\
		printf "\033[36m  make %-30s\033[0m %s\n", $$1, $$NF \
	}' $(MAKEFILE_LIST)

.PHONY: dev
dev: install-dev install ## Set up a development environment.

.PHONY: black
black: lint-black

.PHONY: lint
lint: lint-black lint-flake8 lint-pylint lint-mypy ## Run all linters.

.PHONY: lint-black
lint-black: ## Run linting using black & blacken-docs.
	black --safe --target-version py36 toonapi tests examples; \
	blacken-docs --target-version py36

.PHONY: lint-flake8
lint-flake8: ## Run linting using flake8 (pycodestyle/pydocstyle).
	flake8 toonapi

.PHONY: lint-pylint
lint-pylint: ## Run linting using PyLint.
	pylint toonapi

.PHONY: lint-mypy
lint-mypy: ## Run linting using MyPy.
	mypy -p toonapi

.PHONY: test
test: ## Run tests quickly with the default Python.
	pytest --cov-report html --cov-report term --cov-report xml:cov.xml --cov=toonapi .;

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

.PHONY: install
install: clean ## Install the package to the active Python's site-packages.
	pip install -Ur requirements.txt; \
	pip install -e .;

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

.PHONY: clean-build
clean-build: ## Removes build artifacts.
	rm -fr build/; \
	rm -fr dist/; \
	rm -fr .eggs/; \
	find . -name '*.egg-info' -exec rm -fr {} +; \
	find . -name '*.egg' -exec rm -fr {} +;

.PHONY: clean-pyc
clean-pyc: ## Removes Python file artifacts.
	find . -name '*.pyc' -delete; \
	find . -name '*.pyo' -delete; \
	find . -name '*~' -delete; \
	find . -name '__pycache__' -exec rm -fr {} +;

.PHONY: clean-test
clean-test: ## Removes test and coverage artifacts.
	rm -f .coverage; \
	rm -fr htmlcov/; \
	rm -fr .pytest_cache;

.PHONY: clean-venv
clean-venv: ## Removes Python virtual environment artifacts.
	rm -fr venv/;

.PHONY: dist
dist: clean ## Builds source and wheel package.
	python setup.py sdist; \
	python setup.py bdist_wheel; \
	ls -l dist;

.PHONY: release
release:  ## Release build on PyP
	twine upload dist/*

.PHONY: venv
venv: clean-venv ## Create Python venv environment.
	python3 -m venv venv;

.PHONY: install-dev
install-dev: clean
	pip install -Ur requirements_dev.txt; \
	pip install -Ur requirements_test.txt; \
	pre-commit install;