Skip to content

Commit

Permalink
Drop support Python 3.7, run tests on Python 3.11
Browse files Browse the repository at this point in the history
FontTools has dropped support for 3.7, thus we follow suit

fonttools/fonttools#2879
fonttools/fonttools#2878
  • Loading branch information
anthrotype committed Nov 6, 2022
1 parent c7281e7 commit 0081fb6
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 37 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
runs-on: ${{ matrix.platform }}
strategy:
matrix:
python-version: ['3.7', '3.10']
python-version: ['3.8', '3.11']
platform: [ubuntu-latest, windows-latest]

steps:
Expand All @@ -54,7 +54,7 @@ jobs:
- name: Run Tox
run: tox -e py-cov
- name: Re-run Tox (without cattrs)
if: startsWith(matrix.platform, 'ubuntu-latest') && startsWith(matrix.python-version, '3.10')
if: startsWith(matrix.platform, 'ubuntu-latest') && startsWith(matrix.python-version, '3.11')
run: |
.tox/py-cov/bin/pip uninstall -y cattrs
tox -e py-cov --skip-pkg-install
Expand Down
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[mypy]
python_version = 3.7
python_version = 3.8

# Untyped definitions and calls
disallow_incomplete_defs = True
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ classifiers =
[options]
package_dir = =src
packages = find:
python_requires = >=3.7
python_requires = >=3.8
install_requires =
attrs >= 22.1.0
fonttools[ufo] >= 4.0.0
Expand Down
10 changes: 2 additions & 8 deletions src/ufoLib2/objects/contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import warnings
from collections.abc import MutableSequence
from typing import TYPE_CHECKING, Iterable, Iterator, List, Optional, overload
from typing import Iterable, Iterator, List, Optional, overload

from attrs import define, field
from fontTools.pens.basePen import AbstractPen
Expand All @@ -13,16 +13,10 @@
from ufoLib2.serde import serde
from ufoLib2.typing import GlyphSet

# For Python 3.7 compatibility.
if TYPE_CHECKING:
ContourMapping = MutableSequence[Point]
else:
ContourMapping = MutableSequence


@serde
@define
class Contour(ContourMapping):
class Contour(MutableSequence[Point]):
"""Represents a contour as a list of points.
Behavior:
Expand Down
10 changes: 2 additions & 8 deletions src/ufoLib2/objects/image.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from collections.abc import Mapping
from typing import TYPE_CHECKING, Any, ClassVar, Iterator, Optional, Tuple
from typing import Any, ClassVar, Iterator, Optional, Tuple

from attrs import define, field
from fontTools.misc.transform import Identity, Transform
Expand All @@ -10,16 +10,10 @@

from .misc import _convert_transform

# For Python 3.7 compatibility.
if TYPE_CHECKING:
ImageMapping = Mapping[str, Any]
else:
ImageMapping = Mapping


@serde
@define
class Image(ImageMapping):
class Image(Mapping[str, Any]):
"""Represents a background image reference.
See http://unifiedfontobject.org/versions/ufo3/images/ and
Expand Down
18 changes: 2 additions & 16 deletions src/ufoLib2/objects/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,8 @@ class DataPlaceholder(bytes):
Tds = TypeVar("Tds", bound="DataStore")


# For Python 3.7 compatibility.
if TYPE_CHECKING:
DataStoreMapping = MutableMapping[str, bytes]
else:
DataStoreMapping = MutableMapping


@define
class DataStore(DataStoreMapping):
class DataStore(MutableMapping[str, bytes]):
"""Represents the base class for ImageSet and DataSet.
Both behave like a dictionary that loads its "values" lazily by default and only
Expand Down Expand Up @@ -353,17 +346,10 @@ def _structure(
return self


# For Python 3.7 compatibility.
if TYPE_CHECKING:
AttrDictMixinMapping = Mapping[str, Any]
else:
AttrDictMixinMapping = Mapping


_T = TypeVar("_T", bound="AttrDictMixin")


class AttrDictMixin(AttrDictMixinMapping):
class AttrDictMixin(Mapping[str, Any]):
"""Read attribute values using mapping interface.
For use with Anchors, Guidelines and WoffMetadata classes, where client code
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = lint, py3{7,8,9,10}-cov, htmlcov
envlist = lint, py3{8,9,10,11}-cov, htmlcov
isolated_build = true

[testenv]
Expand Down

0 comments on commit 0081fb6

Please sign in to comment.