From 13a5e76075e51d4a9ac7ebfc6f592bb592b549ea Mon Sep 17 00:00:00 2001 From: Batkhuu Byambajav Date: Mon, 14 Sep 2026 20:39:39 +0900 Subject: [PATCH] feat: update Python version to 3.11 across workflows and configuration files --- .github/workflows/1.bump-version.yml | 2 +- .github/workflows/2.build-publish.yml | 2 +- .github/workflows/pre-commit.yml | 2 +- .github/workflows/publish-docs.yml | 2 +- .pre-commit-config.yaml | 2 +- .python-version | 2 +- pyproject.toml | 1 + src/beans_logging/filters.py | 20 ++++++++------------ src/beans_logging/formats.py | 6 ++---- src/beans_logging/rotators.py | 7 +++---- src/beans_logging/schemas.py | 16 +++++----------- src/beans_logging/sinks.py | 6 ++---- 12 files changed, 27 insertions(+), 41 deletions(-) diff --git a/.github/workflows/1.bump-version.yml b/.github/workflows/1.bump-version.yml index ebbd31a..02da425 100644 --- a/.github/workflows/1.bump-version.yml +++ b/.github/workflows/1.bump-version.yml @@ -21,7 +21,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v7 with: - python-version: "3.10" + python-version: "3.11" - name: Install dependencies run: | python -m pip install -U pip diff --git a/.github/workflows/2.build-publish.yml b/.github/workflows/2.build-publish.yml index 79c12c2..653629c 100644 --- a/.github/workflows/2.build-publish.yml +++ b/.github/workflows/2.build-publish.yml @@ -26,7 +26,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v7 with: - python-version: "3.10" + python-version: "3.11" - name: Install dependencies run: | python -m pip install -U pip diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index cfa38bc..8b3a4d3 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -23,7 +23,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v7 with: - python-version: "3.10" + python-version: "3.11" - name: Cache pip uses: actions/cache@v6 with: diff --git a/.github/workflows/publish-docs.yml b/.github/workflows/publish-docs.yml index d11be07..9ba7f43 100644 --- a/.github/workflows/publish-docs.yml +++ b/.github/workflows/publish-docs.yml @@ -23,7 +23,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v7 with: - python-version: "3.10" + python-version: "3.11" - name: Install dependencies run: | python -m pip install -U pip diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 38e9333..823d9e3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ fail_fast: true default_language_version: - python: python3.10 + python: python3.11 exclude: | (?x)^( \.git/.* diff --git a/.python-version b/.python-version index c8cfe39..2c07333 100644 --- a/.python-version +++ b/.python-version @@ -1 +1 @@ -3.10 +3.11 diff --git a/pyproject.toml b/pyproject.toml index 5f76614..cd25540 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,6 +28,7 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", ] dynamic = ["version", "dependencies", "optional-dependencies"] diff --git a/src/beans_logging/filters.py b/src/beans_logging/filters.py index f048990..55cce92 100644 --- a/src/beans_logging/filters.py +++ b/src/beans_logging/filters.py @@ -1,8 +1,4 @@ -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from loguru import Record - +from .typing import Record from .constants import ( DEFAULT_STD_HANDLER_NAME, DEFAULT_FILE_HANDLER_NAME, @@ -12,7 +8,7 @@ ) -def add_level_short(record: "Record") -> "Record": +def add_level_short(record: Record) -> Record: """Filter for adding short level name to log record. Args: @@ -37,7 +33,7 @@ def add_level_short(record: "Record") -> "Record": return record -def all_handlers_filter(record: "Record") -> bool: +def all_handlers_filter(record: Record) -> bool: """Filter message for all handlers that use this filter. Args: @@ -55,7 +51,7 @@ def all_handlers_filter(record: "Record") -> bool: return True -def std_filter(record: "Record") -> bool: +def std_filter(record: Record) -> bool: """Filter message for std handlers that use this filter. Args: @@ -74,7 +70,7 @@ def std_filter(record: "Record") -> bool: return True -def file_filter(record: "Record") -> bool: +def file_filter(record: Record) -> bool: """Filter message for file handlers that use this filter. Args: @@ -93,7 +89,7 @@ def file_filter(record: "Record") -> bool: return True -def err_file_filter(record: "Record") -> bool: +def err_file_filter(record: Record) -> bool: """Filter message for error file handlers that use this filter. Args: @@ -112,7 +108,7 @@ def err_file_filter(record: "Record") -> bool: return True -def json_filter(record: "Record") -> bool: +def json_filter(record: Record) -> bool: """Filter message for json file handlers that use this filter. Args: @@ -131,7 +127,7 @@ def json_filter(record: "Record") -> bool: return True -def err_json_filter(record: "Record") -> bool: +def err_json_filter(record: Record) -> bool: """Filter message for json error file handlers that use this filter. Args: diff --git a/src/beans_logging/formats.py b/src/beans_logging/formats.py index 76198a1..de033ac 100644 --- a/src/beans_logging/formats.py +++ b/src/beans_logging/formats.py @@ -1,12 +1,10 @@ import json import traceback -from typing import TYPE_CHECKING -if TYPE_CHECKING: - from loguru import Record +from .typing import Record -def json_format(record: "Record") -> str: +def json_format(record: Record) -> str: """Custom json formatter for loguru logger. Args: diff --git a/src/beans_logging/rotators.py b/src/beans_logging/rotators.py index ac9e6a9..e8caea8 100644 --- a/src/beans_logging/rotators.py +++ b/src/beans_logging/rotators.py @@ -1,8 +1,7 @@ import datetime -from typing import TextIO, TYPE_CHECKING +from typing import TextIO -if TYPE_CHECKING: - from loguru import Message +from .typing import Message class Rotator: @@ -38,7 +37,7 @@ def __init__(self, *, rotate_size: int, rotate_time: datetime.time): # Add one day to prevent an immediate rotation. self._dt_limit += datetime.timedelta(days=1) - def should_rotate(self, message: "Message", file: TextIO) -> bool: + def should_rotate(self, message: Message, file: TextIO) -> bool: """Check if the log file should rotate. Args: diff --git a/src/beans_logging/schemas.py b/src/beans_logging/schemas.py index fde4997..5a0ddf0 100644 --- a/src/beans_logging/schemas.py +++ b/src/beans_logging/schemas.py @@ -6,7 +6,7 @@ from logging import Handler from asyncio import AbstractEventLoop from multiprocessing.context import BaseContext -from typing import TYPE_CHECKING, Any, TextIO, Union, Protocol, runtime_checkable +from typing import Any, TextIO, Union, Protocol, runtime_checkable from collections.abc import Callable, Awaitable if sys.version_info >= (3, 11): @@ -14,13 +14,9 @@ else: from typing_extensions import Self -if TYPE_CHECKING: - from loguru import Record, Message -else: - from .typing import Record, Message - from pydantic import BaseModel, Field, ConfigDict, model_validator +from .typing import Record, Message from .constants import LogHandlerTypeEnum, LogLevelEnum @@ -52,12 +48,10 @@ def flush(self) -> Any: ... Handler, ] -FormatType = Union[ - str, Callable[["Record"], str], Callable[[dict[str, Any]], str], None -] +FormatType = Union[str, Callable[[Record], str], Callable[[dict[str, Any]], str], None] _FilterType = Union[ - Callable[["Record"], bool], + Callable[[Record], bool], Callable[[dict[str, Any]], bool], str, dict[str, Any], @@ -69,7 +63,7 @@ def flush(self) -> Any: ... int, datetime.time, datetime.timedelta, - Callable[["Message", TextIO], bool], + Callable[[Message, TextIO], bool], Callable[[str, TextIO], bool], Callable[[str, Any], bool], None, diff --git a/src/beans_logging/sinks.py b/src/beans_logging/sinks.py index 7d9711d..dea1bb9 100644 --- a/src/beans_logging/sinks.py +++ b/src/beans_logging/sinks.py @@ -1,11 +1,9 @@ import sys -from typing import TYPE_CHECKING -if TYPE_CHECKING: - from loguru import Message +from .typing import Message -def std_sink(message: "Message") -> None: +def std_sink(message: Message) -> None: """Print message based on log level to stdout or stderr. Args: