Skip to content

Commit

Permalink
Add support back for Python3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
mvanderlee committed Mar 10, 2024
1 parent ff35c2c commit de4ec94
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
fail-fast: false
matrix:
os: ["ubuntu-latest"]
python_version: ["3.9", "3.10", "3.11", "3.12", "pypy3.10"]
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.10"]
include:
- os: "ubuntu-20.04"
python_version: "3.9"
python_version: "3.8"

runs-on: ${{ matrix.os }}
steps:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ venv.bak/
# Rope project settings
.ropeproject

# VSCode project settings
.vscode

# mkdocs documentation
/site

Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ repos:
rev: v3.3.1
hooks:
- id: pyupgrade
# I've kept it on py3.7 so that it doesn't replace `Dict` with `dict`
args: ["--py37-plus"]
- repo: https://github.com/python/black
rev: 23.1.0
Expand Down
7 changes: 6 additions & 1 deletion marshmallow_dataclass/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class User:
import warnings
from enum import Enum
from functools import lru_cache, partial
from typing import Annotated, Any, Callable, Dict, FrozenSet, List, Mapping
from typing import Any, Callable, Dict, FrozenSet, List, Mapping
from typing import NewType as typing_NewType
from typing import (
Optional,
Expand All @@ -65,6 +65,11 @@ class User:

from marshmallow_dataclass.lazy_class_attribute import lazy_class_attribute

if sys.version_info >= (3, 9):
from typing import Annotated
else:
from typing_extensions import Annotated

if sys.version_info >= (3, 11):
from typing import dataclass_transform
else:
Expand Down
7 changes: 6 additions & 1 deletion marshmallow_dataclass/typing.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
from typing import Annotated
import sys

import marshmallow.fields

if sys.version_info >= (3, 9):
from typing import Annotated
else:
from typing_extensions import Annotated

Url = Annotated[str, marshmallow.fields.Url]
Email = Annotated[str, marshmallow.fields.Email]

Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from setuptools import setup, find_packages
from setuptools import find_packages, setup

VERSION = "8.6.0"

Expand All @@ -8,6 +8,7 @@
"Operating System :: OS Independent",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down Expand Up @@ -47,7 +48,7 @@
keywords=["marshmallow", "dataclass", "serialization"],
classifiers=CLASSIFIERS,
license="MIT",
python_requires=">=3.9",
python_requires=">=3.8",
install_requires=[
"marshmallow>=3.18.0,<4.0",
"typing-inspect>=0.8.0,<1.0",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
follow_imports = silent
plugins = marshmallow_dataclass.mypy
show_error_codes = true
python_version = 3.9
python_version = 3.8
env:
- PYTHONPATH=.
main: |
Expand Down

0 comments on commit de4ec94

Please sign in to comment.