GitHub Viewer
#########
# BUILD #
#########
.PHONY: develop-py develop-js develop-rs develop
develop-py:
uv pip install -e .[develop]
develop-js: requirements-js
develop-rs:
make -C rust develop
develop: develop-rs develop-js develop-py ## setup project for development
.PHONY: requirements-py requirements-js requirements-rs requirements
requirements-py: ## install prerequisite python build requirements
uv pip install -r pyproject.toml --extra develop
requirements-js: ## install prerequisite javascript build requirements
cd js; pnpm install && npx playwright install
requirements-rs: ## install prerequisite rust build requirements
make -C rust requirements
requirements: requirements-rs requirements-js requirements-py ## setup project for development
.PHONY: build-py build-js build-rs build
build-py:
python -m build -w -n
build-js:
cd js; pnpm build
build-rs:
make -C rust build
build: build-rs build-js build-py ## build the project
.PHONY: install
install: ## install python library
uv pip install .
#########
# LINTS #
#########
.PHONY: lint-py lint-js lint-rs lint-docs lint lints
lint-py: ## run python linter with ruff
python -m ruff check python_template_rust
python -m ruff format --check python_template_rust
lint-js: ## run js linter
cd js; pnpm lint
lint-rs: ## run rust linter
make -C rust lint
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-rs lint-js lint-py lint-docs ## run project linters
# alias
lints: lint
.PHONY: fix-py fix-js fix-rs fix-docs fix format
fix-py: ## fix python formatting with ruff
python -m ruff check --fix python_template_rust
python -m ruff format python_template_rust
fix-js: ## fix js formatting
cd js; pnpm fix
fix-rs: ## fix rust formatting
make -C rust fix
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-rs fix-js 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_rust/tests
# alias
tests-py: test-py
coverage-py: ## run python tests and collect test coverage
python -m pytest -v python_template_rust/tests --cov=python_template_rust --cov-report term-missing --cov-report xml
.PHONY: test-js tests-js coverage-js
test-js: ## run js tests
cd js; pnpm test
# alias
tests-js: test-js
coverage-js: test-js ## run js tests and collect test coverage
.PHONY: test-rs tests-rs coverage-rs
test-rs: ## run rust tests
make -C rust test
# alias
tests-rs: test-rs
coverage-rs: ## run rust tests and collect test coverage
make -C rust coverage
.PHONY: test test-pyodide coverage tests
test: test-py test-js test-rs ## run all tests
test-pyodide: ## build and test the Python package in Pyodide
rustup target add wasm32-unknown-emscripten
rm -rf dist/pyodide
uvx --from cibuildwheel==4.2.0 cibuildwheel --only cp314-pyodide_wasm32 --output-dir dist/pyodide .
coverage: coverage-py coverage-js coverage-rs ## 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-rs 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-js: # build js dists
cd js; pnpm pack
dist-rs: ## build rust dists
make -C rust dist
dist-check: ## run python dist checker with twine
python -m twine check dist/*
dist: clean build dist-rs dist-js 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 '$*=$($*)'