Skip to content

Commit

Permalink
Drop python 3.7 support
Browse files Browse the repository at this point in the history
  • Loading branch information
tefra committed Jul 23, 2023
1 parent cb80011 commit 3166fd8
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 42 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,11 @@ jobs:
fail-fast: false
matrix:
include:
- {name: PyPy 3.7, python: 'pypy-3.7', os: ubuntu}
- {name: Python 3.7, python: '3.7', os: ubuntu}
- {name: Python 3.8, python: '3.8', os: ubuntu}
- {name: Python 3.9, python: '3.9', os: ubuntu}
- {name: Python 3.10, python: '3.10', os: ubuntu}
- {name: Python 3.11, python: '3.11', os: ubuntu}
- {name: Python 3.12, python: '3.12-dev', os: ubuntu}
- {name: Windows py37, python: '3.7', os: windows}
- {name: MacOS py37, python: '3.7', os: macos}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repos:
rev: v3.9.0
hooks:
- id: pyupgrade
args: [ --py37-plus ]
args: [ --py38-plus ]
- repo: https://github.com/asottile/reorder_python_imports
rev: v3.10.0
hooks:
Expand Down
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"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",
Expand All @@ -26,10 +25,9 @@ classifiers = [
"Topic :: Text Processing :: Markup :: XML",
]
keywords = ["xsd", "wsdl", "schema", "dtd", "binding", "xml", "json", "dataclasses", "generator", "cli"]
requires-python = ">=3.7"
requires-python = ">=3.8"
dependencies = [
"typing-extensions",
'importlib-metadata;python_version<"3.8"',
]
dynamic = ["version"]

Expand Down
21 changes: 0 additions & 21 deletions tests/models/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,27 +197,6 @@ def test_format_kw_only_requires_310(self):
else:
self.assertIsNotNone(OutputFormat(kw_only=True))

def test_postponed_annotations_requires_37(self):
# We need to confuse pyupgrade into not discarding Python version checks,
# which are needed to know when the warning is triggered or not
# Extracting the version in a local variable before performing the check is
# sufficient for that purpose.
v = sys.version_info
if v < (3, 7):
with warnings.catch_warnings(record=True) as w:
self.assertFalse(
GeneratorOutput(postponed_annotations=True).postponed_annotations
)
self.assertEqual(
"postponed annotations requires python >= 3.7, reverting...",
str(w[-1].message),
)

if v >= (3, 7):
self.assertTrue(
GeneratorOutput(postponed_annotations=True).postponed_annotations
)

def test_init_config_with_aliases(self):
config = GeneratorConfig(
aliases=GeneratorAliases(
Expand Down
4 changes: 2 additions & 2 deletions tests/utils/test_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


class HooksTests(TestCase):
@mock.patch("xsdata.utils.hooks.importlib_metadata.entry_points")
@mock.patch("xsdata.utils.hooks.metadata.entry_points")
def test_load_entry_points_with_mapping_api(self, mock_entry_points):
first_ep = mock.Mock()
second_ep = mock.Mock()
Expand All @@ -21,7 +21,7 @@ def test_load_entry_points_with_mapping_api(self, mock_entry_points):
second_ep.load.assert_called_once_with()
self.assertEqual(0, third_ep.load.call_count)

@mock.patch("xsdata.utils.hooks.importlib_metadata.entry_points")
@mock.patch("xsdata.utils.hooks.metadata.entry_points")
def test_load_entry_points_with_select_api(self, mock_entry_points):
first_ep = mock.Mock()
second_ep = mock.Mock()
Expand Down
8 changes: 4 additions & 4 deletions xsdata/models/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ class CompoundFields:
:param default_name: Default compound field name, default: choice
:param force_default_name: Always use the default compound field,
otherwise if the number of elements is less than 4 the generator
will try to dynamically create the field name eg.
will try to dynamically create the field name e.g.
hat_or_dress_or_something.
"""

Expand All @@ -267,7 +267,7 @@ class GeneratorOutput:
default: false, python>=3.9 Only
:param union_type: Use PEP-604 union type, default: false, python>=3.10 Only
:param postponed_annotations: Enable postponed evaluation of annotations,
default: false, python>=3.7 Only
default: false
:param unnest_classes: Move inner classes to upper level, default: false
:param ignore_patterns: Ignore pattern restrictions, default: false
:param include_header: Include a header with codegen information in the output,
Expand Down Expand Up @@ -328,7 +328,7 @@ class NameConvention:
"""
Name convention model.
:param case: Naming scheme, eg camelCase, snakeCase
:param case: Naming scheme, e.g. camelCase, snakeCase
:param safe_prefix: A prefix to be prepended into names that match
one of the reserved words: and, except, lambda, with, as,
finally, nonlocal, while, assert, false, none, yield, break,
Expand Down Expand Up @@ -378,7 +378,7 @@ class GeneratorAlias:
Each alias has a source attribute that refers to the original name
in the schema definition and the target attribute for output name.
For package and module aliases the source refers to the schema
filename or target namespace depending the selected output
filename or target namespace depending on the selected output
structure.
:param source: The source name from schema definition
Expand Down
9 changes: 2 additions & 7 deletions xsdata/utils/hooks.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import sys

if sys.version_info >= (3, 8):
from importlib import metadata as importlib_metadata
else:
import importlib_metadata
from importlib import metadata


def load_entry_points(name: str):
entry_points = importlib_metadata.entry_points()
entry_points = metadata.entry_points()

if hasattr(entry_points, "select"):
plugins = entry_points.select(group=name) # type: ignore
Expand Down

0 comments on commit 3166fd8

Please sign in to comment.