From c52c72f26803ffdcaa2a666c452326ef26621521 Mon Sep 17 00:00:00 2001
From: Arthur Diniz <arthurbdiniz@gmail.com>
Date: Tue, 10 Feb 2026 21:12:28 +0000
Subject: [PATCH] Replace deprecated pkg_resources with importlib

pkg_resources has been removed from Setuptools 72.0.0+.

Closes: #12

Origin: upstream, https://patch-diff.githubusercontent.com/raw/w3c-social/activipy/pull/11.patch
Bug: https://github.com/w3c-social/activipy/issues/12
Bug-Debian: https://bugs.debian.org/1125818
---
 activipy/core.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/activipy/core.py b/activipy/core.py
index 47341ae..83ff18f 100644
--- a/activipy/core.py
+++ b/activipy/core.py
@@ -17,9 +17,13 @@
 ##   See the License for the specific language governing permissions and
 ##   limitations under the License.
 
-from pkg_resources import resource_filename
 import copy
 import json
+try:
+    from importlib.resources import files
+except ImportError:
+    # Fallback for Python < 3.9
+    from importlib_resources import files
 
 from pyld import jsonld
 
@@ -129,9 +133,8 @@ def _map_vocabs(self, vocabs):
 
 
 # TODO: Add this one by default
-AS2_CONTEXT_FILE = resource_filename(
-    'activipy', 'activitystreams2-context.jsonld')
-AS2_CONTEXT = json.loads(open(AS2_CONTEXT_FILE, 'r').read())
+AS2_CONTEXT_FILE = files('activipy').joinpath('activitystreams2-context.jsonld')
+AS2_CONTEXT = json.loads(AS2_CONTEXT_FILE.read_text())
 AS2_CONTEXT_URI = (
     "http://www.w3.org/TR/activitystreams-core/activitystreams2-context.jsonld")
 AS2_DEFAULT_URL_MAP = {
