mirror of
https://github.com/sstent/go-garminconnect.git
synced 2026-01-26 09:01:38 +00:00
sync
This commit is contained in:
104
python-garminconnect/Makefile
Normal file
104
python-garminconnect/Makefile
Normal file
@@ -0,0 +1,104 @@
|
||||
.DEFAULT_GOAL := all
|
||||
sources = garminconnect tests
|
||||
|
||||
.PHONY: .pdm ## Check that PDM is installed
|
||||
.pdm:
|
||||
@pdm -V || echo 'Please install PDM: https://pdm.fming.dev/latest/\#installation'
|
||||
|
||||
.PHONY: .pre-commit ## Check that pre-commit is installed
|
||||
.pre-commit:
|
||||
@pre-commit -V || echo 'Please install pre-commit: https://pre-commit.com/'
|
||||
|
||||
.PHONY: install ## Install the package, dependencies, and pre-commit for local development
|
||||
install: .pdm .pre-commit
|
||||
pdm install --group :all
|
||||
pre-commit install --install-hooks
|
||||
|
||||
.PHONY: refresh-lockfiles ## Sync lockfiles with requirements files.
|
||||
refresh-lockfiles: .pdm
|
||||
pdm update --update-reuse --group :all
|
||||
|
||||
.PHONY: rebuild-lockfiles ## Rebuild lockfiles from scratch, updating all dependencies
|
||||
rebuild-lockfiles: .pdm
|
||||
pdm update --update-eager --group :all
|
||||
|
||||
.PHONY: format ## Auto-format python source files
|
||||
format: .pdm
|
||||
pdm run isort $(sources)
|
||||
pdm run black -l 79 $(sources)
|
||||
pdm run ruff check $(sources)
|
||||
|
||||
.PHONY: lint ## Lint python source files
|
||||
lint: .pdm
|
||||
pdm run isort --check-only $(sources)
|
||||
pdm run ruff check $(sources)
|
||||
pdm run black -l 79 $(sources) --check --diff
|
||||
pdm run mypy $(sources)
|
||||
|
||||
.PHONY: codespell ## Use Codespell to do spellchecking
|
||||
codespell: .pre-commit
|
||||
pre-commit run codespell --all-files
|
||||
|
||||
.PHONY: .venv ## Install virtual environment
|
||||
.venv:
|
||||
python3 -m venv .venv
|
||||
|
||||
.PHONY: install ## Install package
|
||||
install: .venv
|
||||
pip3 install -qUe .
|
||||
|
||||
.PHONY: install-test ## Install package in development mode
|
||||
install-test: .venv install
|
||||
pip3 install -qU -r requirements-test.txt
|
||||
|
||||
.PHONY: test ## Run tests
|
||||
test:
|
||||
pytest --cov=garminconnect --cov-report=term-missing
|
||||
|
||||
.PHONY: test ## Run all tests, skipping the type-checker integration tests
|
||||
test: .pdm
|
||||
pdm run coverage run -m pytest -v --durations=10
|
||||
|
||||
.PHONY: testcov ## Run tests and generate a coverage report, skipping the type-checker integration tests
|
||||
testcov: test
|
||||
@echo "building coverage html"
|
||||
@pdm run coverage html
|
||||
@echo "building coverage xml"
|
||||
@pdm run coverage xml -o coverage/coverage.xml
|
||||
|
||||
.PHONY: publish ## Publish to PyPi
|
||||
publish: .pdm
|
||||
pdm build
|
||||
twine upload dist/*
|
||||
|
||||
.PHONY: all ## Run the standard set of checks performed in CI
|
||||
all: lint typecheck codespell testcov
|
||||
|
||||
.PHONY: clean ## Clear local caches and build artifacts
|
||||
clean:
|
||||
find . -type d -name __pycache__ -exec rm -r {} +
|
||||
find . -type f -name '*.py[co]' -exec rm -f {} +
|
||||
find . -type f -name '*~' -exec rm -f {} +
|
||||
find . -type f -name '.*~' -exec rm -f {} +
|
||||
rm -rf .cache
|
||||
rm -rf .pytest_cache
|
||||
rm -rf .ruff_cache
|
||||
rm -rf htmlcov
|
||||
rm -rf *.egg-info
|
||||
rm -f .coverage
|
||||
rm -f .coverage.*
|
||||
rm -rf build
|
||||
rm -rf dist
|
||||
rm -rf site
|
||||
rm -rf docs/_build
|
||||
rm -rf docs/.changelog.md docs/.version.md docs/.tmp_schema_mappings.html
|
||||
rm -rf fastapi/test.db
|
||||
rm -rf coverage.xml
|
||||
|
||||
|
||||
.PHONY: help ## Display this message
|
||||
help:
|
||||
@grep -E \
|
||||
'^.PHONY: .*?## .*$$' $(MAKEFILE_LIST) | \
|
||||
sort | \
|
||||
awk 'BEGIN {FS = ".PHONY: |## "}; {printf "\033[36m%-19s\033[0m %s\n", $$2, $$3}'
|
||||
Reference in New Issue
Block a user