10000 add makefile to automate setup · wolfmib/pyscript_tutorial@534a6a6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 534a6a6

Browse files
committed
add makefile to automate setup
1 parent 9334592 commit 534a6a6

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

pyscriptjs/Makefile

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
tag := latest
2+
git_hash ?= $(shell git log -1 --pretty=format:%h)
3+
4+
base_dir ?= $(shell git rev-parse --show-toplevel)
5+
src_dir ?= $(base_dir)/src
6+
examples ?= $(base_dir)/examples
7+
app_dir ?= $(shell git rev-parse --show-prefix)
8+
9+
CONDA_ENV ?= ./env
10+
env := $(CONDA_ENV)
11+
12+
13+
.PHONY: clean
14+
clean:
15+
find . -name \*.py[cod] -delete
16+
rm -rf .pytest_cache .coverage coverage.xml
17+
18+
clean-all: clean
19+
rm -rf $(env) *.egg-info
20+
21+
.PHONY: setup
22+
setup:
23+
@if [ -z "$${CONDA_SHLVL:+x}" ]; then echo "Conda is not installed." && exit 1; fi
24+
$(CONDA_EXE) env $(shell [ -d $(env) ] && echo update || echo create) -p $(env) --file environmentwh.yml
25+
26+
.PHONY: shell
27+
shell:
28+
@export CONDA_ENV_PROMPT='<{name}>'
29+
@echo 'conda activate $(env)'
30+
31+
.PHONY: dev
32+
dev:
33+
npm run dev
34+
35+
.PHONY: build
36+
build:
37+
npm run build
38+
39+
.PHONY: test
40+
test:
41+
@echo "Tests are coming :( this is a placeholder and it's meant to fail!"
42+
$(env)/bin/pytest -vv $(ARGS) tests/ --log-cli-level=warning
43+
44+
.PHONY: test-py
45+
test-py:
46+
@echo "Tests are coming :( this is a placeholder and it's meant to fail!"
47+
$(env)/bin/pytest -vv $(ARGS) tests/ --log-cli-level=warning
48+
49+
.PHONY: test-ts
50+
test-ts:
51+
@echo "Tests are coming :( this is a placeholder and it's meant to fail!"
52+
npm run tests
53+
54+
.PHONY: fmt
55+
fmt:
56+
$(env)/bin/black -l 88 .
57+
58+
.PHONY: fmt-check
59+
fmt-check:
60+
$(env)/bin/black -l 88 --check .
61+
62+
.PHONY: fmt-ts
63+
fmt-ts:
64+
npm run format
65+
66+
.PHONY: fmt-ts-check
67+
fmt-ts-check:
68+
npm run format:check
69+
70+
.PHONY: fmt-py
71+
fmt-py:
72+
$(env)/bin/black -l 88 .
73+
74+
.PHONY: fmt-py-check
75+
fmt-py-check:
76+
$(env)/bin/black -l 88 --check .
77+
78+
.PHONY: lint
79+
lint:
80+
npm run lint
81+
82+
.PHONY: lint-js
83+
lint-js:
84+
npm run lint

0 commit comments

Comments
 (0)
0