From 6d3e04d95ccee586f4e651b3ec4246b362825023 Mon Sep 17 00:00:00 2001 From: Abhabongse Janthong <6845502+abhabongse@users.noreply.github.com> Date: Thu, 10 Dec 2020 16:23:33 +0700 Subject: [PATCH 1/3] Upgrade dev packages & Remove unwanted badges in README --- README.md | 2 -- dev-requirements.txt | 52 +++++++++++++++++++++---------------------- docs/requirements.txt | 21 +++++++++-------- 3 files changed, 36 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 85771ad..bbc20a5 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,6 @@
Travis-CI Build Status Requirements Status - Coverage Status - Codacy Code Quality Status
diff --git a/dev-requirements.txt b/dev-requirements.txt index 88b5cd8..d2afb4a 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -8,23 +8,23 @@ alabaster==0.7.12 # via -c docs/requirements.txt, sphinx appdirs==1.4.4 # via virtualenv argon2-cffi==20.1.0 # via notebook async-generator==1.10 # via nbclient -attrs==20.2.0 # via -c docs/requirements.txt, flake8-bugbear, jsonschema, pytest -babel==2.8.0 # via -c docs/requirements.txt, sphinx +attrs==20.3.0 # via -c docs/requirements.txt, flake8-bugbear, jsonschema, pytest +babel==2.9.0 # via -c docs/requirements.txt, sphinx backcall==0.2.0 # via ipython bleach==3.2.1 # via nbconvert, readme-renderer -certifi==2020.6.20 # via -c docs/requirements.txt, requests -cffi==1.14.3 # via argon2-cffi, cryptography +certifi==2020.12.5 # via -c docs/requirements.txt, requests +cffi==1.14.4 # via argon2-cffi, cryptography chardet==3.0.4 # via -c docs/requirements.txt, requests colorama==0.4.4 # via twine coverage==5.3 # via pytest-cov -cryptography==3.2.1 # via secretstorage +cryptography==3.3.1 # via secretstorage decorator==4.4.2 # via ipython defusedxml==0.6.0 # via nbconvert distlib==0.3.1 # via virtualenv docutils==0.16 # via -c docs/requirements.txt, readme-renderer, sphinx entrypoints==0.3 # via nbconvert filelock==3.0.12 # via tox, virtualenv -flake8-bugbear==20.1.4 # via -r dev-requirements.in +flake8-bugbear==20.11.1 # via -r dev-requirements.in flake8-commas==2.0.0 # via -r dev-requirements.in flake8-import-order==0.18.1 # via -r dev-requirements.in flake8==3.8.4 # via -r dev-requirements.in, flake8-bugbear, flake8-commas @@ -36,15 +36,15 @@ ipython-genutils==0.2.0 # via nbformat, notebook, qtconsole, traitlets ipython==7.19.0 # via ipykernel, ipywidgets, jupyter-console ipywidgets==7.5.1 # via jupyter jedi==0.17.2 # via ipython -jeepney==0.4.3 # via keyring, secretstorage +jeepney==0.6.0 # via keyring, secretstorage jinja2==2.11.2 # via -c docs/requirements.txt, nbconvert, notebook, sphinx jsonschema==3.2.0 # via nbformat jupyter-client==6.1.7 # via ipykernel, jupyter-console, nbclient, notebook, qtconsole jupyter-console==6.2.0 # via jupyter -jupyter-core==4.6.3 # via jupyter-client, nbconvert, nbformat, notebook, qtconsole +jupyter-core==4.7.0 # via jupyter-client, nbconvert, nbformat, notebook, qtconsole jupyter==1.0.0 # via -r dev-requirements.in jupyterlab-pygments==0.1.2 # via nbconvert -keyring==21.4.0 # via twine +keyring==21.5.0 # via twine livereload==2.6.3 # via sphinx-autobuild markupsafe==1.1.1 # via -c docs/requirements.txt, jinja2 mccabe==0.6.1 # via flake8 @@ -52,42 +52,42 @@ mistune==0.8.4 # via nbconvert nbclient==0.5.1 # via nbconvert nbconvert==6.0.7 # via jupyter, notebook nbformat==5.0.8 # via ipywidgets, nbclient, nbconvert, notebook -nest-asyncio==1.4.2 # via nbclient -notebook==6.1.4 # via jupyter, widgetsnbextension -packaging==20.4 # via -c docs/requirements.txt, bleach, pytest, sphinx, tox +nest-asyncio==1.4.3 # via nbclient +notebook==6.1.5 # via jupyter, widgetsnbextension +packaging==20.7 # via -c docs/requirements.txt, bleach, pytest, sphinx, tox pandocfilters==1.4.3 # via nbconvert parso==0.7.1 # via jedi pexpect==4.8.0 # via ipython pickleshare==0.7.5 # via ipython pkginfo==1.6.1 # via twine pluggy==0.13.1 # via pytest, tox -prometheus-client==0.8.0 # via notebook +prometheus-client==0.9.0 # via notebook prompt-toolkit==3.0.8 # via ipython, jupyter-console ptyprocess==0.6.0 # via pexpect, terminado py==1.9.0 # via pytest, tox pycodestyle==2.6.0 # via flake8, flake8-import-order pycparser==2.20 # via cffi pyflakes==2.2.0 # via flake8 -pygments==2.7.2 # via -c docs/requirements.txt, ipython, jupyter-console, jupyterlab-pygments, nbconvert, qtconsole, readme-renderer, sphinx +pygments==2.7.3 # via -c docs/requirements.txt, ipython, jupyter-console, jupyterlab-pygments, nbconvert, qtconsole, readme-renderer, sphinx pyparsing==2.4.7 # via -c docs/requirements.txt, packaging pyrsistent==0.17.3 # via jsonschema pytest-cov==2.10.1 # via -r dev-requirements.in pytest==6.1.2 # via -r dev-requirements.in, pytest-cov python-dateutil==2.8.1 # via jupyter-client -pytz==2020.1 # via -c docs/requirements.txt, babel -pyzmq==19.0.2 # via jupyter-client, notebook, qtconsole -qtconsole==4.7.7 # via jupyter +pytz==2020.4 # via -c docs/requirements.txt, babel +pyzmq==20.0.0 # via jupyter-client, notebook, qtconsole +qtconsole==5.0.1 # via jupyter qtpy==1.9.0 # via qtconsole readme-renderer==28.0 # via twine requests-toolbelt==0.9.1 # via twine -requests==2.24.0 # via -c docs/requirements.txt, requests-toolbelt, sphinx, twine +requests==2.25.0 # via -c docs/requirements.txt, requests-toolbelt, sphinx, twine rfc3986==1.4.0 # via twine -secretstorage==3.1.2 # via keyring +secretstorage==3.3.0 # via keyring send2trash==1.5.0 # via notebook -six==1.15.0 # via -c docs/requirements.txt, argon2-cffi, bleach, cryptography, jsonschema, livereload, packaging, python-dateutil, readme-renderer, tox, virtualenv +six==1.15.0 # via argon2-cffi, bleach, cryptography, jsonschema, livereload, python-dateutil, readme-renderer, tox, virtualenv snowballstemmer==2.0.0 # via -c docs/requirements.txt, sphinx sphinx-autobuild==2020.9.1 # via -r dev-requirements.in -sphinx==3.2.1 # via -c docs/requirements.txt, sphinx-autobuild +sphinx==3.3.1 # via -c docs/requirements.txt, sphinx-autobuild sphinxcontrib-applehelp==1.0.2 # via -c docs/requirements.txt, sphinx sphinxcontrib-devhelp==1.0.2 # via -c docs/requirements.txt, sphinx sphinxcontrib-htmlhelp==1.0.3 # via -c docs/requirements.txt, sphinx @@ -96,17 +96,17 @@ sphinxcontrib-qthelp==1.0.3 # via -c docs/requirements.txt, sphinx sphinxcontrib-serializinghtml==1.1.4 # via -c docs/requirements.txt, sphinx terminado==0.9.1 # via notebook testpath==0.4.4 # via nbconvert -toml==0.10.1 # via pytest, tox +toml==0.10.2 # via pytest, tox tornado==6.1 # via ipykernel, jupyter-client, livereload, notebook, terminado tox==3.20.1 # via -r dev-requirements.in -tqdm==4.51.0 # via twine +tqdm==4.54.1 # via twine traitlets==5.0.5 # via ipykernel, ipython, ipywidgets, jupyter-client, jupyter-core, nbclient, nbconvert, nbformat, notebook, qtconsole twine==3.2.0 # via -r dev-requirements.in -urllib3==1.25.11 # via -c docs/requirements.txt, requests -virtualenv==20.1.0 # via tox +urllib3==1.26.2 # via -c docs/requirements.txt, requests +virtualenv==20.2.2 # via tox wcwidth==0.2.5 # via prompt-toolkit webencodings==0.5.1 # via bleach -wheel==0.35.1 # via -r dev-requirements.in +wheel==0.36.1 # via -r dev-requirements.in widgetsnbextension==3.5.1 # via ipywidgets # The following packages are considered to be unsafe in a requirements file: diff --git a/docs/requirements.txt b/docs/requirements.txt index cfe7ace..37cb678 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -5,10 +5,10 @@ # pip-compile --output-file=docs/requirements.txt docs/requirements.in # alabaster==0.7.12 # via sphinx -attrs==20.2.0 # via markdown-it-py -babel==2.8.0 # via sphinx +attrs==20.3.0 # via markdown-it-py +babel==2.9.0 # via sphinx beautifulsoup4==4.9.3 # via sphinx-book-theme -certifi==2020.6.20 # via requests +certifi==2020.12.5 # via requests chardet==3.0.4 # via requests click==7.1.2 # via sphinx-book-theme docutils==0.16 # via myst-parser, sphinx, sphinx-book-theme @@ -18,25 +18,24 @@ jinja2==2.11.2 # via sphinx markdown-it-py==0.5.6 # via myst-parser markupsafe==1.1.1 # via jinja2 myst-parser==0.12.10 # via -r docs/requirements.in -packaging==20.4 # via sphinx +packaging==20.7 # via sphinx pydata-sphinx-theme==0.4.1 # via sphinx-book-theme -pygments==2.7.2 # via sphinx +pygments==2.7.3 # via sphinx pyparsing==2.4.7 # via packaging -pytz==2020.1 # via babel +pytz==2020.4 # via babel pyyaml==5.3.1 # via myst-parser, sphinx-book-theme -requests==2.24.0 # via sphinx -six==1.15.0 # via packaging +requests==2.25.0 # via sphinx snowballstemmer==2.0.0 # via sphinx soupsieve==2.0.1 # via beautifulsoup4 -sphinx-book-theme==0.0.38 # via -r docs/requirements.in -sphinx==3.2.1 # via -r docs/requirements.in, myst-parser, pydata-sphinx-theme, sphinx-book-theme +sphinx-book-theme==0.0.39 # via -r docs/requirements.in +sphinx==3.3.1 # via -r docs/requirements.in, myst-parser, pydata-sphinx-theme, sphinx-book-theme sphinxcontrib-applehelp==1.0.2 # via sphinx sphinxcontrib-devhelp==1.0.2 # via sphinx sphinxcontrib-htmlhelp==1.0.3 # via sphinx sphinxcontrib-jsmath==1.0.1 # via sphinx sphinxcontrib-qthelp==1.0.3 # via sphinx sphinxcontrib-serializinghtml==1.1.4 # via sphinx -urllib3==1.25.11 # via requests +urllib3==1.26.2 # via requests # The following packages are considered to be unsafe in a requirements file: # setuptools From 7c968570abb855363c73b826f1b8de08ef8adec3 Mon Sep 17 00:00:00 2001 From: Abhabongse Janthong <6845502+abhabongse@users.noreply.github.com> Date: Thu, 10 Dec 2020 17:42:38 +0700 Subject: [PATCH 2/3] Setup github actions workflows --- .github/workflows/python-package.yml | 54 ++++++++++++++++++++++++++++ .github/workflows/python-publish.yml | 31 ++++++++++++++++ Makefile | 2 +- README.md | 1 + setup.cfg | 2 ++ setup.py | 9 ++--- tox.ini | 2 +- 7 files changed, 93 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/python-package.yml create mode 100644 .github/workflows/python-publish.yml diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 0000000..134d336 --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,54 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Python package + +on: + push: + branches: [main, feature/*] + pull_request: + branches: [main] + +jobs: + build: + + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + python-version: [ '3.8', '3.9' ] + env: + OS: ${{ matrix.os }} + PYTHON: ${{ matrix.python-version }} + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install .[extras] + - name: Lint with flake8 + run: | + python -m pip install flake8 flake8-bugbear flake8-commas flake8-import-order + flake8 . + - name: Test with pytest and generate coverage report + run: | + python -m pip install pytest pytest-cov + pytest --cov --cov-report=xml -vv + - name: Upload coverage report to Codecov + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + flags: unittests + env_vars: OS,PYTHON + name: paxter-codecov + verbose: true + - name: Package sanity check + run: | + python -m pip install docutils check-manifest + python setup.py check --strict --metadata + check-manifest diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 0000000..4e1ef42 --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,31 @@ +# This workflows will upload a Python Package using Twine when a release is created +# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries + +name: Upload Python Package + +on: + release: + types: [created] + +jobs: + deploy: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/* diff --git a/Makefile b/Makefile index 52ca496..daa6c97 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,7 @@ ifndef VIRTUAL_ENV endif @which pip-sync >/dev/null 2>&1 || pip install pip-tools pip-sync $(REQUIREMENTS_FILES) - pip install -e .[extras] + pip install -e . .PHONY: lock_python_requirements lock_python_requirements: $(REQUIREMENTS_FILES) diff --git a/README.md b/README.md index bbc20a5..1f9ca4c 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@
Travis-CI Build Status Requirements Status + Coverage Status
diff --git a/setup.cfg b/setup.cfg index 96a468b..5a6f22f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -5,6 +5,8 @@ license_files = LICENSE universal = 0 [flake8] +count = True +statistics = True extend-exclude = venv/,*/migrations/* select = E,F,W,C,B,B902,B950,I extend-ignore = E501 diff --git a/setup.py b/setup.py index 0a2618b..bec0069 100644 --- a/setup.py +++ b/setup.py @@ -51,12 +51,9 @@ def read(*names, **kwargs): }, keywords=[], python_requires='>=3.8', - install_requires=[], - extras_require={ - 'extras': [ - 'click>=5.0', - ], - }, + install_requires=[ + 'click>=5.0', + ], entry_points={ 'console_scripts': [ 'paxter = paxter.__main__:program', diff --git a/tox.ini b/tox.ini index 3ccc06f..53b4723 100644 --- a/tox.ini +++ b/tox.ini @@ -16,7 +16,7 @@ passenv = * usedevelop = false deps = - .[extras] + . pytest pytest-cov pytest-travis-fold From 87a4302377c2d44caf0d411f713b0156614b5a90 Mon Sep 17 00:00:00 2001 From: Abhabongse Janthong <6845502+abhabongse@users.noreply.github.com> Date: Thu, 10 Dec 2020 18:07:53 +0700 Subject: [PATCH 3/3] Fix project setup bug: exclusing docs/ --- .travis.yml | 43 --------------------------------------- Makefile | 48 +++++++++++++++----------------------------- dev-requirements.in | 2 ++ dev-requirements.txt | 9 ++++++--- setup.cfg | 2 +- tox.ini | 27 ++++--------------------- 6 files changed, 29 insertions(+), 102 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ebeda0f..0000000 --- a/.travis.yml +++ /dev/null @@ -1,43 +0,0 @@ -dist: bionic -language: python - -env: - global: - - LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so - - SEGFAULT_SIGNALS=all - -matrix: - include: - - python: '3.8' - env: - - TOXENV=check - - python: '3.8' - env: - - TOXENV=py38,codecov - - python: '3.9' - env: - - TOXENV=py39,codecov - -before_install: - - python --version - - uname -a - - lsb_release -a || true - -install: - - python -m pip install --progress-bar=off -r dev-requirements.txt - - virtualenv --version - - easy_install --version - - pip --version - - tox --version - -script: - - tox -v - -after_failure: - - more .tox/log/* | cat - - more .tox/*/log/* | cat - -notifications: - email: - on_success: never - on_failure: always diff --git a/Makefile b/Makefile index daa6c97..860c839 100644 --- a/Makefile +++ b/Makefile @@ -65,54 +65,38 @@ endif ###################### .PHONY: test -test: flake8 pytest tox_python tox_sanity +test: tox sanity @# Run all code quality tools -.PHONY: pytest -pytest: - @# Run pyauthor unit tests (you may also specify ARGS='') -ifndef VIRTUAL_ENV - $(error must run target inside python virtualenv) -endif - python -m pytest -v $(ARGS) - -.PHONY: pytest_cov -pytest_cov: - @# Run pyauthor unit tests with code coverage summary -ifndef VIRTUAL_ENV - $(error must run target inside python virtualenv) -endif - python -m pytest $(foreach pkg,$(PYTHON_PROJECT_PACKAGES),"--cov=$(pkg)") \ - --cov-report=term-missing -v $(ARGS) - -.PHONY: tox_python -tox_python: - @# Run pytest on various pyauthor versions +.PHONY: tox +tox: + @# Run both flake8 and pytest on multiple python version ifndef VIRTUAL_ENV $(error must run target inside python virtualenv) endif tox -e py38 -e py39 -.PHONY: tox_sanity -tox_sanity: - @# Perform other package sanity checks - tox -e check - .PHONY: flake8 flake8: - @# Run flake8 pyauthor code linter tool + @# Run code linter tool on python source files ifndef VIRTUAL_ENV $(error must run target inside python virtualenv) endif - flake8 src tests setup.py + flake8 . -.PHONY: mypy -mypy: - @# Run pyauthor type checker tool +.PHONY: pytest +pytest: + @# Run unit testing on python source files (may also specify ARGS='') ifndef VIRTUAL_ENV $(error must run target inside python virtualenv) endif - mypy . + python -m pytest -vv $(ARGS) + +.PHONY: sanity +sanity: + @# Perform other package sanity checks + python setup.py check --strict --metadata + check-manifest .PHONY: test_clean test_clean: diff --git a/dev-requirements.in b/dev-requirements.in index 5368a1a..b410986 100644 --- a/dev-requirements.in +++ b/dev-requirements.in @@ -1,4 +1,6 @@ -c docs/requirements.txt +check-manifest>=0.45 +docutils>=0.16 flake8>=3.7.9 flake8-bugbear>=20.1.4 flake8-commas>=2.0.0 diff --git a/dev-requirements.txt b/dev-requirements.txt index d2afb4a..9d1d7a6 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -12,16 +12,18 @@ attrs==20.3.0 # via -c docs/requirements.txt, flake8-bugbear, jsonsc babel==2.9.0 # via -c docs/requirements.txt, sphinx backcall==0.2.0 # via ipython bleach==3.2.1 # via nbconvert, readme-renderer +build==0.1.0 # via check-manifest certifi==2020.12.5 # via -c docs/requirements.txt, requests cffi==1.14.4 # via argon2-cffi, cryptography chardet==3.0.4 # via -c docs/requirements.txt, requests +check-manifest==0.45 # via -r dev-requirements.in colorama==0.4.4 # via twine coverage==5.3 # via pytest-cov cryptography==3.3.1 # via secretstorage decorator==4.4.2 # via ipython defusedxml==0.6.0 # via nbconvert distlib==0.3.1 # via virtualenv -docutils==0.16 # via -c docs/requirements.txt, readme-renderer, sphinx +docutils==0.16 # via -c docs/requirements.txt, -r dev-requirements.in, readme-renderer, sphinx entrypoints==0.3 # via nbconvert filelock==3.0.12 # via tox, virtualenv flake8-bugbear==20.11.1 # via -r dev-requirements.in @@ -54,9 +56,10 @@ nbconvert==6.0.7 # via jupyter, notebook nbformat==5.0.8 # via ipywidgets, nbclient, nbconvert, notebook nest-asyncio==1.4.3 # via nbclient notebook==6.1.5 # via jupyter, widgetsnbextension -packaging==20.7 # via -c docs/requirements.txt, bleach, pytest, sphinx, tox +packaging==20.7 # via -c docs/requirements.txt, bleach, build, pytest, sphinx, tox pandocfilters==1.4.3 # via nbconvert parso==0.7.1 # via jedi +pep517==0.9.1 # via build pexpect==4.8.0 # via ipython pickleshare==0.7.5 # via ipython pkginfo==1.6.1 # via twine @@ -96,7 +99,7 @@ sphinxcontrib-qthelp==1.0.3 # via -c docs/requirements.txt, sphinx sphinxcontrib-serializinghtml==1.1.4 # via -c docs/requirements.txt, sphinx terminado==0.9.1 # via notebook testpath==0.4.4 # via nbconvert -toml==0.10.2 # via pytest, tox +toml==0.10.2 # via build, check-manifest, pep517, pytest, tox tornado==6.1 # via ipykernel, jupyter-client, livereload, notebook, terminado tox==3.20.1 # via -r dev-requirements.in tqdm==4.54.1 # via twine diff --git a/setup.cfg b/setup.cfg index 5a6f22f..a08a331 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,7 +7,7 @@ universal = 0 [flake8] count = True statistics = True -extend-exclude = venv/,*/migrations/* +extend-exclude = docs/,venv/,*/migrations/* select = E,F,W,C,B,B902,B950,I extend-ignore = E501 max-line-length = 100 diff --git a/tox.ini b/tox.ini index 53b4723..022fe35 100644 --- a/tox.ini +++ b/tox.ini @@ -2,12 +2,10 @@ envlist = py38 py39 - check ignore_basepython_conflict = true [testenv] basepython = - {check,codecov}: {env:TOXPYTHON:python3} py38: {env:TOXPYTHON:python3.8} py39: {env:TOXPYTHON:python3.9} setenv = @@ -17,29 +15,12 @@ passenv = usedevelop = false deps = . - pytest - pytest-cov - pytest-travis-fold -commands = - pytest --cov --cov-report=term-missing -vv tests - -[testenv:check] -deps = - docutils - check-manifest flake8 flake8-bugbear flake8-commas flake8-import-order -skip_install = true -commands = - python setup.py check --strict --metadata - check-manifest {toxinidir} - flake8 src tests setup.py - -[testenv:codecov] -deps = - codecov -skip_install = true + pytest + pytest-cov commands = - codecov [] + flake8 . + pytest --cov --cov-report=term-missing -v