Skip to content

Commit

Permalink
Drop Python 2 support and add 3.10 support
Browse files Browse the repository at this point in the history
Signed-off-by: Bernát Gábor <gaborjbernat@gmail.com>
  • Loading branch information
gaborbernat authored and erikseulean committed Dec 28, 2021
1 parent 64539dd commit 47b6b41
Show file tree
Hide file tree
Showing 30 changed files with 555 additions and 624 deletions.
183 changes: 114 additions & 69 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,95 +3,140 @@ on:
push:
pull_request:

concurrency:
group: check-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest

runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/action@v2.0.0
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/action@v2.0.3
env:
SETUPTOOLS_USE_DISTUTILS: stdlib

test:
name: ${{ matrix.py }}
runs-on: Ubuntu-latest
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
py:
- 3.9
- 3.8
- 3.7
- 3.6
- 2.7
- pypy2
- pypy3
- "3.10"
- "3.9"
- "3.8"
- "3.7"
- "pypy-3.7-v7.3.7"

steps:
- uses: actions/checkout@v2
- name: setup python for tox
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: install tox
run: python -m pip install tox
- name: setup python for test ${{ matrix.py }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.py }}
- name: Pick environment to run
run: |
import platform; import os; import sys; import codecs
cpy = platform.python_implementation() == "CPython"
base =("{}{}{}" if cpy else "{}{}").format("py" if cpy else "pypy", *sys.version_info[0:2])
env = "TOXENV={}\n".format(base)
print("Picked:\n{}for{}".format(env, sys.version))
with codecs.open(os.environ["GITHUB_ENV"], "a", "utf-8") as file_handler:
file_handler.write(env)
shell: python
- name: setup test suite for ${{ matrix.py }}
run: tox -vv --notest
- name: run test suite for ${{ matrix.py }}
run: tox --skip-pkg-install
- name: Rename coverage report file
run:
import os; import sys; os.rename(f".tox/.coverage.{os.environ['TOXENV']}",
f".tox/.coverage.{os.environ['TOXENV']}-{sys.platform}")
shell: python
- name: Upload coverage data
uses: actions/upload-artifact@v2
with:
name: coverage-data
path: ".tox/.coverage.*"

coverage:
name: Combine coverage
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v2
- name: setup python for tox
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: install tox
run: python -m pip install tox
- name: setup python for test ${{ matrix.py }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.py }}
- name: Pick environment to run
run: |
import platform; import os; import sys; import codecs
cpy = platform.python_implementation() == "CPython"
base =("{}{}{}" if cpy else "{}{}").format("py" if cpy else "pypy", *sys.version_info[0:2])
env = "TOXENV={}\n".format(base)
print("Picked:\n{}for{}".format(env, sys.version))
with codecs.open(os.environ["GITHUB_ENV"], "a", "utf-8") as file_handler:
file_handler.write(env)
shell: python
- name: setup test suite for ${{ matrix.py }}
run: tox -vv --notest
- name: run test suite for ${{ matrix.py }}
run: tox --skip-pkg-install
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install tox
run: python -m pip install tox
- name: Setup coverage tool
run: tox -e coverage --notest
- name: Install package builder
run: python -m pip install build
- name: Build package
run: pyproject-build --wheel .
- name: Download coverage data
uses: actions/download-artifact@v2
with:
name: coverage-data
path: .tox
- name: Combine and report coverage
run: tox -e coverage
- name: Upload HTML report
uses: actions/upload-artifact@v2
with:
name: html-report
path: .tox/htmlcov

check:
name: check ${{ matrix.tox_env }}
runs-on: Ubuntu-latest
name: tox env ${{ matrix.tox_env }}
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
tox_env:
- package_description
- docs

- readme
- docs
- type
steps:
- uses: actions/checkout@v2
- name: setup Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: install tox
run: python -m pip install tox
- name: run check for ${{ matrix.tox_env }}
run: python -m tox -e ${{ matrix.tox_env }}
- uses: actions/checkout@v2
- name: setup Python "3.10"
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: install tox
run: python -m pip install tox
- name: run check for ${{ matrix.tox_env }}
run: python -m tox -e ${{ matrix.tox_env }}

publish:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: [check, test, lint]
runs-on: ubuntu-latest
needs: [check, coverage, lint]
runs-on: ubuntu-20.04
steps:
- name: setup python to build package
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: install build
run: python -m pip install build
- uses: actions/checkout@v2
- name: build package
run: python -m build --sdist --wheel . -o dist
- name: publish to PyPi
uses: pypa/gh-action-pypi-publish@master
with:
skip_existing: true
user: __token__
password: ${{ secrets.pypi_password }}
- name: setup python to build package
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: install build
run: python -m pip install build
- uses: actions/checkout@v2
- name: build package
run: python -m build --sdist --wheel . -o dist
- name: publish to PyPi
uses: pypa/gh-action-pypi-publish@master
with:
skip_existing: true
user: __token__
password: ${{ secrets.pypi_password }}
100 changes: 54 additions & 46 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,49 +1,57 @@
repos:
- repo: https://github.com/psf/black
rev: 21.8b0
hooks:
- id: black
args: [--safe]
- repo: https://github.com/asottile/blacken-docs
rev: v1.11.0
hooks:
- id: blacken-docs
args: [--skip-errors]
additional_dependencies: [black==21.8b0]
- repo: https://github.com/PyCQA/isort
rev: 5.9.3
hooks:
- id: isort
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: debug-statements
- repo: https://github.com/PyCQA/flake8
rev: 3.9.2
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear==21.4.3
- flake8-comprehensions==3.5
- flake8-pytest-style==1.5
- flake8-unused-arguments==0.0.6
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.17.0
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/asottile/pyupgrade
rev: v2.25.0
hooks:
- id: pyupgrade
- repo: https://github.com/pre-commit/pygrep-hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: check-ast
- id: check-builtin-literals
- id: check-docstring-first
- id: check-merge-conflict
- id: check-yaml
- id: check-toml
- id: debug-statements
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/asottile/pyupgrade
rev: v2.29.1
hooks:
- id: pyupgrade
args: [ "--py36-plus" ]
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 21.12b0
hooks:
- id: black
args: [ --safe ]
- repo: https://github.com/asottile/blacken-docs
rev: v1.12.0
hooks:
- id: blacken-docs
additional_dependencies: [ black==21.12b0 ]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
hooks:
- id: rst-backticks
- repo: https://github.com/tox-dev/tox-ini-fmt
rev: "0.5.1"
hooks:
- id: tox-ini-fmt
args: ["-p", "fix_lint"]
- id: rst-backticks
- repo: https://github.com/tox-dev/tox-ini-fmt
rev: "0.5.1"
hooks:
- id: tox-ini-fmt
args: [ "-p", "fix" ]
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.20.0
hooks:
- id: setup-cfg-fmt
args: [ --min-py3-version, "3.7", "--max-py-version", "3.10" ]
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear==21.11.29
- flake8-comprehensions==3.7
- flake8-pytest-style==1.6
- flake8-unused-arguments==0.0.9
- flake8-noqa==1.2.1
- pep8-naming==0.12.1
21 changes: 13 additions & 8 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
version: 2
sphinx:
builder: html
configuration: doc/conf.py
fail_on_warning: true
formats: all
build:
os: ubuntu-20.04
tools:
python: "3.10"
formats:
- htmlzip
- epub
- pdf
python:
version: 3.7
install:
- method: pip
path: .
build:
image: latest
extra_requirements: ["docs"]
sphinx:
builder: html
configuration: doc/conf.py
fail_on_warning: true

0 comments on commit 47b6b41

Please sign in to comment.