From a30eb576757410eed870166a380927e9d43a7aff Mon Sep 17 00:00:00 2001 From: Dirk Kulawiak Date: Wed, 29 Apr 2026 11:50:21 +0200 Subject: [PATCH 1/2] Ignore irrelevant authlib warning --- setup.cfg | 2 ++ weaviate/__init__.py | 2 ++ weaviate/_authlib_compat.py | 14 ++++++++++++++ 3 files changed, 18 insertions(+) create mode 100644 weaviate/_authlib_compat.py diff --git a/setup.cfg b/setup.cfg index 857a7d308..104d8b64a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -37,6 +37,8 @@ install_requires = httpx>=0.26.0,<0.29.0 validators>=0.34.0,<1.0.0 authlib>=1.6.7,<2.0.0 + # When bumping authlib to >=2.0.0, remove the `authlib.jose` deprecation + # warning filter at the top of `weaviate/__init__.py`. pydantic>=2.12.0,<3.0.0 grpcio>=1.59.5,<1.80.0 protobuf>=4.21.6,<7.0.0 diff --git a/weaviate/__init__.py b/weaviate/__init__.py index 2e7e5e58b..f3b38dab5 100644 --- a/weaviate/__init__.py +++ b/weaviate/__init__.py @@ -5,6 +5,8 @@ from importlib.metadata import PackageNotFoundError, version from typing import Any +from . import _authlib_compat # noqa: F401 # side-effect: silence authlib.jose deprecation + try: __version__ = version("weaviate-client") except PackageNotFoundError: diff --git a/weaviate/_authlib_compat.py b/weaviate/_authlib_compat.py new file mode 100644 index 000000000..b5b599057 --- /dev/null +++ b/weaviate/_authlib_compat.py @@ -0,0 +1,14 @@ +"""Suppress the ``authlib.jose`` deprecation warning emitted by authlib >=1.7.0. + +authlib registers ``simplefilter("always", AuthlibDeprecationWarning)`` at import time, +so we must import the category first to insert our filter in front of it. + +Remove this module (and its import in ``weaviate/__init__.py``) once the ``authlib`` +pin in ``setup.cfg`` moves to ``>=2.0.0``. +""" + +import warnings + +from authlib.deprecate import AuthlibDeprecationWarning + +warnings.filterwarnings("ignore", category=AuthlibDeprecationWarning) From ccd12acbca16f99f66473e8fa706e52d70394ef7 Mon Sep 17 00:00:00 2001 From: Dirk Kulawiak Date: Wed, 29 Apr 2026 12:37:57 +0200 Subject: [PATCH 2/2] Review feedback --- setup.cfg | 2 +- weaviate/_authlib_compat.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index 104d8b64a..0b5ba855a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -38,7 +38,7 @@ install_requires = validators>=0.34.0,<1.0.0 authlib>=1.6.7,<2.0.0 # When bumping authlib to >=2.0.0, remove the `authlib.jose` deprecation - # warning filter at the top of `weaviate/__init__.py`. + # warning filter implemented in `weaviate/_authlib_compat.py`. pydantic>=2.12.0,<3.0.0 grpcio>=1.59.5,<1.80.0 protobuf>=4.21.6,<7.0.0 diff --git a/weaviate/_authlib_compat.py b/weaviate/_authlib_compat.py index b5b599057..402b169be 100644 --- a/weaviate/_authlib_compat.py +++ b/weaviate/_authlib_compat.py @@ -11,4 +11,8 @@ from authlib.deprecate import AuthlibDeprecationWarning -warnings.filterwarnings("ignore", category=AuthlibDeprecationWarning) +warnings.filterwarnings( + "ignore", + message=r"^authlib\.jose module is deprecated", + category=AuthlibDeprecationWarning, +)