[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/python-project-templates/python-template-cpp/main/Makefile [Back]  [Original]

#########
# BUILD #
#########
.PHONY: develop
develop:  ## setup project for development
	python -m pip install -e .[develop]

.PHONY: build-py build-cpp build
build-py:
	python -m build -w -n

build-cpp:
	python -m hatchling build --hooks-only

build: build-cpp build-py  ## build the project

.PHONY: install
install:  ## install python library
	python -m pip install .

#########
# LINTS #
#########
.PHONY: lint-py lint-cpp lint-docs lint lints
lint-py:  ## run python linter with ruff
	python -m ruff check python_template_cpp
	python -m ruff format --check python_template_cpp

lint-cpp:  ## run cpp linter
	clang-format --dry-run -Werror -i -style=file `find ./cpp -name "*.*pp"`

lint-docs:  ## lint docs with mdformat and codespell
	python -m mdformat --check README.md docs/wiki/
	python -m codespell_lib README.md docs/wiki/

lint: lint-cpp lint-py  ## run project linters

# alias
lints: lint

.PHONY: fix-py fix-cpp fix format
fix-py:  ## fix python formatting with ruff
	python -m ruff check --fix python_template_cpp
	python -m ruff format python_template_cpp

fix-cpp:  ## fix cpp formatting
	clang-format -i -style=file `find ./cpp -name "*.*pp"`

fix-docs:  ## autoformat docs with mdformat and codespell
	python -m mdformat README.md docs/wiki/
	python -m codespell_lib --write README.md docs/wiki/

fix: fix-cpp fix-py fix-docs  ## run project autoformatters

# alias
format: fix

################
# Other Checks #
################
.PHONY: check-dist check-types checks check

check-dist:  ## check python sdist and wheel with check-dist
	check-dist -v

check-types:  ## check python types with ty
	ty check --python $$(which python)

checks: check-dist

# alias
check: checks

#########
# TESTS #
#########
.PHONY: test-py tests-py coverage-py
test-py:  ## run python tests
	python -m pytest -v python_template_cpp/tests

# alias
tests-py: test-py

coverage-py:  ## run python tests and collect test coverage
	python -m pytest -v python_template_cpp/tests --cov=python_template_cpp --cov-report term-missing --cov-report xml

.PHONY: test test-pyodide coverage tests
test: test-py  ## run all tests

test-pyodide:  ## build and test the Python package in Pyodide
	rm -rf dist/pyodide
	uvx --from cibuildwheel==4.2.0 cibuildwheel --only cp314-pyodide_wasm32 --output-dir dist/pyodide .

coverage: coverage-py  ## run all tests and collect test coverage

# alias
tests: test

###########
# VERSION #
###########
.PHONY: show-version patch minor major

show-version:  ## show current library version
	@bump-my-version show current_version

patch:  ## bump a patch version
	@bump-my-version bump patch

minor:  ## bump a minor version
	@bump-my-version bump minor

major:  ## bump a major version
	@bump-my-version bump major

########
# DIST #
########
.PHONY: dist-py-wheel dist-py-sdist dist-check dist publish

dist-py-wheel:  ## build python wheel
	python -m cibuildwheel --output-dir dist

dist-py-sdist:  ## build python sdist
	python -m build --sdist -o dist

dist-check:  ## run python dist checker with twine
	python -m twine check dist/*

dist: clean build dist-py-wheel dist-py-sdist dist-check  ## build all dists

publish: dist  ## publish python assets

#########
# CLEAN #
#########
.PHONY: deep-clean clean

deep-clean: ## clean everything from the repository
	git clean -fdx

clean: ## clean the repository
	rm -rf .coverage coverage cover htmlcov logs build dist *.egg-info

############################################################################################

.PHONY: help

# Thanks to Francoise at marmelab.com for this
.DEFAULT_GOAL := help
help:
	@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

print-%:
	@echo '$*=$($*)'

Web Proxy Viewer  |  New URL  |  Original Page