Skip to content

Commit

Permalink
add 3.10 support (#294)
Browse files Browse the repository at this point in the history
* add 3.10

* use strings

* add 310 to tox

* try no tox-conda

* filter warning

* remove xvfb from tox

* fix for 3.10 annotations changes

* try ternary

* undo ternary

* different matrix

* fix merge error
  • Loading branch information
tlambert03 committed Nov 8, 2021
1 parent 2cd0fce commit d09b7a0
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 17 deletions.
30 changes: 20 additions & 10 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,39 +11,49 @@ on:
- main
workflow_dispatch:


jobs:
test:
name: ${{ matrix.platform }} (${{ matrix.python-version }})
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: ["3.7", "3.8", "3.9"]
platform: [ubuntu-latest, macos-latest, windows-latest]
include:
# until pyside2 is available for 3.10
- python: '3.10'
backend: pyqt
platform: ubuntu-latest
- python: '3.10'
backend: pyqt
platform: macos-latest
- python: '3.10'
backend: pyqt
platform: windows-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Pre-install
if: runner.os == 'Linux'
run: |
sudo apt-get install -y libdbus-1-3 libxkbcommon-x11-0 libxcb-icccm4 \
libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 \
libxcb-xinerama0 libxcb-xinput0 libxcb-xfixes0
- uses: tlambert03/setup-qt-libs@v1
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools tox tox-gh-actions
- name: Test with tox
run: tox
uses: GabrielBB/xvfb-action@v1
with:
run: tox
env:
PLATFORM: ${{ matrix.platform }}
BACKEND: ${{ matrix.backend }}
- name: Coverage
if: runner.os == 'Linux'
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true

deploy:
needs: test
Expand Down
10 changes: 8 additions & 2 deletions magicgui/widgets/_bases/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,14 @@ def __init__(
f"{type(self).__name__} got an unexpected "
f"keyword argument: {', '.join(extra)}"
)

_prot = self.__class__.__annotations__["_widget"]
for m in self.__class__.__mro__[:-1]:
_prot = m.__annotations__.get("_widget")
if _prot:
break
else:
raise TypeError(
f"Widget type {self.__class__} declared no _widget annotation"
)
if not isinstance(_prot, str):
_prot = _prot.__name__
prot = getattr(_protocols, _prot.replace("_protocols.", ""))
Expand Down
8 changes: 6 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ classifiers =
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Topic :: Desktop Environment
Topic :: Software Development
Topic :: Software Development :: User Interfaces
Expand Down Expand Up @@ -60,7 +61,6 @@ image =
pillow>=4.0
testing =
tox
tox-conda
pytest
pytest-qt
pytest-cov
Expand All @@ -80,6 +80,7 @@ dev =
mypy
pre-commit
pydocstyle
tox-conda
%(testing)s
%(pyqt5)s

Expand All @@ -106,7 +107,10 @@ add_select = D402,D415,D417
ignore = D100, D213, D401, D413, D107

[tool:pytest]
addopts = -v -W error --mypy-ini-file=setup.cfg
addopts = -v --mypy-ini-file=setup.cfg
filterwarnings =
error
ignore::DeprecationWarning:qtpy

[mypy]
files = magicgui
Expand Down
8 changes: 5 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
[tox]
envlist = py{37,38,39}-{linux,macos,windows}-{pyqt,pyside}
envlist = py{37,38,39,310}-{linux,macos,windows}-{pyqt,pyside}
toxworkdir=/tmp/.tox

[gh-actions]
python =
3.7: py37
3.8: py38
3.9: py39
3.10: py310

[gh-actions:env]
PLATFORM =
ubuntu-latest: linux
macos-latest: macos
windows-latest: windows
BACKEND =
pyqt: pyqt
pyside: pyside

[testenv]
platform =
Expand All @@ -22,8 +26,6 @@ platform =
passenv = CI GITHUB_ACTIONS DISPLAY XAUTHORITY
setenv =
PYTHONPATH = {toxinidir}
deps =
pytest-xvfb ; sys_platform == 'linux'
extras =
testing
pyqt: PyQt5
Expand Down

0 comments on commit d09b7a0

Please sign in to comment.