Skip to content

Commit

Permalink
v0.22.3: Support Python 3.11 and 3.12 (#107)
Browse files Browse the repository at this point in the history
* * Add support for Python versions 3.11 and 3.12
* Update `wheel` version
* Update CI to run tests on PY 3.11 and 3.12
* Update `setup.py` to add a `dev` extra which installs dev-related dependencies
* Move test dependencies into `requirements-test.txt`
* Fix for unit tests in Python 3.8
* update HISTORY.rst
* update .editorconfig
  • Loading branch information
rnag authored Jan 29, 2024
1 parent b344431 commit a8eb40a
Show file tree
Hide file tree
Showing 12 changed files with 102 additions and 35 deletions.
12 changes: 9 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# http://editorconfig.org

# top-most EditorConfig file
root = true

[*]

indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true

# Unix-style newlines with a newline ending every file
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.bat]
indent_style = tab
end_of_line = crlf

[{*.yml, *.yaml}]
[{*.yml,*.yaml}]
indent_size = 2

[LICENSE]
Expand Down
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']
python-versions: [3.6, 3.7, 3.8, 3.9, '3.10', '3.11', '3.12']
os: [ubuntu-20.04]
# Uncomment if I need to run it on other environments too (currently
# there's not a huge need)
Expand Down
1 change: 1 addition & 0 deletions .pyup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ requirements:
- requirements.txt:
pin: False
- requirements-dev.txt
- requirements-test.txt
# add a label to pull requests, default is not set
label_prs: update
# assign users to pull requests, default is not set
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 and 3.10, and for PyPy. Check
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
https://github.com/rnag/dataclass-wizard/actions/workflows/dev.yml
and make sure that the tests pass for all supported Python versions.

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

0.22.3 (2024-01-29)
-------------------

**Features and Improvements**

* Add full support for Python 3.11 and 3.12 (Credits to :user:`alexanderilyin` on :pr:`101`)
* Project-specific development changes
* Update CI to run tests on PY 3.11 and 3.12
* Update ``wheel`` version
* Update ``setup.py`` to add a ``dev`` extra which installs dev-related dependencies
* Move test dependencies into ``requirements-test.txt``
* Add ``sphinx_issues`` dependency to easily add link in docs to an user/issue/PR on GitHub
* Update ``project_urls`` on PyPI to add extra links, such as "Changelog" and "Issue Tracker"


**Bugfixes**

* Fix: Loading a Variadic Tuple fails for length 0 (Credits to :user:`intentionally-left-nil` on :pr:`105`)
* Stop-gap fix for time-string patterns that contain ``-`` or ``+``,
as Python 3.11+ can interpret this as timezone data.

0.22.2 (2022-10-11)
-------------------

Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)

init: ## install all dev dependencies for this project
pip install -e .
pip install -r requirements-dev.txt
pip install -e .[dev]

clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts

Expand Down
17 changes: 12 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,15 @@
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'sphinx_issues',
]

github_user = 'rnag'
github_repo = 'dataclass-wizard'

# Path to GitHub repo {user}/{project}
issues_github_path = f'{github_user}/{github_repo}'

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

Expand All @@ -52,8 +59,8 @@

# General information about the project.
project = 'Dataclass Wizard'
copyright = '2021, <a href="https://github.com/rnag">Ritvik Nag</a>'
author = "Ritvik Nag"
copyright = f'2021, <a href="https://github.com/{github_user}">{author}</a>'

# The version info for the project you're documenting, acts as replacement
# for |version| and |release|, also used in various other places throughout
Expand All @@ -69,7 +76,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = 'en'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand All @@ -95,8 +102,8 @@
# documentation.
#
html_theme_options = {
"github_user": "rnag",
"github_repo": "dataclass-wizard",
"github_user": github_user,
"github_repo": github_repo,
"description": 'A set of simple, yet elegant <i>wizarding</i> tools for '
'interacting with the Python <code>dataclasses</code> module.',
"show_powered_by": False,
Expand Down Expand Up @@ -159,7 +166,7 @@
latex_documents = [
(master_doc, 'dataclass_wizard.tex',
'Dataclass Wizard Documentation',
'Ritvik Nag', 'manual'),
author, 'manual'),
]


Expand Down
16 changes: 5 additions & 11 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
pip>=21.3.1
bump2version==1.0.1
wheel==0.37.1
wheel==0.37.1; python_version == "3.6"
wheel==0.42.0; python_version > "3.6"
watchdog[watchmedo]==2.1.6
flake8>=3 # pyup: ignore
tox==3.24.5
coverage>=6.2
Sphinx==4.4.0
Sphinx==5.3.0
sphinx-issues==3.0.1; python_version < "3.8"
sphinx-issues==4.0.0; python_version >= "3.8"
twine==3.8.0
# Extras
pytimeparse==1.1.8
# Test requirements
pytest==7.0.1
pytest-mock>=3.6.1
pytest-cov==3.0.0
# pytest-runner==5.3.1
# Benchmark tests
dataclasses-json==0.5.6
jsons==1.6.1
dataclass-factory==2.12 # pyup: ignore
8 changes: 8 additions & 0 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pytest==7.0.1
pytest-mock>=3.6.1
pytest-cov==3.0.0
# pytest-runner==5.3.1
# Benchmark tests
dataclasses-json==0.5.6
jsons==1.6.1
dataclass-factory==2.12 # pyup: ignore
34 changes: 26 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""The setup script."""
import pathlib

from pkg_resources import parse_requirements
from setuptools import setup, find_packages


Expand All @@ -16,12 +17,23 @@
'backports-datetime-fromisoformat==1.0.0; python_version == "3.6"'
]

test_requirements = [
'pytest~=6.2.4',
'pytest-mock~=3.6.1',
'pytest-cov~=2.12.1',
'pytest-runner~=5.3.1'
]
# TODO update once we drop support for Python 3.6 & 3.7
# if (requires_dev_file := here / 'requirements-dev.txt').exists():
requires_dev_file = here / 'requirements-dev.txt'
if requires_dev_file.exists():
with requires_dev_file.open() as requires_dev_txt:
dev_requires = [str(req) for req in parse_requirements(requires_dev_txt)]
else: # Running on CI
dev_requires = []

# TODO update once we drop support for Python 3.6 & 3.7
# if (requires_test_file := here / 'requirements-dev.txt').exists():
requires_test_file = here / 'requirements-test.txt'
if requires_test_file.exists():
with requires_test_file.open() as requires_test_txt:
test_requirements = [str(req) for req in parse_requirements(requires_test_txt)]
else: # Running on CI
test_requirements = []

about = {}
exec((here / package_name / '__version__.py').read_text(), about)
Expand All @@ -47,8 +59,11 @@
include_package_data=True,
install_requires=requires,
project_urls={
'Documentation': 'https://dataclass-wizard.readthedocs.io',
'Changelog': 'https://dataclass-wizard.readthedocs.io/en/latest/history.html',
'Source': 'https://github.com/rnag/dataclass-wizard',
'Download': 'https://pypi.org/project/dataclass-wizard',
'Documentation': 'https://dataclass-wizard.readthedocs.io',
'Bug Tracker': 'https://github.com/rnag/dataclass-wizard/issues',
},
license=about['__license__'],
keywords=['dataclasses', 'dataclass', 'wizard', 'json', 'marshal',
Expand All @@ -68,13 +83,16 @@
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python'
],
test_suite='tests',
tests_require=test_requirements,
extras_require={
'timedelta': ['pytimeparse>=1.1.7'],
'yaml': ['PyYAML>=5.3']
'yaml': ['PyYAML>=5.3'],
'dev': dev_requires + test_requirements,
},
zip_safe=False
)
16 changes: 13 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,26 @@
else:
from contextlib import ExitStack as does_not_raise

# TODO typing.Deque is deprecated since PY 3.9
# https://docs.python.org/3/library/typing.html#typing.Deque
try:
# Introduced in Python 3.6
from typing import Deque
# Introduced in Python 3.8
from typing import Literal
from typing import TypedDict
from typing import Annotated
from typing import Deque
except ImportError:
# Introduced in Python 3.6
from typing_extensions import Deque
# Introduced in Python 3.8
from typing_extensions import Literal
from typing_extensions import TypedDict

# typing.Annotated: Introduced in Python 3.9
if PY39_OR_ABOVE:
from typing import Annotated
else:
from typing_extensions import Annotated
from typing_extensions import Deque


def data_file_path(name: str) -> str:
Expand Down
5 changes: 4 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[tox]
envlist = py36, py37, py38, py39, py310, flake8
envlist = py36, py37, py38, py39, py310, py311, py312, flake8

[gh-actions]
python =
3.12: py312
3.11: py311
3.10: py310
3.9: py39
3.8: py38
Expand All @@ -20,6 +22,7 @@ setenv =
PYTEST_ADDOPTS = --ignore-glob=*integration*
deps =
-r{toxinidir}/requirements-dev.txt
-r{toxinidir}/requirements-test.txt
; If you want to make tox run the tests with the same versions, create a
; requirements.txt with the pinned versions and uncomment the following line:
; -r{toxinidir}/requirements.txt
Expand Down

0 comments on commit a8eb40a

Please sign in to comment.