From 4812be3db1054ef4300c96f061336f7f75b52245 Mon Sep 17 00:00:00 2001 From: Faisal Date: Thu, 5 Sep 2024 14:32:34 +0500 Subject: [PATCH 1/4] 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 From f7bd086612fcef791a83af6079b7a7500337a9ba Mon Sep 17 00:00:00 2001 From: Faisal Date: Tue, 10 Sep 2024 15:07:25 +0500 Subject: [PATCH 2/4] chore: updated packages for using python 3.11 --- requirements/base.txt | 14 +++++++------- requirements/pip.txt | 6 +++--- requirements/pip_tools.txt | 19 +++++-------------- 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/requirements/base.txt b/requirements/base.txt index e08bc96..6c5008d 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -8,9 +8,9 @@ appdirs==1.4.4 # via fs fs==2.4.16 # via xblock -lxml==5.1.0 +lxml==5.3.0 # via xblock -mako==1.3.2 +mako==1.3.5 # via xblock markupsafe==2.1.5 # via @@ -20,19 +20,19 @@ python-dateutil==2.9.0.post0 # via xblock pytz==2024.1 # via xblock -pyyaml==6.0.1 +pyyaml==6.0.2 # via xblock -simplejson==3.19.2 +simplejson==3.19.3 # via xblock six==1.16.0 # via # fs # python-dateutil -web-fragments==2.1.0 +web-fragments==2.2.0 # via xblock -webob==1.8.7 +webob==1.8.8 # via xblock -xblock==2.0.0 +xblock==5.1.0 # via -r requirements/base.in # The following packages are considered to be unsafe in a requirements file: diff --git a/requirements/pip.txt b/requirements/pip.txt index 2f25eab..f313a9c 100644 --- a/requirements/pip.txt +++ b/requirements/pip.txt @@ -4,11 +4,11 @@ # # make upgrade # -wheel==0.42.0 +wheel==0.44.0 # via -r requirements/pip.in # The following packages are considered to be unsafe in a requirements file: -pip==24.0 +pip==24.2 # via -r requirements/pip.in -setuptools==69.1.1 +setuptools==74.1.2 # via -r requirements/pip.in diff --git a/requirements/pip_tools.txt b/requirements/pip_tools.txt index 48f0a2e..77d81ad 100644 --- a/requirements/pip_tools.txt +++ b/requirements/pip_tools.txt @@ -4,29 +4,20 @@ # # make upgrade # -build==1.1.1 +build==1.2.2 # via pip-tools click==8.1.7 # via pip-tools -importlib-metadata==7.0.1 +packaging==24.1 # via build -packaging==23.2 - # via build -pip-tools==7.4.0 +pip-tools==7.4.1 # via -r requirements/pip_tools.in -pyproject-hooks==1.0.0 - # via - # build - # pip-tools -tomli==2.0.1 +pyproject-hooks==1.1.0 # via # build # pip-tools - # pyproject-hooks -wheel==0.42.0 +wheel==0.44.0 # via pip-tools -zipp==3.17.0 - # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: # pip From a00a64f96bdcb38803d1b53c93cb67b8ffee8ad7 Mon Sep 17 00:00:00 2001 From: Faisal Date: Tue, 10 Sep 2024 15:09:30 +0500 Subject: [PATCH 3/4] chore: used resource loader for static resource loading --- audio/audio.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/audio/audio.py b/audio/audio.py index cb342f6..336ada5 100644 --- a/audio/audio.py +++ b/audio/audio.py @@ -1,7 +1,6 @@ """TO-DO: This XBlock will play an MP3 file as an HTML5 audio element. """ -import importlib.resources from xblock.core import XBlock from xblock.fields import Integer, Scope, String from xblock.fragment import Fragment @@ -35,8 +34,7 @@ class AudioXBlock(XBlock): @staticmethod def resource_string(path): """Handy helper for getting resources from our kit.""" - data = importlib.resources.files(__package__).joinpath(path) - return data.read_text(encoding="utf-8") + return resource_loader.load_unicode(path) # TO-DO: change this view to display your data your own way. def student_view(self, context=None): From 106ccb2e1797ee5b72fa30596973cc835c93dd63 Mon Sep 17 00:00:00 2001 From: Faisal Date: Mon, 30 Sep 2024 16:53:41 +0500 Subject: [PATCH 4/4] chore: upgraded the version to 0.3.1 and env setup using python 3.12 --- .github/workflows/pypi-publish.yml | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index 3e5d3c0..c25dc48 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.11 + python-version: 3.12 - name: Install pip run: pip install -r requirements/pip.txt diff --git a/setup.py b/setup.py index 1084c00..8f81cd4 100644 --- a/setup.py +++ b/setup.py @@ -92,7 +92,7 @@ def is_requirement(line): setup( name='audio-xblock', - version='0.3.0', + version='0.3.1', description='Audio XBlock, to play audio files in the course', long_description=README, long_description_content_type='text/markdown',