-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
102 lines (79 loc) · 3.31 KB
/
makefile
File metadata and controls
102 lines (79 loc) · 3.31 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
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
SHELL=/usr/bin/env bash
VERSION=$(shell python -c "import curifactory; print(curifactory.__version__)")
MAMBA=micromamba
ENV_NAME=curifactory
.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: publish
publish: ## build the package and push to pypi
@python -m build
@twine check dist/*
@twine upload dist/* --skip-existing
.PHONY: apply-docs
apply-docs: ## copy current built 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
.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: ## runs unit tests
pytest
.PHONY: testing-envs
testing-envs: ## create envs for running unit tests in python 3.10-3.14
# micromamba create -n cftest310 python=3.10 -y
micromamba create -n cftest310 -f environment.yml python=3.10 -y
micromamba run -n cftest310 pip install -r requirements.txt
# micromamba create -n cftest311 python=3.11 -y
micromamba create -n cftest311 -f environment.yml python=3.11 -y
micromamba run -n cftest311 pip install -r requirements.txt
# micromamba create -n cftest312 python=3.12 -y
micromamba create -n cftest312 -f environment.yml python=3.12 -y
micromamba run -n cftest312 pip install -r requirements.txt
# micromamba create -n cftest313 python=3.13 -y
micromamba create -n cftest313 -f environment.yml python=3.13 -y
micromamba run -n cftest313 pip install -r requirements.txt
# micromamba create -n cftest314 python=3.14 -y
micromamba create -n cftest314 -f environment.yml python=3.14 -y
micromamba run -n cftest314 pip install -r requirements.txt
.PHONY: test-all
test-all: ## runs unit tests in python 3.10-3.14
@echo -e "\n################# PYTHON 3.10 ##################\n"
micromamba run -n cftest310 pytest
@echo -e "\n################# PYTHON 3.11 ##################\n"
micromamba run -n cftest311 pytest
@echo -e "\n################# PYTHON 3.12 ##################\n"
micromamba run -n cftest312 pytest
@echo -e "\n################# PYTHON 3.13 ##################\n"
micromamba run -n cftest313 pytest
@echo -e "\n################# PYTHON 3.14 ##################\n"
micromamba run -n cftest314 pytest
.PHONY: paper-draft
paper-draft: ## build a draft version of the joss paper
docker run --rm \
--volume ./paper:/data \
--user $(id -u):$(id -g) \
--env JOURNAL=joss \
openjournals/inara