-
Notifications
You must be signed in to change notification settings - Fork 448
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
Tutor claims to support Python 3.12, but apparently doesn't (if plugins are involved) #966
Comments
Proposed Solution: importlib.resources: This module, included in Python's standard library, provides support for accessing files and resources within packages. It is a suitable replacement for similar functionalities previously achieved through pkg_resources. Many plugins in Tutor might be dependent on pkg_resources. These plugins will require refactoring to adapt to the new importlib modules. This update is crucial for ensuring the seamless functioning of Tutor and its plugins under Python 12. As an interim solution, it's proposed to add setuptools to the install_requires section of Tutor. This step will ensure the availability of pkg_resources until the full transition is completed. It's a temporary measure to maintain stability and compatibility during the transition phase. |
In tutor core, pkg_resources is used for two things:
and
How should these pieces of code be updated if we were to switch to importlib? |
Iterating Over Entry Points:
Getting Resource Filenames:
|
Looking good. And are these importlib functions compatible with Python 3.8? |
importlib.metadata (entry points): importlib.resources (resource filenames): |
Awesome! Then please go ahead and get rid of pkg_resources :) |
Just an explanatory note here, for posterity. In Python 3.8 one could, in principle, use However, before Python 3.8, Thus, as long as Tutor wants to support Python 3.8, |
Bug description
In the
setup.py
classifiers, Tutor claims to support Python 3.12. But that doesn't appear to be the case, at least not when one uses plugins, apparently due to the continued use of thepkg_resources
module in the plugin loading framework.How to reproduce
pip install tutor==17.0.0
tutor plugins enable <plugin>
Then:
This was taken from this build log:
https://github.com/hastexo/tutor-contrib-s3/actions/runs/7273329871/job/19817088029?pr=68#step:5:46
The offending line is here:
https://github.com/overhangio/tutor/blob/v17.0.0/tutor/env.py#L10
Additional context
As far as I understand, this is due to python/cpython#95299.
I believe the way to make
pkg_resources
available to Tutor again would be to addsetuptools
to theinstall_requires
list insetup.py
.This issue is being masked in production environments by the fact that a command to install
setuptools
is included in the Tutoropenedx
Dockerfile. So even if that Dockerfile switched to installing Python 3.12 (rather than 3.8, which it does now), most Tutor users would be unaffected. But plugin authors, who would presumably want to run their integration tests without the full Dockerfile, would very much benefit from theinstall_requires
list being corrected directly insetup.py
.The text was updated successfully, but these errors were encountered: