From 8e4661545c6c9282ccfe58e7a64321e18be82da4 Mon Sep 17 00:00:00 2001 From: Andrii V Date: Mon, 18 Aug 2025 16:50:24 +0200 Subject: [PATCH] chore: suppress deprecation warning for pkg_resources --- rhodecode/config/middleware.py | 1 + rhodecode/config/patches.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/rhodecode/config/middleware.py b/rhodecode/config/middleware.py index 2cd20d31..45700022 100644 --- a/rhodecode/config/middleware.py +++ b/rhodecode/config/middleware.py @@ -106,6 +106,7 @@ def make_pyramid_app(global_config, **settings): # Apply compatibility patches patches.inspect_getargspec() patches.repoze_sendmail_lf_fix() + patches.suppress_pkg_resources_warnings() # first init, so load_pyramid_enviroment, can access some critical data, like __file__ propagate_rhodecode_config(global_config, {}, {}, full=False) diff --git a/rhodecode/config/patches.py b/rhodecode/config/patches.py index f5565327..66e09514 100644 --- a/rhodecode/config/patches.py +++ b/rhodecode/config/patches.py @@ -169,3 +169,18 @@ def repoze_sendmail_lf_fix(): from email.policy import SMTP encoding.encode_message = lambda message, *args, **kwargs: message.as_bytes(policy=SMTP) + + +def suppress_pkg_resources_warnings(): + """ + Suppress pkg_resources deprecation warnings from pyramid.asset module. + + pkg_resources is deprecated as of setuptools 81+ and will be removed in 2025-11. + This warning is generated by pyramid's asset resolution code which we cannot + easily modify. The warning is informational only and does not affect functionality. + """ + import warnings + + warnings.filterwarnings( + "ignore", message="pkg_resources is deprecated as an API.*", category=UserWarning, module="pyramid.asset" + )