Skip to content

Commit

Permalink
Update tooling
Browse files Browse the repository at this point in the history
  • Loading branch information
jacebrowning committed Apr 2, 2018
1 parent 631d9f8 commit fec0603
Show file tree
Hide file tree
Showing 12 changed files with 204 additions and 105 deletions.
4 changes: 3 additions & 1 deletion .coveragerc
@@ -1,5 +1,7 @@
[run]

branch = true

omit =
*/.venv/*
.venv/*
*/tests/*
3 changes: 1 addition & 2 deletions .gitignore
Expand Up @@ -12,7 +12,7 @@ __pycache__
Icon*

# Temporary virtual environment files
/.cache/
/.*cache/
/.venv/

# Temporary server files
Expand All @@ -34,7 +34,6 @@ Icon*
*.gdraw

# Testing and coverage results
/.pytest/
/.coverage
/.coverage.*
/htmlcov/
Expand Down
4 changes: 2 additions & 2 deletions .verchew.ini
Expand Up @@ -11,7 +11,7 @@ version = Python 3.
[pipenv]

cli = pipenv
version = 9.
versions = 10. | 11.

[Git]

Expand All @@ -22,7 +22,7 @@ version = 2.

cli = pandoc
version = 1.
option = true
optional = true
message = This is only needed to generate the README for PyPI.

[Graphviz]
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Expand Up @@ -49,7 +49,7 @@ $ make watch
Build the documentation:

```sh
$ make doc
$ make docs
```

### Static Analysis
Expand Down
4 changes: 1 addition & 3 deletions LICENSE.md
@@ -1,8 +1,6 @@
# License

**The MIT License (MIT)**

Copyright © 2017, Jace Browning
Copyright © 2015, Jace Browning

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
98 changes: 36 additions & 62 deletions Makefile
Expand Up @@ -9,12 +9,11 @@ CONFIG := $(wildcard *.py)
MODULES := $(wildcard $(PACKAGE)/*.py)

# Virtual environment paths
export PIPENV_SHELL_COMPAT=true
export PIPENV_VENV_IN_PROJECT=true
export PIPENV_IGNORE_VIRTUALENVS=true
ENV := .venv
VENV := .venv

# MAIN TASKS ###################################################################
# MAIN TASKS ##################################################################

SNIFFER := pipenv run sniffer

Expand Down Expand Up @@ -44,21 +43,17 @@ doctor: ## Confirm system dependencies are available

# PROJECT DEPENDENCIES #########################################################

DEPENDENCIES := $(ENV)/.pipenv-$(shell bin/checksum Pipfile*)
METADATA := *.egg-info
DEPENDENCIES := $(VENV)/.pipenv-$(shell bin/checksum Pipfile* setup.py)

.PHONY: install
install: $(DEPENDENCIES) $(METADATA)
install: $(DEPENDENCIES)

$(DEPENDENCIES):
pipenv install --dev
@ touch $@

$(METADATA): setup.py
pipenv run python setup.py develop
pipenv install --dev
@ touch $@

# CHECKS #######################################################################
# CHECKS ######################################################################

PYLINT := pipenv run pylint
PYCODESTYLE := pipenv run pycodestyle
Expand All @@ -79,7 +74,7 @@ pycodestyle: install
pydocstyle: install
$(PYDOCSTYLE) $(PACKAGES) $(CONFIG)

# TESTS ########################################################################
# TESTS #######################################################################

PYTEST := pipenv run py.test
COVERAGE := pipenv run coverage
Expand All @@ -104,38 +99,38 @@ test: test-all ## Run unit and integration tests

.PHONY: test-unit
test-unit: install
@- mv $(FAILURES) $(FAILURES).bak
@ ( mv $(FAILURES) $(FAILURES).bak || true ) > /dev/null 2>&1
$(PYTEST) $(PYTEST_OPTIONS) $(PACKAGE) --junitxml=$(REPORTS)/unit.xml
@- mv $(FAILURES).bak $(FAILURES)
@ ( mv $(FAILURES).bak $(FAILURES) || true ) > /dev/null 2>&1
$(COVERAGE_SPACE) $(REPOSITORY) unit

.PHONY: test-int
test-int: install
@ if test -e $(FAILURES); then $(PYTEST) $(PYTEST_RERUN_OPTIONS) tests; fi
@ if test -e $(FAILURES); then TEST_INTEGRATION=true $(PYTEST) $(PYTEST_RERUN_OPTIONS) tests; fi
@ rm -rf $(FAILURES)
$(PYTEST) $(PYTEST_OPTIONS) tests --junitxml=$(REPORTS)/integration.xml
TEST_INTEGRATION=true $(PYTEST) $(PYTEST_OPTIONS) tests --junitxml=$(REPORTS)/integration.xml
$(COVERAGE_SPACE) $(REPOSITORY) integration

.PHONY: test-all
test-all: install
@ if test -e $(FAILURES); then $(PYTEST) $(PYTEST_RERUN_OPTIONS) $(PACKAGES); fi
@ if test -e $(FAILURES); then TEST_INTEGRATION=true $(PYTEST) $(PYTEST_RERUN_OPTIONS) $(PACKAGES); fi
@ rm -rf $(FAILURES)
$(PYTEST) $(PYTEST_OPTIONS) $(PACKAGES) --junitxml=$(REPORTS)/overall.xml
TEST_INTEGRATION=true $(PYTEST) $(PYTEST_OPTIONS) $(PACKAGES) --junitxml=$(REPORTS)/overall.xml
$(COVERAGE_SPACE) $(REPOSITORY) overall

.PHONY: read-coverage
read-coverage:
bin/open htmlcov/index.html

# DOCUMENTATION ################################################################
# DOCUMENTATION ###############################################################

PYREVERSE := pipenv run pyreverse
MKDOCS := pipenv run mkdocs

MKDOCS_INDEX := site/index.html

.PHONY: doc
doc: uml mkdocs ## Generate documentation
.PHONY: docs
docs: uml mkdocs ## Generate documentation

.PHONY: docs/demo.gif
docs/demo.gif:
Expand Down Expand Up @@ -169,14 +164,17 @@ mkdocs-live: mkdocs
eval "sleep 3; bin/open http://127.0.0.1:8000" &
$(MKDOCS) serve

# BUILD ########################################################################
# BUILD #######################################################################

PYINSTALLER := pipenv run pyinstaller
PYINSTALLER_MAKESPEC := pipenv run pyi-makespec

DIST_FILES := dist/*.tar.gz dist/*.whl
EXE_FILES := dist/$(PROJECT).*

.PHONY: build
build: dist

.PHONY: dist
dist: install $(DIST_FILES)
$(DIST_FILES): $(MODULES) README.rst CHANGELOG.rst
Expand All @@ -197,68 +195,44 @@ $(EXE_FILES): $(MODULES) $(PROJECT).spec
$(PROJECT).spec:
$(PYINSTALLER_MAKESPEC) $(PACKAGE)/__main__.py --onefile --windowed --name=$(PROJECT)

# RELEASE ######################################################################
# RELEASE #####################################################################

TWINE := pipenv run twine

.PHONY: register
register: dist ## Register the project on PyPI
@ echo NOTE: your project must be registered manually
@ echo https://github.com/pypa/python-packaging-user-guide/issues/263
# TODO: switch to twine when the above issue is resolved
# $(TWINE) register dist/*.whl

.PHONY: upload
upload: .git-no-changes register ## Upload the current version to PyPI
upload: dist ## Upload the current version to PyPI
git diff --name-only --exit-code
$(TWINE) upload dist/*.*
bin/open https://pypi.python.org/pypi/$(PROJECT)

.PHONY: .git-no-changes
.git-no-changes:
@ if git diff --name-only --exit-code; \
then \
echo Git working copy is clean...; \
else \
echo ERROR: Git working copy is dirty!; \
echo Commit your changes and try again.; \
exit -1; \
fi;

# CLEANUP ######################################################################
# CLEANUP #####################################################################

.PHONY: clean
clean: .clean-dist .clean-test .clean-doc .clean-build ## Delete all generated and temporary files
clean: .clean-build .clean-docs .clean-test .clean-install ## Delete all generated and temporary files

.PHONY: clean-all
clean-all: clean .clean-env .clean-workspace
clean-all: clean
rm -rf $(VENV)

.PHONY: .clean-build
.clean-build:
.PHONY: .clean-install
.clean-install:
find $(PACKAGES) -name '*.pyc' -delete
find $(PACKAGES) -name '__pycache__' -delete
rm -rf *.egg-info

.PHONY: .clean-doc
.clean-doc:
rm -rf README.rst docs/apidocs *.html docs/*.png site

.PHONY: .clean-test
.clean-test:
rm -rf .cache .pytest .coverage htmlcov xmlreport

.PHONY: .clean-dist
.clean-dist:
rm -rf *.spec dist build

.PHONY: .clean-env
.clean-env: clean
rm -rf $(ENV)
.PHONY: .clean-docs
.clean-docs:
rm -rf *.rst docs/apidocs *.html docs/*.png site

.PHONY: .clean-workspace
.clean-workspace:
rm -rf *.sublime-workspace
.PHONY: .clean-build
.clean-build:
rm -rf *.spec dist build

# HELP #########################################################################
# HELP ########################################################################

.PHONY: help
help: all
Expand Down
11 changes: 9 additions & 2 deletions Pipfile
Expand Up @@ -8,6 +8,10 @@ name = "pypi"

python_version = "3"

[packages]

gitman = { path = ".", editable = true }

[dev-packages]

# Linters
Expand All @@ -19,11 +23,11 @@ pydocstyle = "~=2.0"
pytest = "~=3.3"
pytest-describe = "*"
pytest-expecter = "*"
pytest-cov = "*"
pytest-random = "*"
pytest-cov = "*"
freezegun = "*"

# Coverage
# Reports
coverage-space = "*"

# Documentation
Expand All @@ -33,9 +37,12 @@ pygments = "*"

# Build
wheel = "*"
pyinstaller = "*"

# Release
twine = "*"

# Tooling
sniffer = "*"
pync = { version = "<2.0", sys_platform = "== 'darwin'" }
MacFSEvents = { version = "*", sys_platform = "== 'darwin'" }

0 comments on commit fec0603

Please sign in to comment.