|
5 | 5 | # to work in that environment (and not on Windows). |
6 | 6 | # USAGE: OG-Core$ make [TARGET] |
7 | 7 |
|
8 | | -.PHONY=help |
| 8 | +.PHONY: help |
9 | 9 | help: |
10 | 10 | @echo "USAGE: make [TARGET]" |
11 | 11 | @echo "TARGETS:" |
12 | 12 | @echo "help : show help message" |
13 | 13 | @echo "clean : remove .pyc files and local ogcore package" |
14 | 14 | @echo "install : build and install local package" |
15 | | - @echo "pytest : generate report for and cleanup after" |
16 | | - @echo " pytest -W ignore -m ''" |
17 | | - @echo "cstest : generate coding-style errors using the" |
18 | | - @echo " pycodestyle (nee pep8) tool" |
| 15 | + @echo "pytest_all : run all tests" |
| 16 | + @echo "pytest_ci : run same set of tests as GitHub Actions CI" |
19 | 17 | @echo "coverage : generate test coverage report" |
20 | | - @echo "git-sync : synchronize local, origin, and upstream Git repos" |
21 | | - @echo "git-pr N=n : create local pr-n branch containing upstream PR" |
22 | 18 | @echo "documentation : build new Jupyter Book documentation files" |
| 19 | + @echo "format : format code using ruff and linecheck" |
23 | 20 |
|
24 | | -.PHONY=clean |
| 21 | +.PHONY: clean |
25 | 22 | clean: |
26 | | - @find . -name *pyc -exec rm {} \; |
27 | | - @find . -name *cache -maxdepth 1 -exec rm -r {} \; |
28 | | - @conda uninstall ogcore --yes --quiet 2>&1 > /dev/null |
| 23 | + @find . -name '*.pyc' -delete |
| 24 | + @find . -maxdepth 1 -name '*cache' -exec rm -r {} + |
29 | 25 |
|
30 | | -.PHONY=install |
| 26 | +.PHONY: install |
31 | 27 | install: |
32 | | - pip install -e .[dev] |
| 28 | + uv sync --extra dev --extra docs |
33 | 29 |
|
34 | | -.PHONY=pytest |
35 | | -pytest: |
36 | | - @cd ogcore ; pytest -W ignore |
| 30 | +.PHONY: pytest_all |
| 31 | +pytest_all: |
| 32 | + uv run python -m pytest |
37 | 33 |
|
38 | | -ogcore_JSON_FILES := $(shell ls -l ./ogcore/*json | awk '{print $$9}') |
| 34 | +.PHONY: pytest_ci |
| 35 | +pytest_ci: |
| 36 | + uv run python -m pytest -m "not local and not benchmark" |
39 | 37 |
|
40 | | -.PHONY=cstest |
41 | | -cstest: |
42 | | - -pycodestyle ogcore |
43 | | - -pycodestyle --ignore=E501,E121 $(ogcore_JSON_FILES) |
| 38 | +ogcore_JSON_FILES := $(shell ls -l ./ogcore/*json | awk '{print $$9}') |
44 | 39 |
|
45 | 40 | define coverage-cleanup |
46 | 41 | rm -f .coverage htmlcov/* |
47 | 42 | endef |
48 | 43 |
|
49 | | -COVMARK = "" |
| 44 | +COVMARK = "not local and not benchmark" |
50 | 45 |
|
51 | 46 | OS := $(shell uname -s) |
52 | 47 |
|
53 | | -.PHONY=coverage |
| 48 | +.PHONY: coverage |
54 | 49 | coverage: |
55 | 50 | @$(coverage-cleanup) |
56 | | - @coverage run -m pytest -v -m $(COVMARK) > /dev/null |
57 | | - @coverage html --ignore-errors |
| 51 | + uv run python -m pytest -m $(COVMARK) -n 4 --cov=ogcore --cov-report=html --cov-report=term |
58 | 52 | ifeq ($(OS), Darwin) # on Mac OS X |
59 | 53 | @open htmlcov/index.html |
60 | 54 | else |
61 | 55 | @echo "Open htmlcov/index.html in browser to view report" |
62 | 56 | endif |
63 | | - @$(pytest-cleanup) |
64 | 57 |
|
65 | | -.PHONY=documentation |
| 58 | +.PHONY: documentation |
66 | 59 | documentation: |
67 | | - uv run python -m ipykernel install --user --name=ogcore-dev |
68 | | - uv run jb clean docs |
69 | | - uv run python ./docs/make_params.py |
70 | | - uv run python ./docs/make_vars.py |
71 | | - uv run jb build ./docs/book |
| 60 | + uv run --extra docs python -m ipykernel install --user --name=ogcore-dev |
| 61 | + uv run --extra docs jb clean docs |
| 62 | + uv run --extra docs python ./docs/make_params.py |
| 63 | + uv run --extra docs python ./docs/make_vars.py |
| 64 | + uv run --extra docs jb build ./docs/book |
72 | 65 |
|
| 66 | +.PHONY: format |
73 | 67 | format: |
74 | 68 | uv run ruff format . |
75 | 69 | uv run ruff check . --fix |
76 | 70 | uv run linecheck . --fix |
77 | 71 |
|
| 72 | +.PHONY: pip-package |
78 | 73 | pip-package: |
79 | 74 | uv build |
0 commit comments