Skip to content

Commit

Permalink
add python 3.13 support
Browse files Browse the repository at this point in the history
the logging.Handler class changed in 3.13 and will now always
try to acquire the lock in its `handle` method.

Removed the optimization that created the handler without a lock.

Also configure the CI to run on Python 3.13.
  • Loading branch information
Meallia committed Oct 30, 2024
1 parent c9d2cad commit 4876b80
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.12"
python-version: "3.13"
- run: pip install -r requirements.txt
- run: pre-commit run --all-files
- run: mypy kopf --strict
Expand All @@ -38,10 +38,10 @@ jobs:
fail-fast: false
matrix:
install-extras: [ "", "full-auth" ]
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13" ]
include:
- install-extras: "uvloop"
python-version: "3.12"
python-version: "3.13"
name: Python ${{ matrix.python-version }} ${{ matrix.install-extras }}
runs-on: ubuntu-22.04
timeout-minutes: 5 # usually 2-3 mins
Expand Down
5 changes: 0 additions & 5 deletions kopf/_core/engines/posting.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,6 @@ class K8sPoster(logging.Handler):
A handler to post all log messages as K8s events.
"""

def createLock(self) -> None:
# Save some time on unneeded locks. Events are posted in the background.
# We only put events to the queue, which is already lock-protected.
self.lock = None

def filter(self, record: logging.LogRecord) -> bool:
# Only those which have a k8s object referred (see: `ObjectLogger`).
# Otherwise, we have nothing to post, and nothing to do.
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ pytest-asyncio
pytest-cov
pytest-mock
pytest-timeout
types-setuptools
types-PyYAML
types-setuptools
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
Expand Down
5 changes: 3 additions & 2 deletions tests/peering/test_keepalive.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from itertools import chain, repeat
from unittest import mock

import pytest

from kopf._core.engines.peering import keepalive
from itertools import chain, repeat
from unittest import mock


class StopInfiniteCycleException(Exception):
Expand Down

0 comments on commit 4876b80

Please sign in to comment.