@@ -72,6 +72,10 @@ clean: clean-build clean-pyc clean-test clean-coverage clean-docs ## remove all
7272install : clean-build clean-pyc # # install the package to the active Python's site-packages
7373 pip install .
7474
75+ .PHONY : install-examples
76+ install-examples : clean-build clean-pyc # # install the package and the examples dependencies
77+ pip install .[examples]
78+
7579.PHONY : install-test
7680install-test : clean-build clean-pyc # # install the package and test dependencies
7781 pip install .[test]
@@ -80,6 +84,12 @@ install-test: clean-build clean-pyc ## install the package and test dependencies
8084install-develop : clean-build clean-pyc # # install the package in editable mode and dependencies for development
8185 pip install -e .[dev]
8286
87+ MINIMUM := $(shell sed -n '/install_requires = \[/,/]/p' setup.py | grep -v -e '[][]' | sed 's/ * \(.* \) ,$? $$/\1/g' | tr '>' '=')
88+
89+ .PHONY : install-minimum
90+ install-minimum : # # install the minimum supported versions of the package dependencies
91+ pip install $(MINIMUM )
92+
8393
8494# LINT TARGETS
8595
@@ -106,10 +116,31 @@ lint-docs: ## check docs formatting with doc8 and pydocstyle
106116
107117# TEST TARGETS
108118
109- .PHONY : test
110- test : # # run tests quickly with the default Python
119+ .PHONY : test-unit
120+ test-unit : # # run tests quickly with the default Python
111121 python -m pytest --cov=mlblocks
112122
123+ .PHONY : test-readme
124+ test-readme : # # run the readme snippets
125+ rm -rf tests/readme_test && mkdir tests/readme_test
126+ cd tests/readme_test && rundoc run --single-session python3 -t python3 ../../README.md
127+ rm -rf tests/readme_test
128+
129+ .PHONY : test-tutorials
130+ test-tutorials : # # run the tutorial notebooks
131+ find examples/tutorials -path " */.ipynb_checkpoints" -prune -false -o -name " *.ipynb" -exec \
132+ jupyter nbconvert --execute --ExecutePreprocessor.timeout=3600 --stdout --to html {} > /dev/null +
133+
134+ .PHONY : test
135+ test : test-unit test-readme # # test everything that needs test dependencies
136+
137+ .PHONY : check-dependencies
138+ check-dependencies : # # test if there are any broken dependencies
139+ pip check
140+
141+ .PHONY : test-devel
142+ test-devel : check-dependencies lint docs # # test everything that needs development dependencies
143+
113144.PHONY : test-all
114145test-all : # # run tests on every Python version with tox
115146 tox -r
@@ -129,11 +160,11 @@ docs: clean-docs ## generate Sphinx HTML documentation, including API docs
129160 $(MAKE ) -C docs html
130161
131162.PHONY : view-docs
132- view-docs : docs # # view docs in browser
163+ view-docs : # # view the docs in a browser
133164 $(BROWSER ) docs/_build/html/index.html
134165
135166.PHONY : serve-docs
136- serve-docs : view-docs # # compile the docs watching for changes
167+ serve-docs : # # compile the docs watching for changes
137168 watchmedo shell-command -W -R -D -p ' *.rst;*.md' -c ' $(MAKE) -C docs html' docs
138169
139170
@@ -145,12 +176,19 @@ dist: clean ## builds source and wheel package
145176 python setup.py bdist_wheel
146177 ls -l dist
147178
148- .PHONY : test-publish
149- test-publish : dist # # package and upload a release on TestPyPI
179+ .PHONY : publish-confirm
180+ publish-confirm :
181+ @echo " WARNING: This will irreversibly upload a new version to PyPI!"
182+ @echo -n " Please type 'confirm' to proceed: " \
183+ && read answer \
184+ && [ " $$ {answer}" = " confirm" ]
185+
186+ .PHONY : publish-test
187+ publish-test : dist publish-confirm # # package and upload a release on TestPyPI
150188 twine upload --repository-url https://test.pypi.org/legacy/ dist/*
151189
152190.PHONY : publish
153- publish : dist # # package and upload a release
191+ publish : dist publish-confirm # # package and upload a release
154192 twine upload dist/*
155193
156194.PHONY : bumpversion-release
@@ -179,9 +217,21 @@ bumpversion-minor: ## Bump the version the next minor skipping the release
179217bumpversion-major : # # Bump the version the next major skipping the release
180218 bumpversion --no-tag major
181219
220+ .PHONY : bumpversion-revert
221+ bumpversion-revert : # # Undo a previous bumpversion-release
222+ git checkout master
223+ git branch -D stable
224+
225+ CLEAN_DIR := $(shell git status --short | grep -v ??)
182226CURRENT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
183227CHANGELOG_LINES := $(shell git diff HEAD..origin/stable HISTORY.md 2>&1 | wc -l)
184228
229+ .PHONY : check-clean
230+ check-clean : # # Check if the directory has uncommitted changes
231+ ifneq ($(CLEAN_DIR ) ,)
232+ $(error There are uncommitted changes)
233+ endif
234+
185235.PHONY : check-master
186236check-master : # # Check if we are in master branch
187237ifneq ($(CURRENT_BRANCH ) ,master)
@@ -195,15 +245,21 @@ ifeq ($(CHANGELOG_LINES),0)
195245endif
196246
197247.PHONY : check-release
198- check-release : check-master check-history # # Check if the release can be made
248+ check-release : check-clean check- master check-history # # Check if the release can be made
199249 @echo " A new release can be made"
200250
201251.PHONY : release
202252release : check-release bumpversion-release publish bumpversion-patch
203253
254+ .PHONY : release-test
255+ release-test : check-release bumpversion-release-test publish-test bumpversion-revert
256+
204257.PHONY : release-candidate
205258release-candidate : check-master publish bumpversion-candidate
206259
260+ .PHONY : release-candidate-test
261+ release-candidate-test : check-clean check-master publish-test
262+
207263.PHONY : release-minor
208264release-minor : check-release bumpversion-minor release
209265
0 commit comments