From cefb74e8b6e1862d3cdcbf9d9bf23dada1f73a24 Mon Sep 17 00:00:00 2001 From: Alessio Bogon <778703+youtux@users.noreply.github.com> Date: Wed, 16 Oct 2024 21:37:35 +0200 Subject: [PATCH] Drop support for python 3.8, declare support for 3.13 (#301) * Drop support for python 3.8, declare support for 3.13 * run `pyupgrade --py39-plus` on the codebase * Remove unused import --- .github/workflows/test-python.yml | 4 ++-- CHANGELOG.md | 2 +- python/gherkin/ast_builder.py | 6 +++--- python/gherkin/dialect.py | 24 +++++++++++------------ python/pyproject.toml | 2 +- python/test/count_symbols_test.py | 3 --- python/test/gherkin_test.py | 1 - python/test/pickles_test/compiler_test.py | 1 - python/tox.ini | 2 +- 9 files changed, 20 insertions(+), 25 deletions(-) diff --git a/.github/workflows/test-python.yml b/.github/workflows/test-python.yml index 67caa8103..76db6ecff 100644 --- a/.github/workflows/test-python.yml +++ b/.github/workflows/test-python.yml @@ -32,12 +32,12 @@ jobs: # - windows-latest - macos-13 python-version: + - '3.13' - '3.12' - '3.11' - '3.10' - '3.9' - - '3.8' - - 'pypy-3.8' + - 'pypy-3.9' steps: - uses: actions/checkout@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f736769f..9864fd873 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,7 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt - [.NET] Update System.Text.Json to 6.0.10 ### Removed -- [Python] Drop compatibility for python 2. Supported python versions are 3.8, 3.9, 3.10, 3.12 +- [Python] Drop compatibility for python 2 and python 3.8. Supported python versions: 3.9, 3.10, 3.11, 3.12, 3.13 - [Python] Removed installation of `gherkin` script. It was used for internal acceptance tests only. diff --git a/python/gherkin/ast_builder.py b/python/gherkin/ast_builder.py index 212f5156a..15a50a55c 100644 --- a/python/gherkin/ast_builder.py +++ b/python/gherkin/ast_builder.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TypedDict, cast, TypeVar, Union, List +from typing import TypedDict, cast, TypeVar, Union from .ast_node import AstNode from .errors import AstBuilderException @@ -140,7 +140,7 @@ def get_description(node: AstNode) -> str: @staticmethod def get_steps(node: AstNode) -> list[Step]: - return cast(List[Step], node.get_items("Step")) + return cast(list[Step], node.get_items("Step")) def transform_node( self, node: AstNode @@ -247,7 +247,7 @@ def transform_node( examples_line = examples_node.get_token("ExamplesLine") description = self.get_description(examples_node) examples_table_rows = cast( - List[TableRow], examples_node.get_single("ExamplesTable") + list[TableRow], examples_node.get_single("ExamplesTable") ) table_header = examples_table_rows[0] if examples_table_rows else None table_body = examples_table_rows[1:] if examples_table_rows else [] diff --git a/python/gherkin/dialect.py b/python/gherkin/dialect.py index c637a0211..3178cc94b 100644 --- a/python/gherkin/dialect.py +++ b/python/gherkin/dialect.py @@ -2,7 +2,7 @@ import os import json -from typing import TypedDict, List +from typing import TypedDict from typing_extensions import Self @@ -14,17 +14,17 @@ DialectSpec = TypedDict( "DialectSpec", { - "and": List[str], - "background": List[str], - "but": List[str], - "examples": List[str], - "feature": List[str], - "given": List[str], - "rule": List[str], - "scenario": List[str], - "scenarioOutline": List[str], - "then": List[str], - "when": List[str], + "and": list[str], + "background": list[str], + "but": list[str], + "examples": list[str], + "feature": list[str], + "given": list[str], + "rule": list[str], + "scenario": list[str], + "scenarioOutline": list[str], + "then": list[str], + "when": list[str], }, ) diff --git a/python/pyproject.toml b/python/pyproject.toml index b7f98aebd..57fd04dff 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -48,4 +48,4 @@ packages = ["gherkin"] force-exclude = """( (python/)?gherkin/parser.py )""" -target-version = ["py38", "py39", "py310", "py311", "py312", "py313"] +target-version = ["py39", "py310", "py311", "py312", "py313"] diff --git a/python/test/count_symbols_test.py b/python/test/count_symbols_test.py index 0d41f7553..b449ff49b 100644 --- a/python/test/count_symbols_test.py +++ b/python/test/count_symbols_test.py @@ -1,6 +1,3 @@ -# coding=utf-8 - - def test_count_length_of_astral_point_symbols_correctly(): string = "\U0001f63b" assert 1 == len(string) diff --git a/python/test/gherkin_test.py b/python/test/gherkin_test.py index ee3023b18..7f243cabc 100644 --- a/python/test/gherkin_test.py +++ b/python/test/gherkin_test.py @@ -1,4 +1,3 @@ -# coding=utf-8 from gherkin.token_scanner import TokenScanner from gherkin.token_matcher import TokenMatcher from gherkin.parser import Parser diff --git a/python/test/pickles_test/compiler_test.py b/python/test/pickles_test/compiler_test.py index 4c2702284..8081f767b 100644 --- a/python/test/pickles_test/compiler_test.py +++ b/python/test/pickles_test/compiler_test.py @@ -1,4 +1,3 @@ -# coding=utf-8 import json import textwrap diff --git a/python/tox.ini b/python/tox.ini index 6033180ac..23dce337d 100644 --- a/python/tox.ini +++ b/python/tox.ini @@ -13,7 +13,7 @@ # ============================================================================ [tox] -envlist = py312, py311, py310, py39, py38 +envlist = py313, py312, py311, py310, py39 # ----------------------------------------------------------------------------- # TEST ENVIRONMENTS: