|
| 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 | +conda_run := conda run -p $(env) |
| 12 | + |
| 13 | +.PHONY: setup |
| 14 | +setup: |
| 15 | + @if [ -z "$${CONDA_SHLVL:+x}" ]; then echo "Conda is not installed." && exit 1; fi |
| 16 | + $(CONDA_EXE) env $(shell [ -d $(env) ] && echo update || echo create) -p $(env) --file environment.yml |
| 17 | + |
| 18 | +.PHONY: clean |
| 19 | +clean: |
| 20 | + find . -name \*.py[cod] -delete |
| 21 | + rm -rf .pytest_cache .coverage coverage.xml |
| 22 | + |
| 23 | +clean-all: clean |
| 24 | + rm -rf $(env) *.egg-info |
| 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 | + $(conda_run) 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 | + $(conda_run) 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: fmt-py fmt-ts |
| 56 | + @echo "Format completed" |
| 57 | + |
| 58 | +.PHONY: fmt-check |
| 59 | +fmt-check: fmt-ts-check fmt-py |
| 60 | + @echo "Format check completed" |
| 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 | + $(conda_run) black -l 88 . |
| 73 | + |
| 74 | +.PHONY: fmt-py-check |
| 75 | +fmt-py-check: |
| 76 | + $(conda_run) black -l 88 --check . |
| 77 | + |
| 78 | +.PHONY: lint |
| 79 | +lint: lint-ts |
| 80 | + @echo "Format check completed" |
| 81 | + |
| 82 | +.PHONY: lint-ts |
| 83 | +lint-ts: |
| 84 | + $(conda_run) npm run lint |
0 commit comments