From 4812be3db1054ef4300c96f061336f7f75b52245 Mon Sep 17 00:00:00 2001 From: Faisal Date: Thu, 5 Sep 2024 14:32:34 +0500 Subject: [PATCH] chore: updated python to 3.11 and replaced pkg_resources --- .github/workflows/pypi-publish.yml | 2 +- audio/audio.py | 6 +++--- requirements/base.txt | 2 +- requirements/pip.txt | 2 +- requirements/pip_tools.txt | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index 01338d2..3e5d3c0 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -15,7 +15,7 @@ jobs: - name: setup python uses: actions/setup-python@v4 with: - python-version: 3.8 + python-version: 3.11 - name: Install pip run: pip install -r requirements/pip.txt diff --git a/audio/audio.py b/audio/audio.py index f640a81..cb342f6 100644 --- a/audio/audio.py +++ b/audio/audio.py @@ -1,7 +1,7 @@ """TO-DO: This XBlock will play an MP3 file as an HTML5 audio element. """ -import pkg_resources +import importlib.resources from xblock.core import XBlock from xblock.fields import Integer, Scope, String from xblock.fragment import Fragment @@ -35,8 +35,8 @@ class AudioXBlock(XBlock): @staticmethod 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="utf-8") # TO-DO: change this view to display your data your own way. def student_view(self, context=None): diff --git a/requirements/base.txt b/requirements/base.txt index f5cec6f..e08bc96 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.8 +# This file is autogenerated by pip-compile with Python 3.11 # by the following command: # # make upgrade diff --git a/requirements/pip.txt b/requirements/pip.txt index 6665603..2f25eab 100644 --- a/requirements/pip.txt +++ b/requirements/pip.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.8 +# This file is autogenerated by pip-compile with Python 3.11 # by the following command: # # make upgrade diff --git a/requirements/pip_tools.txt b/requirements/pip_tools.txt index abed760..48f0a2e 100644 --- a/requirements/pip_tools.txt +++ b/requirements/pip_tools.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.8 +# This file is autogenerated by pip-compile with Python 3.11 # by the following command: # # make upgrade