Repository navigation
Stop CLI printing argparse.FileType deprecation warnings on Python 3.14 - #77853
Open
atishay-kasliwal wants to merge 1 commit into
Open
atishay-kasliwal wants to merge 1 commit into
atishay-kasliwal wants to merge 1 commit into
Conversation
Python 3.14 deprecates argparse.FileType and warns when one is created. The variables and connections export arguments created two at import time, so every airflow command printed the warning twice. Replace them with a small type function that keeps the same behaviour: "-" is stdout, other paths open as UTF-8 for writing, and unopenable paths give the same "can't open" argument error. closes: apache#77804
atishay-kasliwal
requested review from
bugraoz93,
dheerajturaga,
henry3260 and
potiuk
as code owners
December 1, 2026 05:54
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Python 3.14 deprecates
argparse.FileTypeand warns when one is created.ARG_VAR_EXPORTandARG_CONN_EXPORTcreated two of them whencli_configwas imported, so everyairflowcommand printed the warning twice.This replaces them with a small
writable_text_filetype that behaves the same way:-is stdout, any other path is opened as UTF-8 for writing, and a path that can't be opened gives the samecan't open '...'argument error.Checked on Python 3.14:
airflow versionprints no warnings (main prints two).variables export -/<file>,connections export -/.yaml/.txt, a missing parent directory, and a directory path.test_cli_parser.pyfail on main and pass here.There is another open PR for this issue, #77841. It changes the argument to
type=str, which makesvariables export -write to a file named-instead of stdout, and a missing directory ends in aFileNotFoundErrortraceback instead of the argument error. This PR keeps the current behaviour.closes: #77804
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Claude Opus 5.5) following the guidelines