diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..71b7b59 --- /dev/null +++ b/.flake8 @@ -0,0 +1,30 @@ +######################### +# Flake8 Configuration # +# (.flake8) # +######################### +[flake8] +# flake8 +exclude = + *.egg-info, + *.pyc, + .cache, + .eggs + .git, + .tox, + __pycache__, + build, + dist, + docs/source/conf.py, +format = ${cyan}%(path)s${reset}:${yellow_bold}%(row)d${reset}:${green_bold}%(col)d${reset}: ${red_bold}%(code)s${reset} %(text)s +ignore = S101 +max-line-length = 120 + +# flake8-import-order +application-import-names = + bio2bel_phosphosite + bio2bel + tests +import-order-style = pycharm + +# mccabe +max-complexity = 10 diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000..903d337 --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,6 @@ +# See: https://docs.readthedocs.io/en/latest/yaml-config.html +python: + version: 3 + pip_install: true + extra_requirements: + - docs diff --git a/.travis.yml b/.travis.yml index b267fba..cab0e3d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,28 +1,42 @@ sudo: false cache: pip -services: -- mysql language: python -python: 3.6 -env: - global: - - BIO2BEL_CONNECTION=mysql+pymysql://travis@localhost/bio2bel?charset=utf8' - matrix: - - TOXENV=py - - TOXENV=docs - - TOXENV=manifest - - TOXENV=readme -before_install: -- pip install codecov -- pip install pymysql -- mysql -e 'CREATE DATABASE bio2bel CHARACTER SET utf8 COLLATE utf8_general_ci;' -- mysql -e "GRANT ALL PRIVILEGES ON bio2bel.* to 'travis'@'%' WITH GRANT OPTION;" +python: +- 3.6 +stages: + - lint + - docs + - test +jobs: + include: + # lint stage + - stage: lint + env: TOXENV=manifest + - env: TOXENV=flake8 + - env: TOXENV=vulture + - env: TOXENV=mypy + - env: TOXENV=pyroma + # docs stage + - stage: docs + env: TOXENV=doc8 + - env: TOXENV=readme + - env: TOXENV=docs + # test stage + - stage: test + env: TOXENV=py +matrix: + allow_failures: + - env: TOXENV=doc8 + - env: TOXENV=docs + - env: TOXENV=flake8 + - env: TOXENV=vulture + - env: TOXENV=mypy + - env: TOXENV=pyroma install: -- pip install tox + - sh -c 'if [ "$TOXENV" = "py" ]; then pip install tox codecov; else pip install tox; fi' script: - tox after_success: -- tox -e coverage-report -- codecov + - sh -c 'if [ "$TOXENV" = "py" ]; then tox -e coverage-report; codecov; fi' notifications: slack: pybel:n2KbWKBum3musnBg3L76gGwq diff --git a/MANIFEST.in b/MANIFEST.in index 381d1ce..e613abe 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -8,4 +8,4 @@ include docs/Makefile global-exclude *.py[cod] __pycache__ *.so *.dylib .DS_Store *.gpickle exclude .bumpversion.cfg -include *.rst *.txt *.yml LICENSE tox.ini .coveragerc +include *.rst *.txt *.yml *.ini LICENSE .coveragerc diff --git a/tox.ini b/tox.ini index c8196cf..e78d5f2 100644 --- a/tox.ini +++ b/tox.ini @@ -2,32 +2,34 @@ envlist = coverage-clean manifest + flake8 readme + doc8 docs py coverage-report [testenv] commands = coverage run -p -m pytest tests {posargs} -passenv = TRAVIS CI +passenv = CI TRAVIS TRAVIS_* deps = coverage pytest + pybel + flask + flask-admin whitelist_externals = /bin/cat /bin/cp /bin/mkdir + /usr/bin/git + /usr/local/bin/hub [testenv:coverage-clean] deps = coverage skip_install = true commands = coverage erase -[testenv:manifest] -deps = check-manifest -skip_install = true -commands = check-manifest - [testenv:coverage-report] deps = coverage skip_install = true @@ -35,18 +37,43 @@ commands = coverage combine coverage report -[testenv:readme] -commands = rst-lint README.rst +[testenv:manifest] +deps = check-manifest +commands = check-manifest +skip_install = true + +[testenv:vulture] +deps = vulture skip_install = true +commands = vulture src/bio2bel_phosphosite/ +description = Run the vulture tool to look for dead code. + +[testenv:xenon] +deps = xenon +skip_install = true +commands = xenon --max-average A --max-modules A --max-absolute B . +description = Run the xenon tool to monitor code complexity. + +[testenv:mypy] +deps = mypy +skip_install = true +commands = mypy --ignore-missing-imports src/bio2bel_phosphosite/ +description = Run the mypy tool to check static typing on the project. + +[testenv:pyroma] deps = - restructuredtext_lint pygments + pyroma +skip_install = true +commands = pyroma --min=10 . +description = Run the pyroma tool to check the project's package friendliness. [testenv:docs] changedir = docs deps = sphinx - sphinx_rtd_theme + sphinx-rtd-theme + sphinx-autodoc-typehints commands = mkdir -p {envtmpdir} cp -r source {envtmpdir}/source @@ -54,3 +81,63 @@ commands = sphinx-build -W -b coverage -d {envtmpdir}/build/doctrees {envtmpdir}/source {envtmpdir}/build/coverage cat {envtmpdir}/build/coverage/c.txt cat {envtmpdir}/build/coverage/python.txt + +[testenv:readme] +commands = rst-lint README.rst +skip_install = true +deps = + restructuredtext_lint + pygments + +[testenv:flake8] +basepython = python3 +skip_install = true +deps = + flake8 + flake8-docstrings>=0.2.7 + flake8-import-order>=0.9 + pep8-naming + flake8-colors +commands = + flake8 src/bio2bel_phosphosite/ tests/ setup.py + +[testenv:doc8] +basepython = python3 +skip_install = true +deps = + sphinx + doc8 +commands = + doc8 docs/source/ README.rst + +[testenv:build] +basepython = python3 +skip_install = true +deps = + wheel + setuptools +commands = + python setup.py -q sdist bdist_wheel + +[testenv:release] +basepython = python3 +skip_install = true +deps = + {[testenv:build]deps} + twine >= 1.5.0 +commands = + {[testenv:build]commands} + twine upload --skip-existing dist/* + +[testenv:finish] +basepython = python3 +skip_install = true +deps = + {[testenv:build]deps} + {[testenv:release]deps} + bumpversion +commands = + bumpversion release + {[testenv:release]commands} + git push + bumpversion patch