From dee9272044fa71700a393bc6fedb4bcc059ffd09 Mon Sep 17 00:00:00 2001 From: Jannic Warken Date: Mon, 19 Aug 2024 20:20:34 +0200 Subject: [PATCH] feat(python): support for 3.13 --- .github/workflows/ci.yml | 3 ++- CHANGELOG.md | 2 ++ pyproject.toml | 2 +- setup.cfg | 1 + src/result/result.py | 7 +++++-- tox.ini | 2 +- 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8cab7cc..40eb217 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,6 +14,7 @@ jobs: strategy: matrix: python: + - '3.13' - '3.12' - '3.11' - '3.10' @@ -53,7 +54,7 @@ jobs: # one for > 3.9) run: pytest tests/type_checking/test_result.yml - name: Run tests (pattern matching) - if: matrix.python == '3.10' || matrix.python == '3.11' || matrix.python == '3.12' + if: matrix.python == '3.10' || matrix.python == '3.11' || matrix.python == '3.12' || matrix.python == '3.13' run: pytest tests/test_pattern_matching.py # Linters diff --git a/CHANGELOG.md b/CHANGELOG.md index 73f5d08..7568e0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,8 +13,10 @@ Possible log types: ## [Unreleased] + - `[changed]` Improve type narrowing for `is_ok` and `is_err` type guards by replacing `typing.TypeGuard` with `typing.TypeIs` (#193) +- `[added]` Add support for Python 3.13 (#181) ## [0.17.0] - 2024-06-02 diff --git a/pyproject.toml b/pyproject.toml index c4d7077..bb085be 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools", "wheel"] build-backend = "setuptools.build_meta" [tool.mypy] -python_version = "3.12" +python_version = "3.13" files = [ "src", "tests", diff --git a/setup.cfg b/setup.cfg index b45c8f3..f9c427a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -20,6 +20,7 @@ classifiers = Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 Programming Language :: Python :: 3.12 + Programming Language :: Python :: 3.13 Programming Language :: Python :: 3 :: Only [options] diff --git a/src/result/result.py b/src/result/result.py index 8551239..936c07a 100644 --- a/src/result/result.py +++ b/src/result/result.py @@ -20,13 +20,16 @@ Union, ) -from typing_extensions import TypeIs - if sys.version_info >= (3, 10): from typing import ParamSpec, TypeAlias else: from typing_extensions import ParamSpec, TypeAlias +if sys.version_info >= (3, 13): + from typing import TypeIs +else: + from typing_extensions import TypeIs + T = TypeVar("T", covariant=True) # Success type E = TypeVar("E", covariant=True) # Error type diff --git a/tox.ini b/tox.ini index b8f9e0a..fe4d3d0 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py312,py311,py310,py39,py38 +envlist = py313,py312,py311,py310,py39,py38 [testenv] deps = -rrequirements-dev.txt