| 1 |
From ba3e92d92918e620c77e23d0442608a1a678a061 Mon Sep 17 00:00:00 2001 |
| 2 |
From: Chloe Herman <[email protected]> |
| 3 |
Date: Fri, 21 Mar 2025 13:15:51 -0700 |
| 4 |
Subject: MAINT: `pkg_resources` deprecation |
| 5 |
|
| 6 |
Co-authored-by: Liz Gehret <[email protected]> |
| 7 |
--- |
| 8 |
q2templates/_templates.py | 4 ++-- |
| 9 |
1 file changed, 2 insertions(+), 2 deletions(-) |
| 10 |
|
| 11 |
diff --git a/q2templates/_templates.py b/q2templates/_templates.py |
| 12 |
index e6bf159..4023041 100644 |
| 13 |
--- a/q2templates/_templates.py |
| 14 |
+++ b/q2templates/_templates.py |
| 15 |
@@ -8,7 +8,7 @@ |
| 16 |
|
| 17 |
import inspect |
| 18 |
import os |
| 19 |
-import pkg_resources |
| 20 |
+import importlib |
| 21 |
import shutil |
| 22 |
import tempfile |
| 23 |
|
| 24 |
@@ -35,7 +35,7 @@ def render(source_files, output_dir, context=None): |
| 25 |
src = get_iterable(source_files) |
| 26 |
# TODO: Hook into qiime.sdk.config.TemporaryDirectory() when it exists |
| 27 |
temp_dir = tempfile.TemporaryDirectory() |
| 28 |
- template_data = pkg_resources.resource_filename('q2templates', 'templates') |
| 29 |
+ template_data = importlib.resources.files('q2templates') / 'templates' |
| 30 |
env = Environment(loader=FileSystemLoader(temp_dir.name), auto_reload=True) |
| 31 |
|
| 32 |
shutil.copy2(os.path.join(template_data, 'base.html'), temp_dir.name) |
| 33 |
-- |
| 34 |
2.47.3 |
| 35 |
|