Skip to content

Commit

Permalink
Deprecate Python 3.6 & 3.7; get CI working again (#270)
Browse files Browse the repository at this point in the history
* Dropped Python 3.6 and Python 3.7 support.

* Added Python 3.10 and Python 3.11 to all the relevant places.

* Updated pre-commit hooks to latest versions.

* Replaced deprecated `isort` flag `-sl` with current `--force-single-line-imports`.

* Change `extras` dependencies to modern Poetry dependency groups.
    * Removed all Sphinx-related doc dependencies from the main dependency group.

* Fixed a few minor typing issues with `merge_styles`.

* Explicitly set the `prompt_toolkit` version to be `<=3.0.36` because `3.0.37` has introduced some event-loop-related bug.

* `make clean` will now also clean the docs.
  • Loading branch information
BrianPugh authored May 25, 2023
1 parent 87a891c commit 6cdc221
Show file tree
Hide file tree
Showing 17 changed files with 846 additions and 887 deletions.
191 changes: 94 additions & 97 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name: Continuous Integration
on:
push:
branches:
- master
- master
tags:
- '*'
- "*"
pull_request:

# SECRETS
Expand All @@ -18,35 +18,35 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout git repository 🕝
uses: actions/checkout@v3
- name: Checkout git repository 🕝
uses: actions/checkout@v3

- name: Set up Python 3.7 🐍
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Set up Python 3.11 🐍
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install poetry 🦄
uses: Gr1N/setup-poetry@v7
- name: Install poetry 🦄
uses: Gr1N/setup-poetry@v8

- name: Load Poetry Cached Libraries ⬇
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: ${{ runner.os }}-poetry-
- name: Load Poetry Cached Libraries ⬇
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: ${{ runner.os }}-poetry-

- name: Install dependencies 🖥
run: poetry install --no-interaction
- name: Install dependencies 🖥
run: poetry install --no-interaction

- name: Lint Code 🎎
run: make lint
- name: Lint Code 🎎
run: make lint

- name: Check Types 📚
run: make types
- name: Check Types 📚
run: make types

- name: Check Version Numbers 🕸
run: poetry run python scripts/validate_version.py
- name: Check Version Numbers 🕸
run: poetry run python scripts/validate_version.py

test:
name: Run Tests
Expand All @@ -55,113 +55,110 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.6, 3.7, 3.8, 3.9, '3.10']
python-version: ["3.8", "3.9", "3.10", "3.11"]
promttoolkit: [3.*, 2.*]
include:
- promttoolkit: 3.0.29
os: ubuntu-latest
python-version: '3.10'
- promttoolkit: 3.0.19
os: ubuntu-latest
python-version: '3.10'

steps:
- name: Checkout git repository 🕝
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }} 🐍
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install poetry 🦄
uses: Gr1N/setup-poetry@v7

- name: Load Poetry Cached Libraries ⬇
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: ${{ runner.os }}-poetry-

- name: Install dependencies 🖥
run: |
poetry install --no-interaction
poetry run pip install prompt_toolkit==${{ matrix.promttoolkit }}
- name: Test Code 🔍
run: make test

- name: Send Coverage Report 📊
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
COVERALLS_PARALLEL: true
run: poetry run coveralls

- name: Checkout git repository 🕝
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }} 🐍
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install poetry 🦄
uses: Gr1N/setup-poetry@v8

- name: Load Poetry Cached Libraries ⬇
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: ${{ runner.os }}-poetry-

- name: Install dependencies 🖥
run: |
poetry install --no-interaction
poetry run pip install prompt_toolkit==${{ matrix.promttoolkit }}
- name: Test Code 🔍
run: make test

- name: Send Coverage Report 📊
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
COVERALLS_PARALLEL: true
run: poetry run coveralls
post-test:
name: Signal test completion
needs: test
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Finished
run: |
pip3 install --upgrade coveralls
coveralls --service=github --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Finished
run: |
pip3 install --upgrade coveralls
coveralls --service=github --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

docs:
name: Test Docs
runs-on: ubuntu-latest

steps:
- name: Checkout git repository 🕝
uses: actions/checkout@v3
- name: Checkout git repository 🕝
uses: actions/checkout@v3

- name: Set up Python 3.7 🐍
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Set up Python 3.11 🐍
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install poetry 🦄
uses: Gr1N/setup-poetry@v7
- name: Install poetry 🦄
uses: Gr1N/setup-poetry@v8

- name: Load Poetry Cached Libraries ⬇
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: ${{ runner.os }}-poetry
- name: Load Poetry Cached Libraries ⬇
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: ${{ runner.os }}-poetry

- name: Install dependencies 🖥
run: poetry install --no-interaction --extras "docs"
- name: Install dependencies 🖥
run: poetry install --no-interaction --with=docs

- name: Build docs ⚒️
run: make docs
- name: Build docs ⚒️
run: make docs

deploy:
name: Deploy to PyPI
runs-on: ubuntu-latest

# deploy will only be run when there is a tag available
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: [quality, test, docs] # only run after all other stages succeeded
needs: [quality, test, docs] # only run after all other stages succeeded

steps:
- name: Checkout git repository 🕝
uses: actions/checkout@v3
- name: Checkout git repository 🕝
uses: actions/checkout@v3

- name: Set up Python 3.7 🐍
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Set up Python 3.11 🐍
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install poetry 🦄
uses: Gr1N/setup-poetry@v7
- name: Install poetry 🦄
uses: Gr1N/setup-poetry@v8

- name: Build ⚒️ Distributions
run: |
poetry build
poetry publish -u __token__ -p ${{ secrets.PYPI_TOKEN }}
- name: Build ⚒️ Distributions
run: |
poetry build
poetry publish -u __token__ -p ${{ secrets.PYPI_TOKEN }}
21 changes: 14 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,30 @@ repos:
rev: v1.1
hooks:
- id: autoflake
args: ['-i', '--remove-all-unused-imports']
args: ["-i", "--remove-all-unused-imports"]

- repo: https://github.com/psf/black
rev: 22.3.0
rev: 23.3.0
hooks:
- id: black
args: ['-l', '88']
args:
- "--target-version=py38"
- "--target-version=py39"
- "--target-version=py310"
- "--target-version=py311"
- "--line-length=88"

- repo: https://github.com/pycqa/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort
name: isort (python)
args: ['-sl', '--profile', 'black']
args:
- "--force-single-line-imports"
- "--profile=black"

- repo: https://github.com/pycqa/flake8
rev: 3.9.2
rev: 6.0.0
hooks:
- id: flake8
args: ['--max-line-length', '120', '--max-doc-length', '140']
args: ["--max-line-length", "120", "--max-doc-length", "140"]
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ clean:
rm -rf .mypy_cache/
rm -rf .pytest_cache/
rm -rf dist/
poetry run make -C docs clean

install:
poetry install --extras "docs"
Expand All @@ -44,6 +45,7 @@ test:
poetry run pytest --cov questionary -v

types:
poetry run mypy --version
poetry run mypy questionary

docs:
Expand Down
2 changes: 1 addition & 1 deletion docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# You can set these variables from the command line.
SPHINXOPTS = -W --keep-going -n
SPHINXBUILD = sphinx-build
SPHINXBUILD = python -m sphinx
SOURCEDIR = .
BUILDDIR = build

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"prompt_toolkit": ("https://python-prompt-toolkit.readthedocs.io/en/master/", None),
"prompt_toolkit": ("https://python-prompt-toolkit.readthedocs.io/en/3.0.36/", None),
}

autodoc_member_order = "alphabetical"
Loading

0 comments on commit 6cdc221

Please sign in to comment.