Skip to content

Commit

Permalink
Merge pull request #202 from metricq/upgrade_setuptools
Browse files Browse the repository at this point in the history
feat: python3.13 support
  • Loading branch information
bmario authored Dec 19, 2024
2 parents ff82552 + a9abb69 commit 0d8992f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 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
13 changes: 7 additions & 6 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 @@ -29,14 +27,17 @@
metricq_package_dir = "metricq"
protobuf_version_module_file = "_protobuf_version.py"

INFO = 2
ERROR = 4


class ProtocWrapper:
@staticmethod
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 +79,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 @@ -242,7 +243,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 0d8992f

Please sign in to comment.