diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dd7705b1..42363921 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} @@ -42,7 +42,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} diff --git a/README.md b/README.md index d1f30a92..e7ba576a 100644 --- a/README.md +++ b/README.md @@ -142,7 +142,7 @@ Use pip to install: $ pip install mashumaro ``` -The current version of `mashumaro` supports Python versions 3.8 — 3.12. +The current version of `mashumaro` supports Python versions 3.8 — 3.13. It's not recommended to use any version of Python that has reached its diff --git a/mashumaro/core/const.py b/mashumaro/core/const.py index 3e3262d1..20d8d438 100644 --- a/mashumaro/core/const.py +++ b/mashumaro/core/const.py @@ -9,6 +9,7 @@ "PY_310_MIN", "PY_311_MIN", "PY_312_MIN", + "PY_313_MIN", "PEP_585_COMPATIBLE", "Sentinel", ] @@ -18,8 +19,10 @@ PY_39 = sys.version_info.major == 3 and sys.version_info.minor == 9 PY_310 = sys.version_info.major == 3 and sys.version_info.minor == 10 PY_311 = sys.version_info.major == 3 and sys.version_info.minor == 11 -PY_312_MIN = sys.version_info.major == 3 and sys.version_info.minor >= 12 +PY_312 = sys.version_info.major == 3 and sys.version_info.minor == 12 +PY_313_MIN = sys.version_info.major == 3 and sys.version_info.minor >= 13 +PY_312_MIN = PY_312 or PY_313_MIN PY_311_MIN = PY_311 or PY_312_MIN PY_310_MIN = PY_310 or PY_311_MIN PY_39_MIN = PY_39 or PY_310_MIN diff --git a/requirements-dev.txt b/requirements-dev.txt index 449cd946..2d8c736e 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -3,7 +3,7 @@ msgpack>=0.5.6 pyyaml>=3.13 tomli-w>=1.0 tomli>=1.1.0;python_version<'3.11' -orjson>=3.6.1 +orjson>=3.6.1;python_version<'3.13' # tests mypy>=0.812 @@ -18,7 +18,7 @@ codespell>=2.2.2 # third party features ciso8601>=2.1.3 -pendulum>=2.1.2 +pendulum>=2.1.2;python_version<'3.13' # benchmark pyperf>=2.6.1 diff --git a/setup.py b/setup.py index 829fcd67..d7b76b94 100644 --- a/setup.py +++ b/setup.py @@ -18,6 +18,7 @@ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Development Status :: 5 - Production/Stable", ], license="Apache License, Version 2.0", diff --git a/tests/conftest.py b/tests/conftest.py index 9e2c07f7..26f3cf7d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,5 +1,16 @@ from unittest.mock import patch +from mashumaro.core.const import PY_313_MIN + +if PY_313_MIN: + collect_ignore = [ + "test_codecs/test_orjson_codec.py", + "test_discriminated_unions/test_dialects.py", + "test_orjson.py", + "test_pep_563.py", + "test_self.py", + ] + add_unpack_method = patch( "mashumaro.core.meta.code.builder.CodeBuilder.add_unpack_method", lambda *args, **kwargs: ..., diff --git a/tests/test_common.py b/tests/test_common.py index 5f0c5076..c628ef62 100644 --- a/tests/test_common.py +++ b/tests/test_common.py @@ -190,9 +190,8 @@ def __init__(self, number): instance = cls(1) with pytest.raises(AttributeError) as e: instance.new_attribute = 2 - assert ( - str(e.value) - == f"'{cls.__name__}' object has no attribute 'new_attribute'" + assert str(e.value).startswith( + f"'{cls.__name__}' object has no attribute 'new_attribute'" ) diff --git a/tests/test_metadata_options.py b/tests/test_metadata_options.py index a2d891f0..29899c9e 100644 --- a/tests/test_metadata_options.py +++ b/tests/test_metadata_options.py @@ -7,7 +7,7 @@ import pytest from mashumaro import DataClassDictMixin -from mashumaro.core.const import PY_312_MIN +from mashumaro.core.const import PY_312_MIN, PY_313_MIN from mashumaro.exceptions import ( UnserializableField, UnsupportedDeserializationEngine, @@ -58,6 +58,7 @@ class DataClass(DataClassDictMixin): assert instance == should_be +@pytest.mark.skipif(PY_313_MIN, reason="pendulum doesn't install on 3.13") def test_pendulum_datetime_parser(): @dataclass class DataClass(DataClassDictMixin): @@ -68,6 +69,7 @@ class DataClass(DataClassDictMixin): assert instance == should_be +@pytest.mark.skipif(PY_313_MIN, reason="pendulum doesn't install on 3.13") def test_pendulum_date_parser(): @dataclass class DataClass(DataClassDictMixin): @@ -78,6 +80,7 @@ class DataClass(DataClassDictMixin): assert instance == should_be +@pytest.mark.skipif(PY_313_MIN, reason="pendulum doesn't install on 3.13") def test_pendulum_time_parser(): @dataclass class DataClass(DataClassDictMixin):