From 26c8182907fd5b4970bb87cd0021ea2bb716e826 Mon Sep 17 00:00:00 2001 From: Max Kutschka <2004maximilian@web.de> Date: Wed, 11 Dec 2024 17:16:24 +0100 Subject: [PATCH] feat: python3.13 support --- .github/workflows/pythonpackage.yml | 2 +- pyproject.toml | 2 +- setup.cfg | 2 +- setup.py | 14 ++++++-------- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index a851a3df..c6a60c0d 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.10", "3.11"] + python-version: ["3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 diff --git a/pyproject.toml b/pyproject.toml index 7ab43888..cb1970b1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ # We need mypy-protobuf during build - it is a plugin to protoc. # The version requirement is iffy, there is no way to know whether # this is going to be compatible to the installed protoc or not. -requires = ["setuptools>=55.0.0", "wheel", "mypy-protobuf~=3.4.0"] +requires = ["setuptools>=75.6.0", "wheel", "mypy-protobuf~=3.4.0"] build-backend = 'setuptools.build_meta' [tool.black] diff --git a/setup.cfg b/setup.cfg index 9fcbdb27..d3a24a7c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -67,7 +67,7 @@ dev = %(cli)s tox pandas = - pandas ~= 2.0.1 + pandas ~= 2.2.0 cli = click click-log diff --git a/setup.py b/setup.py index 5e61d0d0..017dc39a 100755 --- a/setup.py +++ b/setup.py @@ -13,13 +13,11 @@ import logging import os import re +import shutil import subprocess import sys from bisect import bisect_right from datetime import datetime -from distutils.errors import DistutilsFileError -from distutils.log import ERROR, INFO -from distutils.spawn import find_executable from operator import itemgetter from typing import Any, Iterable, Optional @@ -36,7 +34,7 @@ def _find_protoc() -> str | None: if "PROTOC" in os.environ and os.path.exists(os.environ["PROTOC"]): return os.environ["PROTOC"] - return find_executable("protoc") + return shutil.which("protoc") @staticmethod def _get_protoc_version(protoc: str) -> tuple[int, int, int]: @@ -78,7 +76,7 @@ def _assert_has_executable(self) -> None: os.environ.get("PROTOC", "Not set") ) ) - raise DistutilsFileError("protoc not found") + raise ValueError("protoc not found") @property def executable(self) -> str: @@ -226,10 +224,10 @@ def finalize_options(self) -> None: self.proto_dir = "lib/metricq-protobuf/" def info(self, msg: str) -> None: - self.announce(f"info: {type(self).__name__}: {msg}", level=INFO) + self.announce(f"info: {type(self).__name__}: {msg}", level=logging.INFO) def error(self, msg: str) -> None: - self.announce(f"error: {type(self).__name__}: {msg}", level=ERROR) + self.announce(f"error: {type(self).__name__}: {msg}", level=logging.ERROR) @property def _protobuf_filenames(self) -> Iterable[str]: @@ -242,7 +240,7 @@ def _protobuf_filenames(self) -> Iterable[str]: if not filenames: self.error(f"no protobuf files found in {self.proto_dir}") - raise DistutilsFileError(f"No protobuf files found in {self.proto_dir}") + raise ValueError(f"No protobuf files found in {self.proto_dir}") self.info(f"found protobuf files: {filenames}")