Permalink
Browse files

Add development requirements to package and instructions to README (#269

)

* Prints a nice message when the developer doesn't have flake8 or other development tools available.
* Add ANSI color highlighting and helpful messages for development dependencies in Makefile
  • Loading branch information...
Alex Widener authored and ssteinbach committed Jun 21, 2018
1 parent e0ebd65 commit 4d1ac08a35902a6be702dca0e81c9874785e834a
Showing with 41 additions and 11 deletions.
  1. +33 −10 Makefile
  2. +2 −0 README.md
  3. +6 −1 setup.py
View
@@ -1,6 +1,24 @@
.PHONY: coverage test test_first_fail clean autopep8 lint doc-html \
python-version
# Special definition to handle Make from stripping newlines
define newline
endef
# Color highlighting for the shell
ccred = $(shell echo "\033[0;31m")
ccgreen = $(shell echo "\033[0;32m")
ccblue = $(shell echo "\033[0;34m")
ccend = $(shell echo "\033[0m")
# Helpful link to install development dependencies declared in setup.py
define dev_deps_message
$(ccred)You can install this and other development dependencies with$(newline)$(ccend)\
$(ccblue) pip install -e .[dev]$(newline)$(ccend)
endef
COV_PROG := $(shell command -v coverage 2> /dev/null)
PEP8_PROG := $(shell command -v pep8 2> /dev/null)
PYFLAKES_PROG := $(shell command -v pyflakes 2> /dev/null)
@@ -19,11 +37,11 @@ OTIO_DEFAULT_MEDIA_LINKER =
test: test-core test-contrib
test-core: python-version
@echo "Running Core tests..."
@echo "$(ccgreen)Running Core tests...$(ccend)"
@python -m unittest discover tests $(TEST_ARGS)
test-contrib: python-version
@echo "Running Contrib tests..."
@echo "$(ccgreen)Running Contrib tests...$(ccend)"
@make -C opentimelineio_contrib/adapters test VERBOSE=$(VERBOSE)
python-version:
@@ -37,8 +55,9 @@ coverage-report:
coverage-core: python-version
ifndef COV_PROG
$(error "coverage is not available please see: "\
"https://coverage.readthedocs.io/en/coverage-4.2/install.html")
$(error $(newline)$(ccred) Coverage is not available please see:$(newline)$(ccend)\
$(ccblue) https://coverage.readthedocs.io/en/coverage-4.2/install.html $(newline)$(ccend)\
$(dev_deps_message))
endif
@${COV_PROG} run --source=opentimelineio -m unittest discover tests
@@ -64,19 +83,23 @@ clean:
# run the codebase through flake8. pep8 and pyflakes are called by flake8.
lint:
ifndef PEP8_PROG
$(error "pep8 is not available on $$PATH please see: "\
"https://pypi.python.org/pypi/pep8#installation")
$(error $(newline)$(ccred)pep8 is not available on $$PATH please see:$(newline)$(ccend)\
$(ccblue) https://pypi.python.org/pypi/pep8#installation$(newline)$(ccend)\
$(dev_deps_message))
endif
ifndef PYFLAKES_PROG
$(error "pyflakes is not available on $$PATH please see: "\
"https://pypi.python.org/pypi/pyflakes#installation")
$(error $(newline)$(ccred)pyflakes is not available on $$PATH please see:$(newline)$(ccend)\
$(ccblue) https://pypi.python.org/pypi/pyflakes#installation$(newline)$(ccend)\
$(dev_deps_message))
endif
ifndef FLAKE8_PROG
$(error "flake8 is not available on $$PATH please see: "\
"http://flake8.pycqa.org/en/latest/index.html#installation")
$(error $(newline)$(ccred)flake8 is not available on $$PATH please see:$(newline)$(ccend)\
$(ccblue) http://flake8.pycqa.org/en/latest/index.html#installation$(newline)$(ccend)\
$(dev_deps_message))
endif
@python -m flake8 --exclude build
# generate documentation in html
doc-html:
@make -C doc html | sed 's#build/#doc/build/#g'
View
@@ -176,6 +176,8 @@ with the pep8 style. We ask that before you submit a pull request, you:
PEP8: https://www.python.org/dev/peps/pep-0008/
You can install development dependencies with `pip install -e .[dev]`
Contact
-------
View
@@ -138,7 +138,12 @@ def test_otio():
install_requires=[
# PyAAF2 to go here eventually
],
extras_require={
'dev': [
'flake8==3.5',
'coverage==4.5',
]
},
test_suite='setup.test_otio',
# because we need to open() the adapters manifest, we aren't zip-safe

0 comments on commit 4d1ac08

Please sign in to comment.