From d13da159eac552f520e715e79343c581fd80cafd Mon Sep 17 00:00:00 2001 From: Xinyuan Lin Date: Fri, 24 Jul 2026 20:08:58 -0700 Subject: [PATCH] chore(pyamber): silence pkg_resources deprecation warning from fs import Every spawned Python UDF worker imports fs (PyFilesystem2), whose import of pkg_resources emits a UserWarning on stderr. Filter that one message before the core import chain, and mirror the filter for pytest output. Follow-up item from #6796. --- amber/pyproject.toml | 7 ++++++- amber/src/main/python/texera_run_python_worker.py | 11 +++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/amber/pyproject.toml b/amber/pyproject.toml index dd9f2f939e4..bfa83112bc0 100644 --- a/amber/pyproject.toml +++ b/amber/pyproject.toml @@ -42,4 +42,9 @@ testpaths = ["src/test/python"] addopts = "--import-mode=importlib" markers = [ "integration: end-to-end test routed to the amber-integration CI job", -] \ No newline at end of file +] +# `fs` pulls in pkg_resources at import time (#4199); the same filter lives in +# texera_run_python_worker.py for spawned workers. +filterwarnings = [ + "ignore:pkg_resources is deprecated as an API.*:UserWarning", +] diff --git a/amber/src/main/python/texera_run_python_worker.py b/amber/src/main/python/texera_run_python_worker.py index 1e131d45739..d6b447db483 100644 --- a/amber/src/main/python/texera_run_python_worker.py +++ b/amber/src/main/python/texera_run_python_worker.py @@ -18,8 +18,19 @@ import base64 import json import sys +import warnings from loguru import logger +# `fs` (imported transitively by the core import below) pulls in pkg_resources +# at import time (#4199), which emits this deprecation warning on stderr in +# every spawned worker. It is not actionable on our side, so filter it before +# the import chain runs. Mirrored for pytest in amber/pyproject.toml. +warnings.filterwarnings( + "ignore", + message="pkg_resources is deprecated as an API.*", + category=UserWarning, +) + try: from core.python_worker import PythonWorker from core.storage.storage_config import StorageConfig