Skip to content

Commit

Permalink
feat: remove pkg_resource
Browse files Browse the repository at this point in the history
- replace pkg_resource with importlib
- ensure python 3.8 support is removed
- ensure xblock >= 5.0.0
- ensure tests success
  • Loading branch information
arbimaq committed Aug 27, 2024
1 parent 3761288 commit c0ec060
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion done/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

from .done import DoneXBlock

__version__ = '2.3.0'
__version__ = '2.4.0'
6 changes: 3 additions & 3 deletions done/done.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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')
Expand Down

0 comments on commit c0ec060

Please sign in to comment.