Skip to content

Commit

Permalink
Add compat for PY 3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
rnag committed Nov 5, 2024
1 parent e5f37cb commit 900c4d9
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
# The type of runner that the job will run on
strategy:
matrix:
python-versions: [3.6, 3.7, 3.8, 3.9, '3.10', '3.11', '3.12']
python-versions: [3.6, 3.7, 3.8, 3.9, '3.10', '3.11', '3.12', '3.13']
os: [ubuntu-20.04]
# Uncomment if I need to run it on other environments too (currently
# there's not a huge need)
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Before you submit a pull request, check that it meets these guidelines:
2. If the pull request adds functionality, the docs should be updated. Put
your new functionality into a function with a docstring, and add the
feature to the list in README.rst.
3. The pull request should work for Python 3.6, 3.7, 3.8, 3.9, 3.10, 3.11 and 3.12, and for PyPy. Check
3. The pull request should work for Python 3.6, 3.7, 3.8, 3.9, 3.10, 3.11, 3.12 and 3.13, and for PyPy. Check
https://github.com/rnag/dataclass-wizard/actions/workflows/dev.yml
and make sure that the tests pass for all supported Python versions.

Expand Down
17 changes: 17 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@
History
=======

0.26.0 (2024-11-05)
-------------------

* This will be the latest (minor) release with support for Python 3.6, 3.7, and 3.8 --
all of which have reached *end-of-life*!

**Features and Improvements**

* Add compatability and support for **Python 3.13**. Thanks to :user:`benjjs` in :pr:`129`!

**Bugfixes**

* Fix: :meth:`LiteralParser.__contains__` method compares value of item with `Literal`_ arguments.
Contributed by :user:`mikeweltevrede` in :pr:`111`.

.. _Literal: https://docs.python.org/3/library/typing.html#typing.Literal

0.25.0 (2024-11-03)
-------------------

Expand Down
16 changes: 10 additions & 6 deletions dataclass_wizard/utils/typing_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
'eval_forward_ref_if_needed'
]

import functools
import sys
import types
import typing
Expand Down Expand Up @@ -351,6 +352,14 @@ def is_annotated(cls):
return _is_annotated(cls)


if PY313_OR_ABOVE:
# noinspection PyProtectedMember,PyUnresolvedReferences
_eval_type = functools.partial(typing._eval_type, type_params=())
else:
# noinspection PyProtectedMember,PyUnresolvedReferences
_eval_type = typing._eval_type


def eval_forward_ref(base_type: FREF,
cls: typing.Type):
"""
Expand All @@ -364,12 +373,7 @@ def eval_forward_ref(base_type: FREF,
# Evaluate the ForwardRef here
base_globals = sys.modules[cls.__module__].__dict__

if PY313_OR_ABOVE:
# noinspection PyProtectedMember
return typing._eval_type(base_type, base_globals, _TYPING_LOCALS, type_params=())
else:
# noinspection PyProtectedMember
return typing._eval_type(base_type, base_globals, _TYPING_LOCALS)
return _eval_type(base_type, base_globals, _TYPING_LOCALS)


def eval_forward_ref_if_needed(base_type: typing.Union[typing.Type, FREF],
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: Python'
],
test_suite='tests',
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[tox]
envlist = py36, py37, py38, py39, py310, py311, py312, flake8
envlist = py36, py37, py38, py39, py310, py311, py312, py313, flake8

[gh-actions]
python =
3.13: py313
3.12: py312
3.11: py311
3.10: py310
Expand Down

0 comments on commit 900c4d9

Please sign in to comment.