Repository: Fatal1ty/mashumaro (language: python)

Issue:
Add support for Python 3.12
**Is your feature request related to a problem? Please describe.**

We should add a new Python to the workflow matrix as stated in [this](https://dev.to/hugovk/help-test-python-312-beta-1508) article and see how it goes.

Blockers:
* https://github.com/sdispater/pendulum/issues/696
* https://github.com/Fatal1ty/mashumaro/issues/152


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 3d5434ea..1b91e8c3 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -14,13 +14,14 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        python-version: ["3.8", "3.9", "3.10", "3.11"]
+        python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
     steps:
       - uses: actions/checkout@v3
       - name: Set up Python ${{ matrix.python-version }}
         uses: actions/setup-python@v4
         with:
           python-version: ${{ matrix.python-version }}
+          allow-prereleases: true
       - name: Install dependencies
         run: |
           pip install --upgrade pip
@@ -41,13 +42,14 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        python-version: ["3.8", "3.9", "3.10", "3.11"]
+        python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
     steps:
     - uses: actions/checkout@v3
     - name: Set up Python ${{ matrix.python-version }}
       uses: actions/setup-python@v4
       with:
         python-version: ${{ matrix.python-version }}
+        allow-prereleases: true
     - name: Install dependencies
       run: |
         pip install --upgrade pip
@@ -68,13 +70,14 @@ jobs:
     runs-on: windows-latest
     strategy:
       matrix:
-        python-version: ["3.8", "3.9", "3.10", "3.11"]
+        python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
     steps:
     - uses: actions/checkout@v3
     - name: Set up Python ${{ matrix.python-version }}
       uses: actions/setup-python@v4
       with:
         python-version: ${{ matrix.python-version }}
+        allow-prereleases: true
     - name: Install dependencies
       run: |
         pip install --upgrade pip
diff --git a/README.md b/README.md
index 9694aa60..59e20f26 100644
--- a/README.md
+++ b/README.md
@@ -105,7 +105,7 @@ Use pip to install:
 $ pip install mashumaro
 ```
 
-The current version of `mashumaro` supports Python versions 3.8 - 3.11.
+The current version of `mashumaro` supports Python versions 3.8 — 3.12.
 
 
 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 06bf25c0..4ad7ce5c 100644
--- a/mashumaro/core/const.py
+++ b/mashumaro/core/const.py
@@ -9,6 +9,7 @@
     "PY_39_MIN",
     "PY_310_MIN",
     "PY_311_MIN",
+    "PY_312_MIN",
     "PEP_585_COMPATIBLE",
     "PEP_586_COMPATIBLE",
     "Sentinel",
diff --git a/mashumaro/jsonschema/models.py b/mashumaro/jsonschema/models.py
index 3b6f6f5a..dbf43e18 100644
--- a/mashumaro/jsonschema/models.py
+++ b/mashumaro/jsonschema/models.py
@@ -98,11 +98,7 @@ class JSONSchema(DataClassJSONMixin):
     enum: Optional[List[Any]] = None
     const: Optional[Any] = field(default_factory=lambda: MISSING)
     format: Optional[
-        Union[
-            JSONSchemaInstanceFormat,
-            JSONSchemaStringFormat,
-            JSONSchemaInstanceFormatExtension,
-        ]
+        Union[JSONSchemaStringFormat, JSONSchemaInstanceFormatExtension]
     ] = None
     title: Optional[str] = None
     description: Optional[str] = None
diff --git a/requirements-dev.txt b/requirements-dev.txt
index e79459ac..f0d1d1a9 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -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.12'
 
 # benchmark
 pyperf>=2.6.1
diff --git a/setup.py b/setup.py
index 44362821..efa5f800 100644
--- a/setup.py
+++ b/setup.py
@@ -17,6 +17,7 @@
         "Programming Language :: Python :: 3.9",
         "Programming Language :: Python :: 3.10",
         "Programming Language :: Python :: 3.11",
+        "Programming Language :: Python :: 3.12",
         "Development Status :: 5 - Production/Stable",
     ],
     license="Apache License, Version 2.0",


Test patch:
diff --git a/tests/test_metadata_options.py b/tests/test_metadata_options.py
index 479b679f..2bbc31a0 100644
--- a/tests/test_metadata_options.py
+++ b/tests/test_metadata_options.py
@@ -7,6 +7,7 @@
 import pytest
 
 from mashumaro import DataClassDictMixin
+from mashumaro.core.const import PY_312_MIN
 from mashumaro.exceptions import (
     UnserializableField,
     UnsupportedDeserializationEngine,
@@ -57,16 +58,22 @@ class DataClass(DataClassDictMixin):
     assert instance == should_be
 
 
+@pytest.mark.skipif(
+    PY_312_MIN, reason="https://github.com/sdispater/pendulum/issues/696"
+)
 def test_pendulum_datetime_parser():
     @dataclass
     class DataClass(DataClassDictMixin):
         x: datetime = field(metadata={"deserialize": "pendulum"})
 
     should_be = DataClass(x=datetime(2008, 12, 29, 7, tzinfo=timezone.utc))
-    instance = DataClass.from_dict({"x": "2009-W01 0700"})
+    instance = DataClass.from_dict({"x": "2009-W01 07:00"})
     assert instance == should_be
 
 
+@pytest.mark.skipif(
+    PY_312_MIN, reason="https://github.com/sdispater/pendulum/issues/696"
+)
 def test_pendulum_date_parser():
     @dataclass
     class DataClass(DataClassDictMixin):
@@ -77,13 +84,16 @@ class DataClass(DataClassDictMixin):
     assert instance == should_be
 
 
+@pytest.mark.skipif(
+    PY_312_MIN, reason="https://github.com/sdispater/pendulum/issues/696"
+)
 def test_pendulum_time_parser():
     @dataclass
     class DataClass(DataClassDictMixin):
         x: time = field(metadata={"deserialize": "pendulum"})
 
     should_be = DataClass(x=time(3, 4, 5))
-    instance = DataClass.from_dict({"x": "2009-W01 030405"})
+    instance = DataClass.from_dict({"x": "2009-W01 03:04:05"})
     assert instance == should_be