From 9b109f2fe130050f16842b306d21267e73d625e7 Mon Sep 17 00:00:00 2001 From: Chadwick Boulay Date: Fri, 8 Aug 2025 17:50:35 -0400 Subject: [PATCH 1/3] Replaced stacked @classmethod @property decorator with custom @classproperty to fix compatibility with Python 3.13. --- src/pycbsdk/cbhw/packet/abstract.py | 9 +++++++++ src/pycbsdk/cbhw/packet/header/v311.py | 6 ++++-- src/pycbsdk/cbhw/packet/header/v40.py | 4 ++-- src/pycbsdk/cbhw/packet/header/v41.py | 4 ++-- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/pycbsdk/cbhw/packet/abstract.py b/src/pycbsdk/cbhw/packet/abstract.py index 0872b6d..3d2e068 100644 --- a/src/pycbsdk/cbhw/packet/abstract.py +++ b/src/pycbsdk/cbhw/packet/abstract.py @@ -2,6 +2,15 @@ from ctypes import * import struct import numpy as np + + +class classproperty(object): + def __init__(self, f): + self.f = f + + def __get__(self, obj, owner): + return self.f(owner) + import numpy.typing from .common import ( CBPacketType, diff --git a/src/pycbsdk/cbhw/packet/header/v311.py b/src/pycbsdk/cbhw/packet/header/v311.py index 8025b6f..80d6433 100644 --- a/src/pycbsdk/cbhw/packet/header/v311.py +++ b/src/pycbsdk/cbhw/packet/header/v311.py @@ -1,6 +1,9 @@ from ctypes import * +from ..abstract import classproperty + + class CBPacketHeader(Structure): _pack_ = 1 _fields_ = [ @@ -13,7 +16,6 @@ class CBPacketHeader(Structure): ), # Number of 32-bit elements in packet body. * 4 to get number of bytes. ] - @classmethod - @property + @classproperty def HEADER_FORMAT(cls): return " Date: Fri, 8 Aug 2025 17:57:11 -0400 Subject: [PATCH 2/3] Update python-tests.yml to add 3.13, drop 3.9 --- .github/workflows/python-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index cf4a132..1fc93f7 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -13,7 +13,7 @@ jobs: build: strategy: matrix: - python-version: [3.9, "3.10", "3.11", "3.12"] + python-version: ["3.10", "3.11", "3.12", "3.13"] os: - "ubuntu-latest" - "windows-latest" From 85f05682d119462b22ef1f789338038ccd5b6191 Mon Sep 17 00:00:00 2001 From: Chadwick Boulay Date: Fri, 8 Aug 2025 18:02:21 -0400 Subject: [PATCH 3/3] Drop Python 3.9 support from pyproject.toml -- not strictly needed yet but this will likely avoid future problems --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7afc4ba..1cd73a5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ authors = [ ] license = "MIT" readme = "README.md" -requires-python = ">=3.9" +requires-python = ">=3.10" dynamic = ["version"] dependencies = [ "numpy",