Skip to content

Commit

Permalink
Merge pull request #85 from jacebrowning/update-tooling
Browse files Browse the repository at this point in the history
Update tooling
  • Loading branch information
jacebrowning committed Mar 15, 2018
2 parents a236321 + 64ccb90 commit 916030c
Show file tree
Hide file tree
Showing 26 changed files with 529 additions and 348 deletions.
4 changes: 3 additions & 1 deletion .coveragerc
@@ -1,5 +1,7 @@
[run]

branch = true

omit =
*/.venv/*
.venv/*
*/tests/*
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -30,7 +30,7 @@ Icon*
*.gdraw

# Testing and coverage results
/.pytest/
/.pytest_cache/
/.coverage
/.coverage.*
/htmlcov/
Expand Down
75 changes: 74 additions & 1 deletion .pylint.ini
Expand Up @@ -50,7 +50,80 @@ confidence=
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
disable=print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,missing-docstring,invalid-name,too-few-public-methods,fixme,too-many-arguments,too-many-branches,global-statement,too-many-ancestors
disable=print-statement,
parameter-unpacking,
unpacking-in-except,
old-raise-syntax,
backtick,
long-suffix,
old-ne-operator,
old-octal-literal,
import-star-module-level,
raw-checker-failed,
bad-inline-option,
locally-disabled,
locally-enabled,
file-ignored,
suppressed-message,
useless-suppression,
deprecated-pragma,
apply-builtin,
basestring-builtin,
buffer-builtin,
cmp-builtin,
coerce-builtin,
execfile-builtin,
file-builtin,
long-builtin,
raw_input-builtin,
reduce-builtin,
standarderror-builtin,
unicode-builtin,
xrange-builtin,
coerce-method,
delslice-method,
getslice-method,
setslice-method,
no-absolute-import,
old-division,
dict-iter-method,
dict-view-method,
next-method-called,
metaclass-assignment,
indexing-exception,
raising-string,
reload-builtin,
oct-method,
hex-method,
nonzero-method,
cmp-method,
input-builtin,
round-builtin,
intern-builtin,
unichr-builtin,
map-builtin-not-iterating,
zip-builtin-not-iterating,
range-builtin-not-iterating,
filter-builtin-not-iterating,
using-cmp-argument,
eq-without-hash,
div-method,
idiv-method,
rdiv-method,
exception-message-attribute,
invalid-str-codec,
sys-max-int,
bad-python3-import,
deprecated-string-function,
deprecated-str-translate-call,
missing-docstring,
invalid-name,
too-few-public-methods,
fixme,
too-many-arguments,
too-many-branches,
global-statement,
too-many-ancestors,

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -12,7 +12,7 @@ env:
- RANDOM_SEED=0

before_install:
- pip install pipenv==8.2.7
- pip install pipenv
- make doctor

install:
Expand Down
8 changes: 4 additions & 4 deletions .verchew.ini
Expand Up @@ -11,19 +11,19 @@ version = Python 3.6.
[pipenv]

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

[pandoc]

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

[Graphviz]

cli = dot
cli_version_arg = -V
version = 2.
optional = true
message = This is only needed to generate UML diagrams for documentation
message = This is only needed to generate UML diagrams for documentation.
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
92 changes: 33 additions & 59 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 All @@ -32,29 +31,25 @@ watch: install .clean-test ## Continuously run all CI tasks when files chanage
run: install
pipenv run python $(PACKAGE)/__main__.py

# SYSTEM DEPENDENCIES ##########################################################
# SYSTEM DEPENDENCIES #########################################################

.PHONY: doctor
doctor: ## Confirm system dependencies are available
bin/verchew

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

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

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

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

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

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

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

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

PYTEST := pipenv run py.test
COVERAGE := pipenv run coverage
Expand Down Expand Up @@ -123,15 +118,15 @@ test-all: install
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: uml
uml: install docs/*.png
Expand All @@ -154,14 +149,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 @@ -182,71 +180,47 @@ $(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
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
@ grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

.DEFAULT_GOAL := help
21 changes: 13 additions & 8 deletions Pipfile
Expand Up @@ -2,11 +2,16 @@

url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"

[requires]

python_version = "3.6"

[packages]

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

[dev-packages]

# Linters
Expand All @@ -15,16 +20,14 @@ pycodestyle = "~=2.3"
pydocstyle = "~=2.0"

# Testing
pytest = "~=3.0.7"
pytest-describe = "==0.11.0"
pytest-expecter = "==0.2.2.post6"
pytest-cov = "*"
pytest = "~= 3.3"
pytest-describe = "*"
pytest-expecter = "~=1.1"
pytest-random = "*"
pytest-catchlog = "*"
pytest-cov = "*"

# Coverage
coverage = "~=4.0"
"coverage.space" = "~=0.8"
# Reports
"coverage.space" = "*"

# Documentation
mkdocs = "*"
Expand All @@ -40,3 +43,5 @@ twine = "*"

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

0 comments on commit 916030c

Please sign in to comment.