-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
100 lines (85 loc) · 2.09 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
VENV = .venv
PYTHON = $(VENV)/bin/python3
PIP = $(VENV)/bin/pip
VENV-DOCS = .venv-docs
PYTHON-DOCS = $(VENV-DOCS)/bin/python3
PIP-DOCS = $(VENV-DOCS)/bin/pip
.PHONY: rm-git-cache
rm-git-cache:
@echo "Removing git cached files"
git rm -r --cached .
git add .
.PHONY: clean
clean:
@echo "Cleaning repository"
rm -rf build
rm -rf dist
rm -rf app
rm -rf *.db
rm -rf src/*.egg-info
rm -rf .pytest_cache
rm -rf test/*.log
rm -rf ${VENV}
rm -rf ${VENV-DOCS}
.PHONY: setup
setup:
@if [ ! -d "${VENV}" ]; then \
echo "Creating venv"; \
python3.11 -m venv ${VENV}; \
fi
echo "Venv already exists"; \
source ${VENV}/bin/activate; \
pip install --upgrade pip; \
pip install poetry; \
poetry config virtualenvs.create false; \
poetry install; \
# https://johnfraney.ca/blog/create-publish-python-package-poetry/
.PHONY: build
build:
@echo "Building package"
source ${VENV}/bin/activate && \
poetry build
.PHONY: test
test:
@echo "Running tests"
source ${VENV}/bin/activate && \
python3 -m test.test
.PHONY: install
install:
@echo "Installing package"
source ${VENV}/bin/activate && \
rm -rf poetry.lock && \
poetry install
.PHONY: publish
# https://stackoverflow.com/questions/68882603/using-python-poetry-to-publish-to-test-pypi-org poetry version patch &&
publish:
@echo "Publishing package"
source ${VENV}/bin/activate && \
poetry install && \
poetry build && \
poetry publish -r testpypi && \
poetry publish
#.PHONY: deploy
#deploy:
# python setup.py check \
# python setup.py sdist bdist_wheel \
# pip install . \
# python3 -m twine upload --repository testpypi dist/* \
# python3 -m twine upload --repository pypi dist/*
setup-docs:
@if [ ! -d "${VENV-DOCS}" ]; then \
echo "Creating venv"; \
python3.11 -m venv ${VENV-DOCS}; \
fi
echo "Venv already exists"; \
source ${VENV-DOCS}/bin/activate; \
pip install --upgrade pip; \
pip install poetry; \
poetry config virtualenvs.create false; \
poetry install --with docs;
build-docs:
# @echo "Copying README to docs"
# cp README.md docs/intro.md
@echo "Building docs"
source ${VENV-DOCS}/bin/activate && \
jupyter-book build docs