Fixed: "FileType is deprecated. Simply open files after parsing arguments." in Apache Airflow®
On Python 3.14, every Apache Airflow® 3.4.0 command I ran started with the same two warnings: FileType is deprecated. Simply open files after parsing arguments. Even airflow version printed them before the version number. They come from Airflow's own command-line code, not from your Dags. Here's how I traced them, what I reported upstream, and how to hide exactly this message until the fixed release is out.
What I Was Doing
I had installed Airflow 3.4.0 with uv on Python 3.14, and I was working in a terminal with the project's virtual environment active and AIRFLOW_HOME set. I ran Airflow's command line, starting with the simplest command there is:
airflow version
What I Expected
One line: the version number.
What I Got
Two warnings first, then the version:
2026-12-04T12:28:18.504754Z [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-12-04T12:28:18.505407Z [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

The command worked: 3.4.0 is the right answer. Every other airflow command I ran, such as airflow dags list-import-errors, printed the same two lines first.
What I Checked
Where they come from. Both lines name airflow/cli/cli_config.py, the file that defines the arguments of every airflow command. Line 662 is the file argument of airflow variables export, and line 889 the file argument of airflow connections export. Both are declared with type=argparse.FileType("w", encoding="UTF-8").
What Python says about FileType. argparse is Python's module for reading command-line arguments, and FileType makes it open a file named on the command line. The argparse documentation marks it "Deprecated since version 3.14." Its note explains the warning's advice: when a later argument fails, a file that FileType opened isn't closed, so "it would be better to wait until after the parser has run and then use the with-statement to manage the files."
Why every command prints them. Airflow builds the definitions of all its commands when it starts, so the two FileType arguments are created whatever command you run, and each creation raises the warning once.
Why you see them at all. Python's warnings documentation describes PendingDeprecationWarning as "ignored by default". Airflow turns its own deprecation warnings back on, in airflow/configuration.py:
# show Airflow's deprecation warnings
if not sys.warnoptions:
warnings.filterwarnings(action="default", category=DeprecationWarning, module="airflow")
warnings.filterwarnings(action="default", category=PendingDeprecationWarning, module="airflow")
Upstream. I reported it as apache/airflow#77804. The fix, apache/airflow#77853, is merged and carried into the 3.4 branch by apache/airflow#78038, both under the milestone Airflow 3.4.1. On 2026-12-04, the newest release on PyPI was still 3.4.0.
Why It Happens
Airflow 3.4.0's command line declares two file arguments with argparse.FileType, which Python 3.14 deprecated. Airflow shows its own deprecation warnings on purpose, so every command prints both.
The Fix
The real fix is Airflow 3.4.1: when it's released, upgrade to it. The warnings are harmless meanwhile, because the commands work, so you can simply ignore them.
To hide just this message, set Python's PYTHONWARNINGS environment variable in the terminal you run Airflow from:
export PYTHONWARNINGS="ignore:FileType is deprecated:PendingDeprecationWarning"
The warnings documentation describes the format as "a sequence of fields separated by colons: action:message:category:module:line":
| Field | Value here | What it means |
|---|---|---|
| action | ignore | Don't show matching warnings |
| message | FileType is deprecated | In PYTHONWARNINGS, "a literal string that the start of the warning message must match (case-insensitively)" |
| category | PendingDeprecationWarning | Only warnings of this kind |
export sets the variable for this terminal only, so a new terminal shows the warnings again.
There's one side effect to know about. The documentation says the warnings filter "is initialized by -W options passed to the Python interpreter command line and the PYTHONWARNINGS environment variable", and Python keeps those options in sys.warnoptions. Airflow's if not sys.warnoptions: line above then skips both of its lines, so while PYTHONWARNINGS is set, Airflow's other DeprecationWarning and PendingDeprecationWarning messages stay hidden too. That's why the filter belongs in a terminal, not in your shell's startup file: you want those warnings back once you upgrade.
After the Fix
With the variable set, I ran airflow version and airflow dags list-import-errors again:
3.4.0
No data found

Without it, each of the two commands had printed the two warnings first. Warnings about old import paths in your Dags are a different kind, DeprecatedImportWarning, which Airflow defines as a FutureWarning: one of those still showed with the filter set.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
| Looking for the cause in your Dags | Nothing to find: airflow version, which reads no Dags, printed the warnings too | Treat it as Airflow's own warning |
Putting the export line in your shell's startup file | Airflow's other deprecation warnings stay hidden in every terminal, even after you upgrade | Set it only in the terminal where you want quiet output, and drop it after upgrading |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
The warnings still show after the export | The variable was set in another terminal | Run the export line in the terminal you run Airflow from |
| A different deprecation warning is gone too | PYTHONWARNINGS stops Airflow from turning on its deprecation warnings | Open a new terminal without the variable to see them |
FAQ
Is the warning harmful?
No. It tells Airflow's developers that FileType is deprecated in Python 3.14, and the command still does its job: airflow version printed 3.4.0 right after it.
Do I need to change anything after upgrading to 3.4.1?
Only remove the PYTHONWARNINGS setting if you added one. The fix is in Airflow's code, so there's nothing else to change.
Conclusion
FileType is deprecated. Simply open files after parsing arguments. came from two arguments in Airflow 3.4.0's command line that still use argparse.FileType, deprecated in Python 3.14. The fix is merged for Airflow 3.4.1. Until it ships, the warning is harmless, and PYTHONWARNINGS="ignore:FileType is deprecated:PendingDeprecationWarning" hides exactly this message in one terminal.
Additional Resources
- apache/airflow#77804 — the report, and the fix linked from it.
- argparse.FileType — the deprecation and why opening files after parsing is better.
- Describing warning filters — the
PYTHONWARNINGSformat.
Related
- How to Install Apache Airflow® with uv and a Constraints File
- How to Set AIRFLOW_HOME for Apache Airflow®
Apache®, Apache Airflow and Airflow® are either registered trademarks or trademarks of The Apache Software Foundation in the United States and/or other countries. No endorsement by The Apache Software Foundation is implied by the use of these marks.
