From fe0ea03ff168927104eec31c3586cce6892e0119 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 4 Nov 2025 21:24:56 +0100 Subject: [PATCH] Migrate from deprecated pkg_resources to importlib.metadata The pkg_resources module is deprecated and slated for removal in setuptools 81 (as early as 2025-11-30). This change eliminates UserWarning messages during afew execution by using the modern importlib.metadata API, which has been available since Python 3.8. --- a/afew/FilterRegistry.py +++ b/afew/FilterRegistry.py @@ -1,7 +1,7 @@ # SPDX-License-Identifier: ISC # Copyright (c) Justus Winter <4winter@informatik.uni-hamburg.de> -import pkg_resources +from importlib.metadata import entry_points RAISEIT = object() @@ -51,7 +51,7 @@ return self.filter.items() -all_filters = FilterRegistry(pkg_resources.iter_entry_points('afew.filter')) +all_filters = FilterRegistry(entry_points(group='afew.filter')) def register_filter(klass): --- a/docs/conf.py +++ b/docs/conf.py @@ -14,7 +14,7 @@ import sys import os -from pkg_resources import get_distribution +from importlib.metadata import version # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -74,7 +74,7 @@ if pretended_version: release = pretended_version else: - release = get_distribution('afew').version + release = version('afew') # The X.Y.Z version. version = '.'.join(release.split('.')[:3])