From d1c67f42d92176737beb29794ab6da17685f6e37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Tue, 6 Feb 2024 11:41:23 +0100 Subject: [PATCH] fix: remove pkg_resources for compatibility with python 3.12 pkg_resources is a package that is unavailable in python 3.12, unless setuptools is explicitely installed. Turns out, there are replacement functions coming from importlib_resources, which can be obtained from the importlib-resources pypi package. This package will be installed with tutor starting from 17.0.2. --- .../20240212_115536_regis_pkg_resources.md | 1 + tutorxqueue/plugin.py | 41 +++++++------------ 2 files changed, 15 insertions(+), 27 deletions(-) create mode 100644 changelog.d/20240212_115536_regis_pkg_resources.md diff --git a/changelog.d/20240212_115536_regis_pkg_resources.md b/changelog.d/20240212_115536_regis_pkg_resources.md new file mode 100644 index 0000000..35b6d20 --- /dev/null +++ b/changelog.d/20240212_115536_regis_pkg_resources.md @@ -0,0 +1 @@ +- [Bugfix] Make plugin compatible with Python 3.12 by removing dependency on `pkg_resources`. (by @regisb) diff --git a/tutorxqueue/plugin.py b/tutorxqueue/plugin.py index d5f143a..25ac8e3 100644 --- a/tutorxqueue/plugin.py +++ b/tutorxqueue/plugin.py @@ -6,10 +6,9 @@ from typing import Any, Literal, Optional, Union import click -import pkg_resources +import importlib_resources import requests # type: ignore from tutor import config as tutor_config -from tutor.__about__ import __version_suffix__ from tutor import exceptions from tutor import hooks as tutor_hooks from tutor.__about__ import __version_suffix__ @@ -39,22 +38,17 @@ } # Initialization hooks - -# To add a custom initialization task, create a bash script template under: -# tutorxqueue/templates/xqueue/tasks/ -# and then add it to the MY_INIT_TASKS list. Each task is in the format: -# ("", ("", "", "