jagdish-kumawat opened a new issue, #77804:
URL: https://github.com/apache/airflow/issues/77804
### Under which category would you file this issue?
Airflow Core
### Apache Airflow version
3.4.0
### What happened and how to reproduce it?
On Python 3.14, every `airflow` CLI command, even `airflow version`, prints
two `PendingDeprecationWarning`s before its own output:
```
2026-11-30T18:20:58.731732Z [warning ] FileType is deprecated. Simply open
files after parsing arguments. [py.warnings] category=PendingDeprecationWarning
filename=.../site-packages/airflow/cli/cli_config.py lineno=662
2026-11-30T18:20:58.732116Z [warning ] FileType is deprecated. Simply open
files after parsing arguments. [py.warnings] category=PendingDeprecationWarning
filename=.../site-packages/airflow/cli/cli_config.py lineno=889
3.4.0
```
Python 3.14 deprecated `argparse.FileType` ("Deprecated since version 3.14"
in the [argparse
docs](https://docs.python.org/3.14/library/argparse.html#argparse.FileType)),
and `FileType.__init__` now calls `warnings.warn("FileType is deprecated.
Simply open files after parsing arguments.",
category=PendingDeprecationWarning, stacklevel=2)`.
`airflow/cli/cli_config.py` creates two `argparse.FileType("w",
encoding="UTF-8")` objects at import time: `ARG_VAR_EXPORT` (`airflow variables
export`) and `ARG_CONN_EXPORT` (`airflow connections export`). The module is
imported for every command, so the warning is raised every time. Because of
`stacklevel=2` the warning is attributed to `airflow.cli.cli_config`, and the
filter that `airflow/configuration.py` adds for `PendingDeprecationWarning` in
`airflow` modules makes it visible.
Both are still on `main`:
-
https://github.com/apache/airflow/blob/6196a32433a70e9d0da76644dfffdd47161a7420/airflow-core/src/airflow/cli/cli_config.py#L667
-
https://github.com/apache/airflow/blob/6196a32433a70e9d0da76644dfffdd47161a7420/airflow-core/src/airflow/cli/cli_config.py#L915
-
https://github.com/apache/airflow/blob/6196a32433a70e9d0da76644dfffdd47161a7420/airflow-core/src/airflow/configuration.py#L57
**Steps to reproduce** (the uv route from the Quick Start, Python 3.14.10,
uv 0.13.10):
```bash
uv venv --python 3.14
source .venv/bin/activate
uv pip install "apache-airflow==3.4.0" --constraint
"https://raw.githubusercontent.com/apache/airflow/constraints-3.4.0/constraints-3.14.txt"
airflow version
```
### What you think should happen instead?
No warning. A command that doesn't export anything shouldn't warn about file
arguments it never uses. On 3.14 the same two lines come before the output of
every command: `airflow config get-value api port`, for example, prints them
too.
Python's docs suggest waiting "until after the parser has run" and opening
the file with a `with` statement. The two arguments could take a path
(`type=str`), with `variables export` and `connections export` opening the file
themselves.
### Operating System
macOS 26.7.4 (arm64)
### Deployment
Virtualenv installation
### Apache Airflow Provider(s)
_No response_
### Versions of Apache Airflow Providers
Not relevant: the warning comes from airflow-core's CLI. The constraints
install above brings apache-airflow-providers-common-compat 1.23.0, common-io
1.11.0, common-sql 2.4.0, smtp 3.2.0 and standard 1.21.0.
### Official Helm Chart version
Not Applicable
### Kubernetes Version
Not Applicable
### Helm Chart configuration
Not Applicable
### Docker Image customizations
Not Applicable
### Anything else?
It happens every time on Python 3.14. The two lines above are the complete
output of `airflow version` apart from `3.4.0` itself.
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]