Skip to content

Commit

Permalink
Dropped support for EOL Python 3.8 (#247)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk authored Oct 19, 2024
1 parent 6427d37 commit d9cee77
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ these instructions.
If there are no entries after the last release, use `**UNRELEASED**` as the version.
If, say, your patch fixes issue #999, the entry should look like this:

`* Fix big bad boo-boo in the encoder (#999
`- Fixed big bad boo-boo in the encoder (#999
<https://github.com/agronholm/cbor2/issues/999>_; PR by @yourgithubaccount)`

If there's no issue linked, just link to your pull request instead by updating the
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: pypa/[email protected]
env:
CBOR2_BUILD_C_EXTENSION: "1"
CIBW_SKIP: pp* cp36* cp37*
CIBW_SKIP: pp*
CIBW_ARCHS: auto64
CIBW_ARCHS_MACOS: x86_64 arm64
CIBW_ARCHS_LINUX: x86_64 aarch64
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "pypy-3.10"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "pypy-3.10"]
include:
- os: macos-latest
python-version: "3.8"
python-version: "3.9"
- os: macos-latest
python-version: "3.12"
- os: windows-latest
python-version: "3.8"
python-version: "3.9"
- os: windows-latest
python-version: "3.12"
runs-on: ${{ matrix.os }}
Expand Down
4 changes: 2 additions & 2 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
version: 2

build:
os: ubuntu-22.04
os: ubuntu-24.04
tools:
python: "3.8"
python: "3.x"

sphinx:
configuration: docs/conf.py
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Installation
Requirements
------------

* Python >= 3.8 (or `PyPy3`_ 3.8+)
* Python >= 3.9 (or `PyPy3`_ 3.9+)
* C-extension: Any C compiler that can build Python extensions.
Any modern libc with the exception of Glibc<2.9

Expand Down
6 changes: 3 additions & 3 deletions cbor2/_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def canonical(self) -> bool:
return self._canonical

@contextmanager
def disable_value_sharing(self) -> Generator[None, None, None]:
def disable_value_sharing(self) -> Generator[None]:
"""
Disable value sharing in the encoder for the duration of the context
block.
Expand All @@ -268,7 +268,7 @@ def disable_value_sharing(self) -> Generator[None, None, None]:
self.value_sharing = old_value_sharing

@contextmanager
def disable_string_referencing(self) -> Generator[None, None, None]:
def disable_string_referencing(self) -> Generator[None]:
"""
Disable tracking of string references for the duration of the
context block.
Expand All @@ -279,7 +279,7 @@ def disable_string_referencing(self) -> Generator[None, None, None]:
self.string_referencing = old_string_referencing

@contextmanager
def disable_string_namespacing(self) -> Generator[None, None, None]:
def disable_string_namespacing(self) -> Generator[None]:
"""
Disable generation of new string namespaces for the duration of the
context block.
Expand Down
4 changes: 2 additions & 2 deletions cbor2/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import threading
from collections import namedtuple
from collections.abc import Iterable, Iterator
from collections.abc import Iterable, Iterator, Mapping
from functools import total_ordering
from reprlib import recursive_repr
from typing import Any, Mapping, TypeVar
from typing import Any, TypeVar

KT = TypeVar("KT")
VT_co = TypeVar("VT_co", covariant=True)
Expand Down
7 changes: 6 additions & 1 deletion docs/versionhistory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ Version history

.. currentmodule:: cbor2

This library adheres to `Semantic Versioning <http://semver.org/>`_.
This library adheres to `Semantic Versioning <https://semver.org/>`_.

**UNRELEASED**

- Dropped support for Python 3.8
(#247 <https://github.com/agronholm/cbor2/pull/247>_; PR by @hugovk)

**5.6.5** (2024-10-09)

Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@ classifiers = [
"Typing :: Typed",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"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 :: 3.13",
]
requires-python = ">= 3.8"
requires-python = ">= 3.9"
dynamic = ["version"]

[project.urls]
Expand Down Expand Up @@ -90,7 +89,7 @@ show_missing = true
[tool.tox]
legacy_tox_ini = """
[tox]
envlist = py38, py39, py310, py311, py312, py313, pypy3
envlist = py39, py310, py311, py312, py313, pypy3
skip_missing_interpreters = true
minversion = 4.0.0
Expand Down
5 changes: 0 additions & 5 deletions source/decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -1254,12 +1254,7 @@ parse_datetimestr(CBORDecoderObject *self, PyObject *str)
(offset_sign ? -1 : 1) *
(offset_H * 3600 + offset_M * 60), 0);
if (delta) {
#if PY_VERSION_HEX >= 0x03070000
tz = PyTimeZone_FromOffset(delta);
#else
tz = PyObject_CallFunctionObjArgs(
_CBOR2_timezone, delta, NULL);
#endif
Py_DECREF(delta);
}
} else
Expand Down
21 changes: 0 additions & 21 deletions source/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,31 +525,10 @@ _CBOR2_init_re_compile(void)
int
_CBOR2_init_timezone_utc(void)
{
#if PY_VERSION_HEX >= 0x03070000
Py_INCREF(PyDateTime_TimeZone_UTC);
_CBOR2_timezone_utc = PyDateTime_TimeZone_UTC;
_CBOR2_timezone = NULL;
return 0;
#else
PyObject* datetime;

// from datetime import timezone
// utc = timezone.utc
datetime = PyImport_ImportModule("datetime");
if (!datetime)
goto error;
_CBOR2_timezone = PyObject_GetAttr(datetime, _CBOR2_str_timezone);
Py_DECREF(datetime);
if (!_CBOR2_timezone)
goto error;
_CBOR2_timezone_utc = PyObject_GetAttr(_CBOR2_timezone, _CBOR2_str_utc);
if (!_CBOR2_timezone_utc)
goto error;
return 0;
error:
PyErr_SetString(PyExc_ImportError, "unable to import timezone from datetime");
return -1;
#endif
}


Expand Down
4 changes: 2 additions & 2 deletions tests/test_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from io import BytesIO
from ipaddress import ip_address, ip_network
from pathlib import Path
from typing import Type, cast
from typing import cast
from uuid import UUID

import pytest
Expand Down Expand Up @@ -955,7 +955,7 @@ def test_decimal_payload_unpacking(impl, data, expected):
],
)
def test_oversized_read(impl, payload: bytes, tmp_path: Path) -> None:
CBORDecodeEOF = cast(Type[Exception], getattr(impl, "CBORDecodeEOF"))
CBORDecodeEOF = cast(type[Exception], getattr(impl, "CBORDecodeEOF"))
with pytest.raises(CBORDecodeEOF, match="premature end of stream"):
dummy_path = tmp_path / "testdata"
dummy_path.write_bytes(payload)
Expand Down

0 comments on commit d9cee77

Please sign in to comment.