Skip to content

Commit

Permalink
build: drop python 3.7, support 3.11 (#482)
Browse files Browse the repository at this point in the history
* chore: support 3.11, drop 3.7

* bump pyupgrade

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* lint

* test: try fix tests on py311

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
tlambert03 and pre-commit-ci[bot] committed Oct 29, 2022
1 parent 23372b0 commit a6db169
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 31 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ jobs:
platform: [ubuntu-latest, macos-latest, windows-latest]
backend: [pyqt5, pyside2]
include:
- python-version: "3.7"
- python-version: "3.11"
platform: ubuntu-latest
backend: pyqt5
- python-version: "3.7"
- python-version: "3.11"
platform: macos-latest
backend: pyqt5
- python-version: "3.7"
- python-version: "3.11"
platform: windows-2022
backend: pyside2
backend: pyqt5
- python-version: "3.10"
platform: ubuntu-latest
backend: pyqt6
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
- uses: tlambert03/setup-qt-libs@v1
- uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: "3.9"
- name: Install
run: |
python -m pip install --upgrade pip
Expand All @@ -102,7 +102,7 @@ jobs:
- uses: tlambert03/setup-qt-libs@v1
- uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: "3.10"
- name: Install
run: |
python -m pip install --upgrade pip
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repos:
rev: v3.1.0
hooks:
- id: pyupgrade
args: ["--py37-plus", "--keep-runtime-typing"]
args: ["--py38-plus", "--keep-runtime-typing"]
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
Expand Down
2 changes: 1 addition & 1 deletion magicgui/_mpl_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ def pil_to_array(pilImage):
return np.asarray(pilImage) # return MxNx4 RGBA array


@lru_cache()
@lru_cache
def _get_ssl_context():
try:
import certifi
Expand Down
3 changes: 2 additions & 1 deletion magicgui/type_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
DefaultDict,
ForwardRef,
Iterator,
Literal,
Optional,
Sequence,
Set,
Expand All @@ -24,7 +25,7 @@
overload,
)

from typing_extensions import Literal, get_args, get_origin
from typing_extensions import get_args, get_origin

from magicgui import widgets
from magicgui.types import (
Expand Down
3 changes: 2 additions & 1 deletion magicgui/widgets/_concrete.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
Generic,
Iterable,
Iterator,
Literal,
Sequence,
Tuple,
TypeVar,
Expand All @@ -24,7 +25,7 @@
from weakref import ref

from docstring_parser import DocstringParam, parse
from typing_extensions import Literal, get_args, get_origin
from typing_extensions import get_args, get_origin

from magicgui._type_resolution import resolve_single_type
from magicgui.application import use_app
Expand Down
4 changes: 1 addition & 3 deletions magicgui/widgets/_image.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from __future__ import annotations

from typing import TYPE_CHECKING

from typing_extensions import Literal
from typing import TYPE_CHECKING, Literal

from ._bases import ValueWidget
from ._concrete import backend_widget
Expand Down
13 changes: 10 additions & 3 deletions magicgui/widgets/_protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@
from __future__ import annotations

from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any, Callable, Iterable, Optional, Sequence

from typing_extensions import Protocol, runtime_checkable
from typing import (
TYPE_CHECKING,
Any,
Callable,
Iterable,
Optional,
Protocol,
Sequence,
runtime_checkable,
)

if TYPE_CHECKING:
import numpy as np
Expand Down
3 changes: 1 addition & 2 deletions magicgui/widgets/_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
ItemsView,
Iterator,
KeysView,
Literal,
Mapping,
MutableMapping,
Sequence,
Expand All @@ -20,8 +21,6 @@
)
from warnings import warn

from typing_extensions import Literal

from magicgui.application import use_app
from magicgui.widgets._bases.mixins import _ReadOnlyMixin
from magicgui.widgets._bases.value_widget import ValueWidget
Expand Down
8 changes: 4 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ classifiers =
Programming Language :: C
Programming Language :: Python
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Topic :: Desktop Environment
Topic :: Software Development
Topic :: Software Development :: User Interfaces
Expand All @@ -38,7 +38,7 @@ classifiers =
[options]
zip_safe = False
packages = find:
python_requires = >=3.7
python_requires = >=3.8
setup_requires =
setuptools_scm
install_requires =
Expand All @@ -59,7 +59,6 @@ magicgui =

[options.extras_require]
pyside2 =
pyside2>=5.13 ; python_version=='3.7'
pyside2>=5.14 ; python_version=='3.8'
pyside2>=5.15 ; python_version>='3.9'
pyqt5 =
Expand All @@ -81,7 +80,7 @@ testing =
pytest-cov
pytest-mypy-testing
numpy
pandas ; python_version>'3.7'
pandas
%(tqdm)s
%(image)s
matplotlib
Expand Down Expand Up @@ -130,6 +129,7 @@ filterwarnings =
error
ignore::DeprecationWarning:qtpy
ignore:distutils Version classes are deprecated
ignore:path is deprecated:DeprecationWarning

[mypy]
files = magicgui
Expand Down
5 changes: 0 additions & 5 deletions tests/test_docs.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import os
import re
import runpy
import sys
from glob import glob
from pathlib import Path

Expand Down Expand Up @@ -42,9 +40,6 @@ def test_doc_code_cells(fname, globalns=globals()):
)
def test_examples(fname, monkeypatch):
"""Make sure that all code cells in documentation perform as expected."""
if "table.py" in fname and os.name == "nt" and sys.version_info < (3, 8):
pytest.mark.skip()
return
if "values_dialog" in str(fname):
from magicgui.backends._qtpy.widgets import QtW # type: ignore

Expand Down
4 changes: 2 additions & 2 deletions tests/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1113,9 +1113,9 @@ def func(range_value: Tuple[float, float] = (0.2, 0.8)):


def test_literal():
from typing import Set
from typing import Literal, Set

from typing_extensions import Literal, get_args
from typing_extensions import get_args

Lit = Literal[None, "a", 1, True, b"bytes"]

Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[tox]
envlist = py{37,38,39,310}-{linux,macos,windows}-{pyqt5,pyside2,pyqt6,pyside6}
envlist = py{38,39,310,311}-{linux,macos,windows}-{pyqt5,pyside2,pyqt6,pyside6}
toxworkdir=/tmp/.tox
isolated_build = True

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

[gh-actions:env]
PLATFORM =
Expand Down

0 comments on commit a6db169

Please sign in to comment.