@@ -84,6 +84,12 @@ install-test: clean-build clean-pyc ## install the package and test dependencies
8484install-develop : clean-build clean-pyc # # install the package in editable mode and dependencies for development
8585 pip install -e .[dev]
8686
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+
8793
8894# LINT TARGETS
8995
@@ -123,7 +129,7 @@ test-readme: ## run the readme snippets
123129.PHONY : test-tutorials
124130test-tutorials : # # run the tutorial notebooks
125131 find examples/tutorials -path " */.ipynb_checkpoints" -prune -false -o -name " *.ipynb" -exec \
126- jupyter nbconvert --execute --ExecutePreprocessor.timeout=3600 --stdout --to html {} > /dev/null \;
132+ jupyter nbconvert --execute --ExecutePreprocessor.timeout=3600 --stdout --to html {} > /dev/null +
127133
128134.PHONY : test
129135test : test-unit test-readme # # test everything that needs test dependencies
@@ -154,11 +160,11 @@ docs: clean-docs ## generate Sphinx HTML documentation, including API docs
154160 $(MAKE ) -C docs html
155161
156162.PHONY : view-docs
157- view-docs : docs # # view docs in browser
163+ view-docs : # # view the docs in a browser
158164 $(BROWSER ) docs/_build/html/index.html
159165
160166.PHONY : serve-docs
161- serve-docs : view-docs # # compile the docs watching for changes
167+ serve-docs : # # compile the docs watching for changes
162168 watchmedo shell-command -W -R -D -p ' *.rst;*.md' -c ' $(MAKE) -C docs html' docs
163169
164170
@@ -170,12 +176,19 @@ dist: clean ## builds source and wheel package
170176 python setup.py bdist_wheel
171177 ls -l dist
172178
173- .PHONY : test-publish
174- 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
175188 twine upload --repository-url https://test.pypi.org/legacy/ dist/*
176189
177190.PHONY : publish
178- publish : dist # # package and upload a release
191+ publish : dist publish-confirm # # package and upload a release
179192 twine upload dist/*
180193
181194.PHONY : bumpversion-release
@@ -204,9 +217,21 @@ bumpversion-minor: ## Bump the version the next minor skipping the release
204217bumpversion-major : # # Bump the version the next major skipping the release
205218 bumpversion --no-tag major
206219
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 ??)
207226CURRENT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
208227CHANGELOG_LINES := $(shell git diff HEAD..origin/stable HISTORY.md 2>&1 | wc -l)
209228
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+
210235.PHONY : check-master
211236check-master : # # Check if we are in master branch
212237ifneq ($(CURRENT_BRANCH ) ,master)
@@ -220,15 +245,21 @@ ifeq ($(CHANGELOG_LINES),0)
220245endif
221246
222247.PHONY : check-release
223- 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
224249 @echo " A new release can be made"
225250
226251.PHONY : release
227252release : check-release bumpversion-release publish bumpversion-patch
228253
254+ .PHONY : release-test
255+ release-test : check-release bumpversion-release-test publish-test bumpversion-revert
256+
229257.PHONY : release-candidate
230258release-candidate : check-master publish bumpversion-candidate
231259
260+ .PHONY : release-candidate-test
261+ release-candidate-test : check-clean check-master publish-test
262+
232263.PHONY : release-minor
233264release-minor : check-release bumpversion-minor release
234265
0 commit comments