silence pystan's repeated pkg_resources deprecation warning

stan.plugins.get_plugins() calls pkg_resources.iter_entry_points()
from several call sites during model building, each re-emitting
setuptools' deprecation notice since Python's default warning dedup
is keyed per call site, not per message. Not actionable upstream
noise, so filter it by message instead.
This commit is contained in:
Alejandro Moreo Fernandez 2026-07-17 17:43:41 +02:00
parent 125d4bd756
commit ee803a339b
1 changed files with 10 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import importlib.resources
import logging
import os
import sys
import warnings
from collections.abc import Iterable
from numbers import Number, Real
@ -23,6 +24,15 @@ from quapy.method.aggregative import AggregativeSoftQuantifier
from quapy.method.confidence import ConfidenceRegionABC, WithConfidenceABC
from quapy.protocol import AbstractProtocol
# stan's plugin discovery (stan.plugins.get_plugins) calls pkg_resources.iter_entry_points()
# on every model build, each of which re-emits setuptools' pkg_resources deprecation notice;
# this is upstream pystan noise, not actionable in quapy, so it is silenced here.
warnings.filterwarnings(
"ignore",
message=r".*pkg_resources is deprecated.*",
category=UserWarning,
)
try:
import jax
import jax.numpy as jnp