-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
59 lines (49 loc) · 1.84 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
# Makefile
# Variables
PYTHON = poetry run python
.PHONY: help install data test docs clean clean-data format lint
help:
@echo "Available commands:"
@echo " install - Don't use for user installation! Install project dependencies. Will use poetry.lock file."
@echo " data - Download additional data"
@echo " test - Run tests"
@echo " docs - Generate documentation (README)"
@echo " clean - Clean up temporary files"
@echo " clean-data - Remove additional data"
@echo " format - Autoformat code"
@echo " lint - Check formatting and PEP8 compliance"
@echo " lint-fix - Same like lint but auto applies fixes"
@echo " pre-commit-install - Initialize and update hooks"
install:
poetry install --with dev --with extras
data:
mkdir .data
cd .data && git clone https://github.com/openPMD/openPMD-example-datasets.git
cd .data/openPMD-example-datasets && tar -zxvf example-2d.tar.gz
cd .data/openPMD-example-datasets && tar -zxvf example-3d.tar.gz
test:
poetry run pytest --nbmake README.ipynb
docs:
rm -rf README_files
$(PYTHON) -m nbconvert --to notebook --execute README.ipynb --output README.executed.ipynb
$(PYTHON) -m nbconvert --to markdown README.executed.ipynb --output README.md --TagRemovePreprocessor.enabled=True --TagRemovePreprocessor.remove_cell_tags remove_cell
rm -f README.executed.ipynb
clean:
find . -type d -name '__pycache__' -exec rm -rf {} +
find . -type d -name '*.egg-info' -exec rm -rf {} +
find . -type d -name '*.pytest_cache' -exec rm -rf {} +
rm -rf .mypy_cache .pytest_cache
nb-clean clean README.ipynb
clean-data:
rm -r .data
# Format code and docstrings
format:
poetry run ruff format
# Lint to check if code follows formatting standards
lint:
poetry run ruff check
lint-fix:
poetry run ruff check --fix
pre-commit-install:
pre-commit install
pre-commit autoupdate