-
-
Notifications
You must be signed in to change notification settings - Fork 637
Description
We eliminate direct reading of files from the package directories of sagelib by using importlib.resources
(available since python 3.7)
git grep 'SAGE_EXTCODE' src/sage
git grep '__file__' src/sage
This will help make sagelib zip_safe
(https://setuptools.readthedocs.io/en/latest/userguide/miscellaneous.html#setting-the-zip-safe-flag)
In this ticket, we take care of sage.repl
, moving data needed by its doctests from SAGE_EXTCODE
(= src/sage/ext_data
) into the package directory. (Thus, we avoid a dependency on support for resources in namespace packages brought by Python 3.10(?) or the backport package importlib-resources
, see python/importlib_resources#196)
Follow-up tickets will deal with other parts of the library. In the end, the directory src/sage/ext_data
will be eliminated.
References:
- https://docs.python.org/3/library/importlib.html#module-importlib.resources
- https://importlib-resources.readthedocs.io/en/latest/migration.html
- https://importlib-resources.readthedocs.io/en/latest/using.html
CC: @tobiasdiez @fchapoton @kiwifb @dimpase @soehms @tscrim
Component: refactoring
Author: Matthias Koeppe
Branch/Commit: d925cd2
Reviewer: Dima Pasechnik
Issue created by migration from https://trac.sagemath.org/ticket/31306