Skip to content

Commit

Permalink
Merge pull request #30 from beingfaisal/faisal/pkg_resources_update
Browse files Browse the repository at this point in the history
Faisal/pkg resources update
  • Loading branch information
feanil authored Oct 25, 2024
2 parents 8060c1e + f482e82 commit d50d846
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
8 changes: 3 additions & 5 deletions plugins/tutor-contrib-learner-dashboard-mfe/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def load_about():
long_description=load_readme(),
packages=find_packages(exclude=["tests*"]),
include_package_data=True,
python_requires=">=3.8",
python_requires=">=3.11",
install_requires=["tutor>=16.0.0,<17.0.0", "tutor-mfe>=16.0.0,<17.0.0"],
extras_require={"dev": ["tutor[dev]>=16.0.0,<17.0.0"]},
entry_points={
Expand All @@ -52,9 +52,7 @@ def load_about():
"License :: OSI Approved :: GNU Affero General Public License v3",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
],
)
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.1.1"
__version__ = "0.2.0"
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os.path
from glob import glob

import pkg_resources
import importlib.resources

from tutor import hooks
from tutormfe.plugin import MFE_APPS
Expand Down Expand Up @@ -47,10 +47,9 @@ def _add_my_mfe(mfes):
# For each task added to MY_INIT_TASKS, we load the task template
# and add it to the CLI_DO_INIT_TASKS filter, which tells Tutor to
# run it as part of the `init` job.
file_path = importlib.resources.files("tutor_learner_dashboard_mfe")
for service, template_path in MY_INIT_TASKS:
full_path: str = pkg_resources.resource_filename(
"tutor_learner_dashboard_mfe", os.path.join("templates", *template_path)
)
full_path: str = file_path / os.path.join("templates", *template_path)
with open(full_path, encoding="utf-8") as init_task_file:
init_task: str = init_task_file.read()
hooks.Filters.CLI_DO_INIT_TASKS.add_item((service, init_task))
Expand Down Expand Up @@ -78,7 +77,7 @@ def _add_my_mfe(mfes):
# apply a patch based on the file's name and contents.
for path in glob(
os.path.join(
pkg_resources.resource_filename("tutor_learner_dashboard_mfe", "patches"),
importlib.resources.files("tutor_learner_dashboard_mfe") / "patches",
"*",
)
):
Expand Down

0 comments on commit d50d846

Please sign in to comment.