From 1ef8e9be2adbffe81f263c47e3f481bc1a44170d Mon Sep 17 00:00:00 2001 From: Fred <323546+fguillot@users.noreply.github.com> Date: Sun, 29 Nov 2026 16:06:39 -0800 Subject: [PATCH] chore: drop Python 3.9 support Python 3.9 is no longer available on GitHub Actions. Require Python >= 3.10, add 3.14 and 3.15 to the CI matrix, and enable ruff's pyupgrade rules to use 3.10+ type hint syntax. --- .github/workflows/ci.yml | 2 +- README.rst | 2 +- kanboard.py | 19 ++++++++++--------- pyproject.toml | 4 ++-- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2669960..36c3385 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: max-parallel: 4 matrix: os: [ubuntu-latest, windows-latest] - python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.15"] steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Set up Python ${{ matrix.python-version }} diff --git a/README.rst b/README.rst index dd65374..75f9e95 100644 --- a/README.rst +++ b/README.rst @@ -15,7 +15,7 @@ Installation python3 -m pip install kanboard -- This library is compatible with Python >= 3.9. +- This library is compatible with Python >= 3.10. On Fedora (36 and later), you can install the package using DNF: diff --git a/kanboard.py b/kanboard.py index 11fba93..2f3b83d 100644 --- a/kanboard.py +++ b/kanboard.py @@ -25,7 +25,8 @@ import functools import json import ssl -from typing import Any, Callable, Dict, Optional +from collections.abc import Callable +from typing import Any from urllib import request as http DEFAULT_AUTH_HEADER = "Authorization" @@ -59,12 +60,12 @@ def __init__( username: str, password: str, auth_header: str = DEFAULT_AUTH_HEADER, - cafile: Optional[str] = None, + cafile: str | None = None, insecure: bool = False, ignore_hostname_verification: bool = False, user_agent: str = "Kanboard Python API Client", - timeout: Optional[int] = 30, - loop: Optional[asyncio.AbstractEventLoop] = None, + timeout: int | None = 30, + loop: asyncio.AbstractEventLoop | None = None, ) -> None: """ Initialize a new Kanboard API client instance. @@ -75,15 +76,15 @@ def __init__( username (str): Kanboard API username or real username. password (str): Kanboard API token or user password. auth_header (str, optional): HTTP header for authentication. Defaults to 'Authorization'. - cafile (Optional[str], optional): Path to a custom CA certificate file. Defaults to None. + cafile (str | None, optional): Path to a custom CA certificate file. Defaults to None. insecure (bool, optional): If True, ignore SSL certificate errors and hostname mismatches. Defaults to False. ignore_hostname_verification (bool, optional): If True, skip SSL certificate hostname verification. Defaults to False. user_agent (str, optional): Custom User-Agent string for HTTP requests. Defaults to 'Kanboard Python API Client'. - timeout (Optional[int], optional): Request timeout in seconds. Defaults to 30. Set to None to disable. - loop (Optional[asyncio.AbstractEventLoop], optional): Asyncio event loop to use. If None, uses the + timeout (int | None, optional): Request timeout in seconds. Defaults to 30. Set to None to disable. + loop (asyncio.AbstractEventLoop | None, optional): Asyncio event loop to use. If None, uses the current event loop or creates a new one. """ self._url = url @@ -168,7 +169,7 @@ def _parse_response(response: bytes) -> Any: except ValueError as e: raise ClientError(f"Failed to parse JSON response: {e}") from e - def _do_request(self, headers: Dict[str, str], body: Dict[str, Any]) -> Any: + def _do_request(self, headers: dict[str, str], body: dict[str, Any]) -> Any: try: request = http.Request(self._url, headers=headers, data=json.dumps(body).encode()) @@ -201,7 +202,7 @@ def execute(self, method: str, **kwargs: Any) -> Any: """ payload = {"id": 1, "jsonrpc": "2.0", "method": method, "params": kwargs} - credentials = base64.b64encode("{}:{}".format(self._username, self._password).encode()) + credentials = base64.b64encode(f"{self._username}:{self._password}".encode()) auth_header_prefix = "Basic " if self._auth_header == DEFAULT_AUTH_HEADER else "" headers = { self._auth_header: auth_header_prefix + credentials.decode(), diff --git a/pyproject.toml b/pyproject.toml index 9322200..3e24a55 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ name = "kanboard" version = "1.1.8" description = "Python client library for Kanboard" readme = "README.rst" -requires-python = ">=3.9" +requires-python = ">=3.10" license = "MIT" license-files = ["LICENSE"] keywords = ["kanboard", "api", "client"] @@ -33,4 +33,4 @@ build-backend = "setuptools.build_meta" line-length = 120 [tool.ruff.lint] -select = ["E", "F", "W", "I"] \ No newline at end of file +select = ["E", "F", "W", "I", "UP"] \ No newline at end of file