Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for python 3.8 #309

Merged
merged 2 commits into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
env:
CC: "gcc"
CFLAGS: "-O2 -fno-plt"
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
target: [
{
platform: 'linux/arm64',
Expand Down Expand Up @@ -110,7 +110,7 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
- run: rustup install --profile minimal ${{ env.RUST_TOOLCHAIN }}
Expand All @@ -134,7 +134,7 @@ jobs:
name: Build macOS universal wheel
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -172,7 +172,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.11
- run: python -m pip install -U pip wheel maturin
- run: pip install -r requirements.txt
- run: maturin sdist
Expand Down
3 changes: 1 addition & 2 deletions benchmarks/bench_dataclass.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import dataclasses
from typing import List

import msgpack

Expand All @@ -16,7 +15,7 @@ class Member:
class Object:
id: int
name: str
members: List[Member]
members: list[Member]


objects_as_dataclass = [
Expand Down
4 changes: 1 addition & 3 deletions benchmarks/bench_pydantic.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import List

import msgpack
from pydantic import BaseModel

Expand All @@ -14,7 +12,7 @@ class Member(BaseModel):
class Object(BaseModel):
id: int
name: str
members: List[Member]
members: list[Member]


objects_as_pydantic = [
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "ormsgpack"
repository = "https://github.com/aviramha/ormsgpack"
requires-python = ">=3.8"
requires-python = ">=3.9"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
Expand All @@ -11,7 +11,6 @@ classifiers = [
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down Expand Up @@ -41,7 +40,7 @@ ignore_missing_imports = true

[tool.ruff]
line-length = 88
target-version = "py38"
target-version = "py39"

[tool.ruff.lint]
select = [
Expand Down
1 change: 0 additions & 1 deletion tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ numpy;platform_machine!="armv7l"
pendulum;platform_machine!="armv7l" and python_version<"3.13"
pytest
pytz
xxhash==1.4.3;sys_platform!="windows" and python_version<"3.9" # creates non-compact ASCII for test_str_ascii
msgpack
pydantic
tzdata
Expand Down
8 changes: 3 additions & 5 deletions tests/test_circular.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from typing import Dict, List

import pytest

import ormsgpack
Expand All @@ -11,7 +9,7 @@ def test_circular_dict() -> None:
"""
packb() circular reference dict
"""
obj: Dict[str, object] = {}
obj: dict[str, object] = {}
obj["obj"] = obj
with pytest.raises(ormsgpack.MsgpackEncodeError):
ormsgpack.packb(obj)
Expand All @@ -21,7 +19,7 @@ def test_circular_list() -> None:
"""
packb() circular reference list
"""
obj: List[object] = []
obj: list[object] = []
obj.append(obj)
with pytest.raises(ormsgpack.MsgpackEncodeError):
ormsgpack.packb(obj)
Expand All @@ -31,7 +29,7 @@ def test_circular_nested() -> None:
"""
packb() circular reference nested dict, list
"""
obj: Dict[str, object] = {}
obj: dict[str, object] = {}
obj["list"] = [{"obj": obj}]
with pytest.raises(ormsgpack.MsgpackEncodeError):
ormsgpack.packb(obj)
23 changes: 3 additions & 20 deletions tests/test_datetime.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

import datetime
import sys
import zoneinfo
from typing import Callable

import msgpack
Expand All @@ -21,15 +21,6 @@
pendulum_timezone = pendulum.timezone
pendulum_UTC = pendulum.UTC

if sys.version_info >= (3, 9):
import zoneinfo

ZoneInfo = zoneinfo.ZoneInfo
ZoneInfoUTC = zoneinfo.ZoneInfo("UTC")
else:
ZoneInfo = None
ZoneInfoUTC = None


TIMEZONE_PARAMS = (
pytest.param(
Expand All @@ -42,11 +33,7 @@
),
pytest.param(pytz.timezone, id="pytz"),
pytest.param(get_zonefile_instance().get, id="dateutil"),
pytest.param(
ZoneInfo,
id="zoneinfo",
marks=pytest.mark.skipif(ZoneInfo is None, reason="zoneinfo not available"),
),
pytest.param(zoneinfo.ZoneInfo, id="zoneinfo"),
)


Expand Down Expand Up @@ -133,11 +120,7 @@ def test_datetime_tz_assume() -> None:
),
pytest.param(pytz.UTC, id="pytz"),
pytest.param(tz.UTC, id="dateutil"),
pytest.param(
ZoneInfoUTC,
id="zoneinfo",
marks=pytest.mark.skipif(ZoneInfo is None, reason="zoneinfo not available"),
),
pytest.param(zoneinfo.ZoneInfo("UTC"), id="zoneinfo"),
),
)
def test_datetime_utc(timezone: datetime.tzinfo) -> None:
Expand Down
4 changes: 1 addition & 3 deletions tests/test_dict.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from typing import Dict

import msgpack
import pytest

Expand All @@ -16,7 +14,7 @@
pytest.param({str(i): i for i in range(65536)}, id="map 32"),
),
)
def test_dict(value: Dict[str, int]) -> None:
def test_dict(value: dict[str, int]) -> None:
packed = ormsgpack.packb(value)
assert packed == msgpack.packb(value)
assert ormsgpack.unpackb(packed) == value
Expand Down
4 changes: 1 addition & 3 deletions tests/test_list.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from typing import List

import msgpack
import pytest

Expand All @@ -16,7 +14,7 @@
pytest.param([i for i in range(65536)], id="array 32"),
),
)
def test_list(value: List[int]) -> None:
def test_list(value: list[int]) -> None:
packed = ormsgpack.packb(value)
assert packed == msgpack.packb(value)
assert ormsgpack.unpackb(packed) == value
10 changes: 0 additions & 10 deletions tests/test_str.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,3 @@ def test_str_surrogates() -> None:
ormsgpack.packb("\udc00")
with pytest.raises(ormsgpack.MsgpackEncodeError):
ormsgpack.packb("\ud83d\ude80")


def test_str_ascii() -> None:
"""
str is ASCII but not compact
"""
xxhash = pytest.importorskip("xxhash")
digest = xxhash.xxh32_hexdigest("12345")
for _ in range(2):
assert ormsgpack.unpackb(ormsgpack.packb(digest)) == "b30d56b4"
7 changes: 3 additions & 4 deletions tests/test_subclass.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

import collections
from typing import Dict, List, Tuple

import msgpack
import pytest
Expand All @@ -17,19 +16,19 @@ class SubInt(int):
pass


class SubDict(Dict[str, object]):
class SubDict(dict[str, object]):
pass


class SubList(List[object]):
class SubList(list[object]):
pass


class SubFloat(float):
pass


class SubTuple(Tuple[object, object]):
class SubTuple(tuple[object, object]):
pass


Expand Down