Skip to content

Commit a02459b

Browse files
committed
Add shortcuts for common dev tasks
1 parent 042387b commit a02459b

6 files changed

Lines changed: 65 additions & 0 deletions

File tree

Makefile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
help:
2+
@echo "Available targets:\n\
3+
clean - remove build files and directories\n\
4+
setup - create mamba developer environment\n\
5+
lint - run code formatters and linters\n\
6+
test - run automated test suite\n\
7+
dist - generate release archives\n\
8+
\n\
9+
Remember to 'mamba activate scyjava-dev' first!"
10+
11+
clean:
12+
bin/clean.sh
13+
14+
setup:
15+
bin/setup.sh
16+
17+
check:
18+
@bin/check.sh
19+
20+
lint: check
21+
bin/lint.sh
22+
23+
test: check
24+
bin/test.sh
25+
26+
dist: check
27+
python -m build
28+
29+
.PHONY: test

bin/check.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
3+
case "$CONDA_PREFIX" in
4+
*/scyjava-dev)
5+
;;
6+
*)
7+
echo "Please run 'make setup' and then 'mamba activate scyjava-dev' first."
8+
exit 1
9+
;;
10+
esac

bin/clean.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
3+
dir=$(dirname "$0")
4+
cd "$dir/.."
5+
6+
find . -name __pycache__ -type d | while read d
7+
do rm -rf "$d"
8+
done
9+
rm -rf .pytest_cache build dist src/*.egg-info

bin/lint.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
3+
dir=$(dirname "$0")
4+
cd "$dir/.."
5+
6+
black src tests
7+
python -m flake8 src tests

bin/setup.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
3+
dir=$(dirname "$0")
4+
cd "$dir/.."
5+
6+
mamba env create -f dev-environment.yml

bin/test.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
#!/bin/sh
2+
3+
dir=$(dirname "$0")
4+
cd "$dir/.."
5+
26
python -m pytest tests/ -p no:faulthandler $@

0 commit comments

Comments
 (0)