Skip to content

Switch off of deprecated pkg_resources library #676

Closed

Description

@kdmccormick

Background

The pkg_resources library, used by XBlock to load static assets, is deprecated. The removal timeline is unknown.

xblock-utils uses pkg_resources in a couple places.

To do

First, choose a new resource loading interface. Options:

  • Use importlib.resources. Unfortunately, this will become deprecated in Python 3.11 and replaced with a yet-to-be-determined interface.
  • Wait until Python 3.11, and then switch to the 3.11 replacement.

Then:

  • Update the code in xblock-utils.

Related

Activity

  1. added
    maintenance
    on May 25, 2023
  2. moved this to 🔖 Ready in Aximprovements Teamon Nov 14, 2023
  3. self-assigned this
    on Jan 27, 2024
  4. moved this from 🔖 Ready to 🏗 In progress in Aximprovements Teamon Jan 29, 2024
  5. kdmccormick commented on Feb 1, 2024

    @kdmccormick
    MemberAuthor

    @farhan , thanks for the research. I took a look at the Python forum post and came to the conclusion that:

    • pkg_resources is what we use now. It is deprecated but will still work in Python 3.11.
    • importlib.resources was introduced in Python 3.7, but its API had design problems.
    • importlib_resources is a better, redesigned version of that API, available in Python 3.3+.
    • In Python 3.11, importlib_resources becomes official, as importlib.resources, thus deprecating the old, problematic version of the API.

    So, it sounds like we could wait until edx-platform is upgraded to Python 3.11, and then just switch directly to the new, official importlib.resources package. Does that sound good?

  6. feanil commented on Feb 1, 2024

    @feanil
    Contributor

    As an additional note, it looks like pkg_resources is still around in 3.12 so it will be safe to jump to that as well so I think we can de-prioritize this until after the python upgrade which we'll hopefully kick-off soon.

  7. linked a pull request that will close this issueReplace pkg resources #58on Feb 16, 2024
  8. moved this from 🏗 In progress to 🔖 Ready in Aximprovements Teamon Feb 16, 2024
  9. added
    blocked by other work
    on May 7, 2024
  10. moved this from 🔖 Ready to 🏗 In progress in Aximprovements Teamon May 21, 2024
  11. removed
    blocked by other work
    on May 21, 2024
  12. moved this from 🏗 In progress to 👀 In review in Aximprovements Teamon May 23, 2024
  13. moved this from 👀 In review to 🛑 Blocked in Aximprovements Teamon Jun 10, 2024
  14. farhan commented on Jun 10, 2024

    @farhan
    Contributor

    PR is blocked as we are waiting for drop of Python v3.8 support from edx-platform

  15. moved this from 🛑 Blocked to 👀 In review in Aximprovements Teamon Jul 24, 2024
  16. moved this from 👀 In review to ✅ Done in Aximprovements Teamon Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

maintenance

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions