Skip to content

Commit 35d2891

Browse files
authored
build: drop support for python3.7 (#245)
* build: drop 3.7 * minor changes
1 parent 8df7874 commit 35d2891

File tree

11 files changed

+10
-58
lines changed

11 files changed

+10
-58
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,35 +35,16 @@ jobs:
3535
matrix:
3636
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
3737
platform: [ubuntu-latest, macos-latest, windows-latest]
38-
include:
39-
- python-version: "3.7"
40-
platform: ubuntu-latest
4138

4239
steps:
4340
- uses: actions/checkout@v4
4441

45-
# we can't actually do the codegen on python3.7
46-
# (there's an issue with jinja template ordering)
47-
# so we build wheel before installing python 3.7
48-
- name: Build Wheel
49-
if: matrix.python-version == '3.7'
50-
run: |
51-
pip install -U pip build
52-
python -m build --wheel
53-
5442
- name: Set up Python ${{ matrix.python-version }}
5543
uses: actions/setup-python@v5
5644
with:
5745
python-version: ${{ matrix.python-version }}
5846

59-
- name: Install (3.7)
60-
if: matrix.python-version == '3.7'
61-
run: |
62-
whl=$(ls dist/*.whl)
63-
python -m pip install "${whl}[test,dev]"
64-
6547
- name: Install
66-
if: matrix.python-version != '3.7'
6748
run: |
6849
python -m pip install -U pip
6950
python -m pip install .[test,dev]
@@ -78,7 +59,6 @@ jobs:
7859
pytest --cov --cov-report=xml --cov-append
7960
8061
- uses: codecov/codecov-action@v4
81-
if: matrix.python-version != '3.7'
8262
with:
8363
token: ${{ secrets.CODECOV_TOKEN }}
8464

pyproject.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ name = "ome-types"
99
description = "Python dataclasses for the OME data model"
1010
keywords = ["ome", "ome-model", "microscopy", "schema", "types"]
1111
readme = "README.md"
12-
requires-python = ">=3.7"
12+
requires-python = ">=3.8"
1313
license = { text = "MIT" }
1414
authors = [{ name = "Talley Lambert", email = "[email protected]" }]
1515
classifiers = [
@@ -21,7 +21,6 @@ classifiers = [
2121
"Operating System :: OS Independent",
2222
"Programming Language :: Python",
2323
"Programming Language :: Python :: 3",
24-
"Programming Language :: Python :: 3.7",
2524
"Programming Language :: Python :: 3.8",
2625
"Programming Language :: Python :: 3.9",
2726
"Programming Language :: Python :: 3.10",
@@ -33,7 +32,6 @@ dependencies = [
3332
"pydantic >=1.9.0",
3433
"pydantic-compat >=0.1.0",
3534
"xsdata >=23.6, <25",
36-
"importlib_metadata; python_version < '3.8'",
3735
]
3836

3937
[project.urls]
@@ -93,7 +91,7 @@ exclude = ["src/ome_types/_autogenerated"]
9391
[tool.ruff]
9492
line-length = 88
9593
src = ["src", "tests"]
96-
target-version = "py37"
94+
target-version = "py38"
9795
select = [
9896
"E", # style errors
9997
"F", # flakes

src/ome_autogen/_generator.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from __future__ import annotations
22

3-
import sys
43
from contextlib import contextmanager
54
from pathlib import Path
65
from typing import TYPE_CHECKING, Callable, Iterator, NamedTuple, cast
@@ -180,18 +179,6 @@ def class_params(self, obj: Class) -> Iterator[tuple[str, str, str]]: # type: i
180179
# https://github.com/tefra/xsdata/issues/818
181180
# The type ignore is because xsdata returns an iterator of 2-tuples
182181
# but we want to return a 3-tuple.
183-
if sys.version_info < (3, 8): # pragma: no cover
184-
# i don't know why, but in python 3.7, it's not picking up our
185-
# template ... so this method yields too many values to unpack
186-
# xsdata/formats/dataclass/templates/docstrings.numpy.jinja2", line 6
187-
# {%- for var_name, var_doc in obj | class_params %}
188-
# ValueError: too many values to unpack (expected 2)
189-
# however, it's not at all important that we be able to build docs correctly
190-
# on python 3.7. The built wheel will still work fine (and won't be built
191-
# on python 3.7 anyway)
192-
yield from super().class_params(obj)
193-
return
194-
195182
for attr in obj.attrs:
196183
name = attr.name
197184
name = (

src/ome_autogen/main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from ome_autogen._transformer import OMETransformer
1414

1515
BLACK_LINE_LENGTH = 88
16-
BLACK_TARGET_VERSION = "py37"
16+
BLACK_TARGET_VERSION = "py38"
1717
BLACK_SKIP_TRAILING_COMMA = False # use trailing commas as a reason to split lines?
1818
OUTPUT_PACKAGE = "ome_types._autogenerated.ome_2016_06"
1919
DO_MYPY = os.environ.get("OME_AUTOGEN_MYPY", "0") == "1" or "--mypy" in sys.argv
@@ -106,8 +106,8 @@ def _print_green(text: str) -> None:
106106

107107
KWARGS_MODULE = """
108108
from __future__ import annotations
109-
from typing_extensions import TypedDict, TypeAlias
110-
from typing import Union, List
109+
from typing_extensions import TypeAlias
110+
from typing import Union, List, TypedDict
111111
from datetime import datetime
112112
import ome_types.model as ome
113113

src/ome_types/__init__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
try:
2-
from importlib.metadata import PackageNotFoundError, version
3-
except ImportError: # pragma: no cover
4-
from importlib_metadata import PackageNotFoundError, version # type: ignore
1+
from importlib.metadata import PackageNotFoundError, version
52

63
try:
74
__version__ = version("ome-types")

src/ome_types/_conversion.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,11 @@
2626

2727

2828
if TYPE_CHECKING:
29-
from typing import Any, BinaryIO, ContextManager, TypedDict
29+
from typing import Any, BinaryIO, ContextManager, Literal, TypedDict
3030
from xml.etree import ElementTree
3131

3232
import xmlschema
3333
from lxml.etree import _XSLTResultTree
34-
from typing_extensions import Literal
3534
from xsdata.formats.dataclass.parsers.mixins import XmlHandler
3635

3736
from ome_types._mixins._base_type import OMEType

src/ome_types/_mixins/_ids.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
from ome_types._pydantic_compat import field_regex
99

1010
if TYPE_CHECKING:
11+
from typing import Final
12+
1113
from pydantic import BaseModel
12-
from typing_extensions import Final
1314

1415
# Default value to support automatic numbering for id field values.
1516
AUTO_SEQUENCE: Final = "__auto_sequence__"

src/ome_types/_vendor/_pydantic_color_v2.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,7 @@
2222
import sys
2323
import typing
2424
from colorsys import hls_to_rgb, rgb_to_hls
25-
from typing import TYPE_CHECKING, Any, Callable, Tuple, Union, cast
26-
27-
if sys.version_info >= (3, 8): # pragma: no cover
28-
from typing import Literal
29-
else: # pragma: no cover
30-
from typing_extensions import Literal
25+
from typing import TYPE_CHECKING, Any, Callable, Tuple, Union, cast, Literal
3126

3227
from pydantic_core import CoreSchema, PydanticCustomError, core_schema
3328

tests/test_autogen.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ def imports_autogen(monkeypatch: MonkeyPatch) -> None:
2525

2626

2727
@pytest.mark.filterwarnings("ignore:Support for class-based::pydantic")
28-
@pytest.mark.skipif(sys.version_info < (3, 8), reason="docs fail on python3.7")
2928
@pytest.mark.skipif(not os.getenv("CI"), reason="slow")
3029
@pytest.mark.usefixtures("imports_autogen")
3130
def test_autogen(tmp_path: Path, monkeypatch: MonkeyPatch) -> None:

tests/test_model.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import datetime
44
import io
5-
import sys
65
import warnings
76
from pathlib import Path
87
from typing import Any
@@ -206,7 +205,6 @@ def test_update_unset(pixels: model.Pixels) -> None:
206205
assert from_xml(xml) == ome
207206

208207

209-
@pytest.mark.skipif(sys.version_info < (3, 8), reason="transform doesn't work on 3.7")
210208
@pytest.mark.filterwarnings("ignore::pytest.PytestUnraisableExceptionWarning")
211209
def test_transformations() -> None:
212210
from ome_types import etree_fixes

tests/test_serialization.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import json
44
import pickle
55
import re
6-
import sys
76
from functools import lru_cache
87
from pathlib import Path
98
from typing import TYPE_CHECKING, cast
@@ -75,7 +74,6 @@ def test_dict_roundtrip(valid_xml: Path) -> None:
7574
assert ome1 == ome2
7675

7776

78-
@pytest.mark.skipif(sys.version_info < (3, 8), reason="requires python3.8 or higher")
7977
def test_xml_roundtrip(valid_xml: Path) -> None:
8078
"""Ensure we can losslessly round-trip XML through the model and back."""
8179
if true_stem(valid_xml) in SKIP_ROUNDTRIP:

0 commit comments

Comments
 (0)