diff --git a/airflow-ctl/README.md b/airflow-ctl/README.md index 8e543717d9bdc..28f1b47381224 100644 --- a/airflow-ctl/README.md +++ b/airflow-ctl/README.md @@ -31,7 +31,7 @@ A command-line tool for interacting with Apache Airflow instances through the Ai ## Requirements -- Python 3.9 or later (compatible with Python >= 3.9 and < 3.13) +- Python 3.10 or later (compatible with Python >= 3.10 and < 3.13) - Network access to an Apache Airflow instance with REST API enabled - Keyring backend installed in operating system for secure token storage diff --git a/airflow-ctl/docs/installation/installing-from-pypi.rst b/airflow-ctl/docs/installation/installing-from-pypi.rst index f498c163298a7..a02a6a8991733 100644 --- a/airflow-ctl/docs/installation/installing-from-pypi.rst +++ b/airflow-ctl/docs/installation/installing-from-pypi.rst @@ -97,7 +97,7 @@ You can create the URL to the file substituting the variables in the template be where: - ``AIRFLOW_CTL_VERSION`` - Airflow CTL version (e.g. :subst-code:`|version|`) or ``main``, ``2-0``, for latest development version -- ``PYTHON_VERSION`` Python version e.g. ``3.9``, ``3.10`` +- ``PYTHON_VERSION`` Python version e.g. ``3.10``, ``3.11`` Verifying installed dependencies diff --git a/airflow-ctl/pyproject.toml b/airflow-ctl/pyproject.toml index 6d2d96f0fa478..a8590364f6f40 100644 --- a/airflow-ctl/pyproject.toml +++ b/airflow-ctl/pyproject.toml @@ -20,7 +20,7 @@ name = "apache-airflow-ctl" dynamic = ["version"] description = "Apache Airflow command line tool for communicating with an Apache Airflow, using the API." readme = { file = "README.md", content-type = "text/markdown" } -requires-python = ">=3.9, <3.13" +requires-python = ">=3.10, <3.13" dependencies = [ # TODO there could be still missing deps such as airflow-core "argcomplete>=1.10", @@ -33,7 +33,6 @@ dependencies = [ "rich-argparse>=1.0.0", "structlog>=25.2.0", "uuid6>=2024.7.10", - "eval-type-backport>=0.2.0; python_version == '3.9'", ] classifiers = [ @@ -130,14 +129,14 @@ enum-field-as-literal='one' # When a single enum member, make it output a `Liter input-file-type='openapi' output-model-type='pydantic_v2.BaseModel' output-datetime-class='datetime' -target-python-version='3.9' +target-python-version='3.10' use-annotated=true use-default=true use-double-quotes=true use-schema-description=true # Desc becomes class doc comment use-standard-collections=true # list[] not List[] use-subclass-enum=true # enum, not union of Literals -use-union-operator=true # 3.9+annotations, not `Union[]` +use-union-operator=true # +annotations, not `Union[]` input = "../airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml" output = "src/airflowctl/api/datamodels/generated.py" diff --git a/airflow-ctl/src/airflowctl/api/client.py b/airflow-ctl/src/airflowctl/api/client.py index 162e21c9422dc..4f707b18c5f95 100644 --- a/airflow-ctl/src/airflowctl/api/client.py +++ b/airflow-ctl/src/airflowctl/api/client.py @@ -22,8 +22,9 @@ import json import os import sys +from collections.abc import Callable from functools import wraps -from typing import TYPE_CHECKING, Any, Callable, Literal, TypeVar, cast +from typing import TYPE_CHECKING, Any, Literal, ParamSpec, TypeVar, cast import httpx import keyring @@ -53,7 +54,6 @@ AirflowCtlException, AirflowCtlNotFoundException, ) -from airflowctl.typing_compat import ParamSpec if TYPE_CHECKING: # # methodtools doesn't have typestubs, so give a stub diff --git a/airflow-ctl/src/airflowctl/ctl/cli_config.py b/airflow-ctl/src/airflowctl/ctl/cli_config.py index 7da28d8b77481..71bff72125b6a 100644 --- a/airflow-ctl/src/airflowctl/ctl/cli_config.py +++ b/airflow-ctl/src/airflowctl/ctl/cli_config.py @@ -27,10 +27,10 @@ import os import textwrap from argparse import Namespace -from collections.abc import Iterable +from collections.abc import Callable, Iterable from functools import partial from pathlib import Path -from typing import Any, Callable, NamedTuple, Union +from typing import Any, NamedTuple import rich @@ -330,7 +330,7 @@ def from_group_command(cls, group_command: GroupCommand) -> GroupCommandParser: ) -CLICommand = Union[ActionCommand, GroupCommand, GroupCommandParser] +CLICommand = ActionCommand | GroupCommand | GroupCommandParser class CommandFactory: diff --git a/airflow-ctl/src/airflowctl/typing_compat.py b/airflow-ctl/src/airflowctl/typing_compat.py deleted file mode 100644 index 625e9e37ca667..0000000000000 --- a/airflow-ctl/src/airflowctl/typing_compat.py +++ /dev/null @@ -1,29 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -"""This module provides helper code to make type annotation within airflowctl codebase easier.""" - -from __future__ import annotations - -__all__ = ["ParamSpec"] - -import sys - -if sys.version_info >= (3, 10): - from typing import ParamSpec -else: - from typing_extensions import ParamSpec diff --git a/airflow-ctl/src/airflowctl/utils/helpers.py b/airflow-ctl/src/airflowctl/utils/helpers.py index 4d1c6a7d7a0f5..d73defb3c5f97 100644 --- a/airflow-ctl/src/airflowctl/utils/helpers.py +++ b/airflow-ctl/src/airflowctl/utils/helpers.py @@ -18,8 +18,8 @@ from __future__ import annotations import itertools -from collections.abc import Iterable -from typing import Callable, TypeVar +from collections.abc import Callable, Iterable +from typing import TypeVar T = TypeVar("T")