-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
105 lines (89 loc) · 3.99 KB
/
Makefile
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
# This will install eo-tides and all required dependencies specified in
# `uv.lock`. To install optional dependencies, run `uv sync --all-extras`
# If running locally, can set `export VIRTUAL_ENV="path"` to control
# location of resulting virtual environment
# Optionally run --resolution lowest-direct
.PHONY: install
install: ## Install the virtual environment and install the pre-commit hooks
@echo "🚀 Creating virtual environment using uv"
@uv sync --all-extras
@uv run pre-commit install
# Install lowest dependencies of eo-tides
.PHONY: install-lowest
install-lowest: ## Install the virtual environment and install the pre-commit hooks
@echo "🚀 Creating virtual environment using uv"
@uv sync --all-extras --resolution lowest-direct
@uv run pre-commit install
.PHONY: check
check: ## Run code quality tools.
@echo "🚀 Checking lock file consistency with 'pyproject.toml'"
@uv lock --locked
@echo "🚀 Linting code: Running pre-commit"
@uv run pre-commit run -a
@echo "🚀 Static type checking: Running mypy"
@uv run mypy
@echo "🚀 Checking for obsolete dependencies: Running deptry"
@uv run deptry . docs/notebooks/
.PHONY: test
test: ## Test the code with pytest
@echo "🚀 Testing code: Running pytest"
@tar --skip-old-files -xzf ./tests/data/tide_models.tar.gz -C ./tests/data
@export EO_TIDES_TIDE_MODELS=./tests/data/tide_models && \
uv run python -m pytest --cov --cov-config=pyproject.toml --cov-report=xml --verbose
@export EO_TIDES_TIDE_MODELS=./tests/data/tide_models && \
uv run python -m pytest --nbval-lax docs/notebooks/ --verbose
.PHONY: test-model
test-model: ## Test model module with pytest
@echo "🚀 Testing model module: Running pytest"
@tar --skip-old-files -xzf ./tests/data/tide_models.tar.gz -C ./tests/data
@export EO_TIDES_TIDE_MODELS=./tests/data/tide_models && \
uv run python -m pytest tests/test_model.py --verbose
.PHONY: test-eo
test-eo: ## Test eo module with pytest
@echo "🚀 Testing eo module: Running pytest"
@tar --skip-old-files -xzf ./tests/data/tide_models.tar.gz -C ./tests/data
@export EO_TIDES_TIDE_MODELS=./tests/data/tide_models && \
uv run python -m pytest tests/test_eo.py --verbose
.PHONY: test-stats
test-stats: ## Test stats module with pytest
@echo "🚀 Testing stats module: Running pytest"
@tar --skip-old-files -xzf ./tests/data/tide_models.tar.gz -C ./tests/data
@export EO_TIDES_TIDE_MODELS=./tests/data/tide_models && \
uv run python -m pytest tests/test_stats.py --verbose
.PHONY: test-utils
test-utils: ## Test utils module with pytest
@echo "🚀 Testing utils module: Running pytest"
@tar --skip-old-files -xzf ./tests/data/tide_models.tar.gz -C ./tests/data
@export EO_TIDES_TIDE_MODELS=./tests/data/tide_models && \
uv run python -m pytest tests/test_utils.py --verbose
.PHONY: test-notebooks
test-notebooks: ## Test notebooks with pytest
@echo "🚀 Testing notebooks: Running pytest"
@tar --skip-old-files -xzf ./tests/data/tide_models.tar.gz -C ./tests/data
@export EO_TIDES_TIDE_MODELS=./tests/data/tide_models && \
uv run python -m pytest --nbval-lax docs/notebooks/ --verbose
.PHONY: build
build: clean-build ## Build wheel file
@echo "🚀 Creating wheel file"
@uvx --from build pyproject-build --installer uv
.PHONY: clean-build
clean-build: ## clean build artifacts
@rm -rf dist
.PHONY: publish
publish: ## Publish a release to PyPI.
@echo "🚀 Publishing."
@uvx twine upload --repository-url https://upload.pypi.org/legacy/ dist/*
.PHONY: build-and-publish
build-and-publish: build publish ## Build and publish.
.PHONY: docs-test
docs-test: ## Test if documentation can be built without warnings or errors
@uv run mkdocs build -s
# On Sandbox: uv run mkdocs serve -a localhost:8000
# https://app.sandbox.dea.ga.gov.au/user/[email protected]/proxy/8000/eo-tides/
.PHONY: docs
docs: ## Build and serve the documentation
@uv run mkdocs serve
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
.DEFAULT_GOAL := help