From c0ec0608b13e7796fce4b62994c66f9f5a3d02d3 Mon Sep 17 00:00:00 2001 From: Abdullah Qureshi <111448185+arbimaq@users.noreply.github.com> Date: Tue, 27 Aug 2024 10:48:28 +0500 Subject: [PATCH] feat: remove pkg_resource - replace pkg_resource with importlib - ensure python 3.8 support is removed - ensure xblock >= 5.0.0 - ensure tests success --- done/__init__.py | 2 +- done/done.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/done/__init__.py b/done/__init__.py index f4aeb50..dc3da31 100644 --- a/done/__init__.py +++ b/done/__init__.py @@ -4,4 +4,4 @@ from .done import DoneXBlock -__version__ = '2.3.0' +__version__ = '2.4.0' diff --git a/done/done.py b/done/done.py index b311507..1441da2 100644 --- a/done/done.py +++ b/done/done.py @@ -5,7 +5,7 @@ import uuid -import pkg_resources +import importlib.resources from web_fragments.fragment import Fragment from xblock.core import XBlock from xblock.fields import Boolean, DateTime, Float, Scope, String @@ -26,8 +26,8 @@ def _(text): def resource_string(path): """Handy helper for getting resources from our kit.""" - data = pkg_resources.resource_string(__name__, path) - return data.decode("utf8") + data = importlib.resources.files(__package__).joinpath(path) + return data.read_text(encoding="utf8") @XBlock.needs('i18n')