Repository navigation
Expand file tree
/
Copy pathmakefile
More file actions
70 lines (58 loc) · 2.71 KB
/
Copy pathmakefile
File metadata and controls
70 lines (58 loc) · 2.71 KB
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
SHELL=/usr/bin/env bash
VERSION=$(shell python -c "import reno; print(reno.__version__)")
MAMBA=micromamba
ENV_NAME=reno
.PHONY: help
help: ## display all the make commands
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: setup
setup: ## make a micromamba development environment and set it up (VARS: MAMBA, ENV_NAME)
$(MAMBA) env create -n $(ENV_NAME) -f environment.yml -y
$(MAMBA) run -n $(ENV_NAME) pip install -r requirements.txt
$(MAMBA) run -n $(ENV_NAME) pre-commit install
@echo -e "Environment created, activate with:\n\n$(MAMBA) activate $(ENV_NAME)"
.PHONY: pre-commit
pre-commit: ## run all of the pre-commit checks.
@pre-commit run --all-files
.PHONY: angry
angry: ## run the super angry linter
pylint --output-format=colorized reno
.PHONY: style
style: ## run autofixers and linters
black .
flake8
isort .
.PHONY: clean
clean: ## remove auto-generated cruft files
find . -type f -name "*.DS_Store" -ls -delete
find . | grep -E "(__pycache__|\.pyc|\.pyo)" | xargs rm -rf
find . | grep -E ".pytest_cache" | xargs rm -rf
find . | grep -E ".ipynb_checkpoints" | xargs rm -rf
.PHONY: test
test: ## run unit tests
$(MAMBA) run -n $(ENV_NAME) pytest
.PHONY: run
run: ## run the standalone web explorer
$(MAMBA) run -n $(ENV_NAME) python -m reno.explorer --websocket-origin localhost:5006
.PHONY: test-api
test-api: ## tell the reno explorer to run a prior run
curl -X POST localhost:5006/api/run_prior -H "Content-Type: application/json" --data '{"free_refs": {"water_level_0": "1.0"}}'
.PHONY: example_models
example_models: ## save the example models so the explorer can find them
$(MAMBA) run -n $(ENV_NAME) python -c "from reno.examples.tub import tub; tub.save('work_sessions/models/tub.json')"
$(MAMBA) run -n $(ENV_NAME) python -c "from reno.examples.lotka_volterra import predator_prey; predator_prey.save('work_sessions/models/predator_prey.json')"
$(MAMBA) run -n $(ENV_NAME) python -c "from reno.examples.one_compartment import one_compartment_model; one_compartment_model.save('work_sessions/models/one_compartment.json')"
$(MAMBA) run -n $(ENV_NAME) python -c "from reno.examples.urban_growth import urban_growth; urban_growth.save('work_sessions/models/urban_growth.json')"
.PHONY: publish
publish: ## build and upload latest version to pypi
@python -m build
@twine check dist/*
@twine upload dist/* --skip-existing
.PHONY: apply-docs
apply-docs: ## copy current sphinx documentation into version-specific docs/ folder
-@unlink docs/stable
@echo "Copying documentation to docs/$(VERSION)"
-@rm -rf docs/$(VERSION)
@cp -r sphinx/build/html docs/$(VERSION)
@echo "Linking to docs/stable"
@ln -s $(VERSION)/ docs/stable