11# Project settings
2- PROJECT := python_anvil
3- PACKAGE := anvil_api
4- REPOSITORY := aalmazan /python-anvil
2+ PROJECT := python-anvil
3+ PACKAGE := python_anvil
4+ REPOSITORY := anvilco /python-anvil
55
66# Project paths
77PACKAGES := $(PACKAGE ) tests
88CONFIG := $(wildcard * .py)
99MODULES := $(wildcard $(PACKAGE ) /* .py)
1010
11- # Virtual environment paths
12- VIRTUAL_ENV ?= .venv
13-
1411# MAIN TASKS ##################################################################
1512
1613.PHONY : all
@@ -27,10 +24,6 @@ watch: install .clean-test ## Continuously run all CI tasks when files chanage
2724run : install
2825 poetry run python $(PACKAGE ) /__main__.py
2926
30- .PHONY : ipython # # Launch an IPython session
31- ipython : install
32- poetry run ipython --ipython-dir=notebooks
33-
3427# SYSTEM DEPENDENCIES #########################################################
3528
3629.PHONY : doctor
@@ -39,12 +32,14 @@ doctor: ## Confirm system dependencies are available
3932
4033# PROJECT DEPENDENCIES ########################################################
4134
35+ VIRTUAL_ENV ?= .venv
4236DEPENDENCIES := $(VIRTUAL_ENV ) /.poetry-$(shell bin/checksum pyproject.toml poetry.lock)
4337
4438.PHONY : install
4539install : $(DEPENDENCIES ) .cache
4640
4741$(DEPENDENCIES ) : poetry.lock
42+ @ rm -rf $(VIRTUAL_ENV ) /.poetry-*
4843 @ poetry config virtualenvs.in-project true
4944 poetry install
5045 @ touch $@
@@ -62,18 +57,18 @@ endif
6257
6358.PHONY : format
6459format : install
65- poetry run isort $(PACKAGES ) notebooks
66- poetry run black $(PACKAGES ) notebooks
60+ poetry run isort $(PACKAGE ) tests
61+ poetry run black $(PACKAGE ) tests
6762 @ echo
6863
6964.PHONY : check
7065check : install format # # Run formaters, linters, and static analysis
7166ifdef CI
7267 git diff --exit-code
7368endif
74- poetry run mypy $(PACKAGES) --config-file=.mypy.ini
75- poetry run pylint $(PACKAGES) --rcfile=.pylint.ini
76- poetry run pydocstyle $(PACKAGES) $(CONFIG)
69+ poetry run mypy $(PACKAGE) tests --config-file=.mypy.ini
70+ poetry run pylint $(PACKAGE) tests --rcfile=.pylint.ini
71+ poetry run pydocstyle $(PACKAGE) tests
7772
7873# TESTS #######################################################################
7974
@@ -94,21 +89,33 @@ test-unit: install
9489 @ ( mv $( FAILURES) $( FAILURES) .bak || true ) > /dev/null 2>&1
9590 poetry run pytest $(PACKAGE ) $(PYTEST_OPTIONS )
9691 @ ( mv $( FAILURES) .bak $( FAILURES) || true ) > /dev/null 2>&1
97- poetry run coveragespace $(REPOSITORY ) unit
92+ ifndef DISABLE_COVERAGE
93+ poetry run coveragespace update unit
94+ endif
9895
9996.PHONY : test-int
10097test-int : install
10198 @ if test -e $( FAILURES) ; then poetry run pytest tests $( PYTEST_RERUN_OPTIONS) ; fi
10299 @ rm -rf $(FAILURES )
103100 poetry run pytest tests $(PYTEST_OPTIONS )
104- poetry run coveragespace $(REPOSITORY ) integration
101+ ifndef DISABLE_COVERAGE
102+ poetry run coveragespace update integration
103+ endif
105104
106105.PHONY : test-all
107106test-all : install
108- @ if test -e $( FAILURES) ; then poetry run pytest $( PACKAGES ) $( PYTEST_RERUN_OPTIONS) ; fi
107+ @ if test -e $( FAILURES) ; then poetry run pytest $( PACKAGE ) tests $( PYTEST_RERUN_OPTIONS) ; fi
109108 @ rm -rf $(FAILURES )
110- poetry run pytest $(PACKAGES ) $(PYTEST_OPTIONS )
111- poetry run coveragespace $(REPOSITORY ) overall
109+ poetry run pytest $(PACKAGE ) tests $(PYTEST_OPTIONS )
110+ ifndef DISABLE_COVERAGE
111+ poetry run coveragespace update overall
112+ endif
113+
114+ .PHONY : tox
115+ # Export PACKAGES so tox doesn't have to be reconfigured if these change
116+ tox : export TESTS = $(PACKAGE ) tests
117+ tox : install
118+ poetry run tox
112119
113120.PHONY : read-coverage
114121read-coverage :
@@ -132,8 +139,8 @@ $(MKDOCS_INDEX): docs/requirements.txt mkdocs.yml docs/*.md
132139 poetry run mkdocs build --clean --strict
133140
134141docs/requirements.txt : poetry.lock
135- @ poetry run pip freeze -qqq | grep mkdocs > $@
136- @ poetry run pip freeze -qqq | grep Pygments >> $@
142+ @ poetry export --dev --without-hashes | grep mkdocs > $@
143+ @ poetry export --dev --without-hashes | grep pygments >> $@
137144
138145.PHONY : uml
139146uml : install docs/* .png
@@ -150,7 +157,7 @@ mkdocs-serve: mkdocs
150157# BUILD #######################################################################
151158
152159DIST_FILES := dist/*.tar.gz dist/*.whl
153- EXE_FILES := dist/$(PROJECT ) .*
160+ EXE_FILES := dist/$(PACKAGE ) .*
154161
155162.PHONY : dist
156163dist : install $(DIST_FILES )
@@ -160,20 +167,20 @@ $(DIST_FILES): $(MODULES) pyproject.toml
160167
161168.PHONY : exe
162169exe : install $(EXE_FILES )
163- $(EXE_FILES ) : $(MODULES ) $(PROJECT ) .spec
170+ $(EXE_FILES ) : $(MODULES ) $(PACKAGE ) .spec
164171 # For framework/shared support: https://github.com/yyuu/pyenv/wiki
165- poetry run pyinstaller $(PROJECT ) .spec --noconfirm --clean
172+ poetry run pyinstaller $(PACKAGE ) .spec --noconfirm --clean
166173
167- $(PROJECT ) .spec :
168- poetry run pyi-makespec $(PACKAGE ) /__main__.py --onefile --windowed --name=$(PROJECT )
174+ $(PACKAGE ) .spec :
175+ poetry run pyi-makespec $(PACKAGE ) /__main__.py --onefile --windowed --name=$(PACKAGE )
169176
170177# RELEASE #####################################################################
171178
172179.PHONY : upload
173180upload : dist # # Upload the current version to PyPI
174181 git diff --name-only --exit-code
175182 poetry publish
176- bin/open https://pypi.org/project/$(PROJECT )
183+ bin/open https://pypi.org/project/$(PACKAGE )
177184
178185# CLEANUP #####################################################################
179186
@@ -186,7 +193,7 @@ clean-all: clean
186193
187194.PHONY : .clean-install
188195.clean-install :
189- find $(PACKAGES ) -name ' __pycache__' -delete
196+ find $(PACKAGE ) tests -name ' __pycache__' -delete
190197 rm -rf * .egg-info
191198
192199.PHONY : .clean-test
0 commit comments