Skip to content

Commit

Permalink
feat: python3.13 support
Browse files Browse the repository at this point in the history
  • Loading branch information
devmaxde committed Dec 11, 2024
1 parent 3096f73 commit 26c8182
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ dev =
%(cli)s
tox
pandas =
pandas ~= 2.0.1
pandas ~= 2.2.0
cli =
click
click-log
Expand Down
14 changes: 6 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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]:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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]:
Expand All @@ -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}")

Expand Down

0 comments on commit 26c8182

Please sign in to comment.