Skip to content

Commit fb401d9

Browse files
authored
Merge pull request #2026 from weaviate/ignore_authlib_filter
Ignore irrelevant authlib warning
2 parents cacab29 + ccd12ac commit fb401d9

3 files changed

Lines changed: 22 additions & 0 deletions

File tree

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ install_requires =
3737
httpx>=0.26.0,<0.29.0
3838
validators>=0.34.0,<1.0.0
3939
authlib>=1.6.7,<2.0.0
40+
# When bumping authlib to >=2.0.0, remove the `authlib.jose` deprecation
41+
# warning filter implemented in `weaviate/_authlib_compat.py`.
4042
pydantic>=2.12.0,<3.0.0
4143
grpcio>=1.59.5,<1.80.0
4244
protobuf>=4.21.6,<7.0.0

weaviate/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from importlib.metadata import PackageNotFoundError, version
66
from typing import Any
77

8+
from . import _authlib_compat # noqa: F401 # side-effect: silence authlib.jose deprecation
9+
810
try:
911
__version__ = version("weaviate-client")
1012
except PackageNotFoundError:

weaviate/_authlib_compat.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"""Suppress the ``authlib.jose`` deprecation warning emitted by authlib >=1.7.0.
2+
3+
authlib registers ``simplefilter("always", AuthlibDeprecationWarning)`` at import time,
4+
so we must import the category first to insert our filter in front of it.
5+
6+
Remove this module (and its import in ``weaviate/__init__.py``) once the ``authlib``
7+
pin in ``setup.cfg`` moves to ``>=2.0.0``.
8+
"""
9+
10+
import warnings
11+
12+
from authlib.deprecate import AuthlibDeprecationWarning
13+
14+
warnings.filterwarnings(
15+
"ignore",
16+
message=r"^authlib\.jose module is deprecated",
17+
category=AuthlibDeprecationWarning,
18+
)

0 commit comments

Comments
 (0)