Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConceptXBlock | Drop py3.8 support | replace pkg_resource with importlib.resources #161

Merged
merged 5 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: setup python
uses: actions/setup-python@v3
with:
python-version: 3.8
python-version: 3.11

- name: Install pip
run: pip install -r requirements/pip.txt
Expand Down
10 changes: 5 additions & 5 deletions concept/concept.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import json

import pkg_resources
import importlib.resources
from xblock.core import XBlock
from xblock.fields import Integer, Scope, String
from xblock.fragment import Fragment
Expand Down Expand Up @@ -43,8 +43,8 @@ def relay_handler(self, request, suffix):

def resource_string(self, 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)
OmerBhatti marked this conversation as resolved.
Show resolved Hide resolved
return data.read_text(encoding="utf-8")

def student_view(self, context=None):
"""
Expand Down Expand Up @@ -79,8 +79,8 @@ def student_view(self, context=None):

def studio_view(self, context=None):
frag = Fragment(self.resource_string("static/html/studio_hack.html"))
frag.add_javascript(pkg_resources.resource_string(__name__, "static/js/oa_server.js"))
frag.add_javascript(pkg_resources.resource_string(__name__, "static/js/oa_edit.js"))
frag.add_javascript(importlib.resources.files(__package__).joinpath("static/js/oa_server.js"))
frag.add_javascript(importlib.resources.files(__package__).joinpath("static/js/oa_edit.js"))
return frag

# TO-DO: change this to create the scenarios you'd like to see in the
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ web-fragments==2.1.0
# via xblock
webob==1.8.7
# via xblock
xblock==2.0.0
xblock==5.0.0
# via -r requirements/base.in

# The following packages are considered to be unsafe in a requirements file:
Expand Down