Add Python syntax highlighting to README.rst
#51
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: lint_python | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- v* | |
pull_request: | |
branches: | |
- '**' | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python: | |
- major_dot_minor: '3.10' | |
safety: false | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
# This allows the matrix to specify just the major.minor version while still | |
# expanding it to get the latest patch version including alpha releases. | |
# This avoids the need to update for each new alpha, beta, release candidate, | |
# and then finally an actual release version. actions/setup-python doesn't | |
# support this for PyPy presently so we get no help there. | |
# | |
# CPython -> 3.9.0-alpha - 3.9.X | |
# PyPy -> pypy-3.7 | |
python-version: ${{ fromJSON(format('["{0}", "{1}"]', format('{0}.0-alpha - {0}.X', matrix.python.major_dot_minor), matrix.python.major_dot_minor))[startsWith(matrix.python.major_dot_minor, 'pypy')] }} | |
architecture: x64 | |
- run: pip install --upgrade pip wheel | |
- run: pip install bandit black codespell flake8 flake8-2020 flake8-bugbear | |
flake8-comprehensions isort mypy pytest pyupgrade | |
- run: bandit --recursive --skip B101,B102,B307,B404,B603,B607 . | |
- run: black --check . || true | |
- run: codespell # --ignore-words-list="" --skip="*.css,*.js,*.lock" | |
- run: flake8 . --builtins=profile --count --select=E9,F63,F7,F82 --show-source --statistics | |
- run: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 | |
--show-source --statistics | |
- run: isort --check-only --profile black . || true | |
- run: pip install --editable . | |
- run: pip install numpy pylab-sdk | |
- run: mkdir --parents --verbose .mypy_cache | |
- run: mypy --ignore-missing-imports --install-types --non-interactive . || true | |
- run: shopt -s globstar && pyupgrade --py36-plus **/*.py || true | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python: | |
- major_dot_minor: '3.7' | |
safety: false | |
- major_dot_minor: '3.8' | |
safety: true | |
- major_dot_minor: '3.9' | |
safety: true | |
- major_dot_minor: '3.10' | |
safety: true | |
- major_dot_minor: '3.11' | |
safety: true | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
# This allows the matrix to specify just the major.minor version while still | |
# expanding it to get the latest patch version including alpha releases. | |
# This avoids the need to update for each new alpha, beta, release candidate, | |
# and then finally an actual release version. actions/setup-python doesn't | |
# support this for PyPy presently so we get no help there. | |
# | |
# CPython -> 3.9.0-alpha - 3.9.X | |
# PyPy -> pypy-3.7 | |
python-version: ${{ fromJSON(format('["{0}", "{1}"]', format('{0}.0-alpha - {0}.X', matrix.python.major_dot_minor), matrix.python.major_dot_minor))[startsWith(matrix.python.major_dot_minor, 'pypy')] }} | |
architecture: x64 | |
- run: pip install --upgrade pip wheel | |
- run: pip install pytest safety | |
- run: pip install --editable . | |
- run: pip install numpy pylab-sdk | |
- run: make test | |
- if: matrix.python.safety | |
run: safety check |