#11729: Cache module import locations
---------------------------+------------------------------------------------
Reporter: vbraun | Owner: jason
Type: enhancement | Status: new
Priority: major | Milestone: sage-4.7.2
Component: misc | Keywords: sd32
Work_issues: | Upstream: N/A
Reviewer: | Author: Volker Braun
Merged: | Dependencies:
---------------------------+------------------------------------------------
Old description:
> This ticket implements a cached module importer for Python. It compiles a
> list of all available files during build (when sage -b is run), hooks
> into the Python import framework and finds modules by the predetermined
> file list.
>
> Apply trac_11729_cached_importer.patch to the sage library and
> trac_11729_import_cache_during_build.patch to the sage_scripts
> (`$AGE_LOCAL/bin`) repository.
New description:
This ticket implements a cached module importer for Python. It compiles a
list of all available files during build (when `sage -b` is run), hooks
into the Python import framework and finds modules by the predetermined
file list.
Building the Sage library (`sage -b`) automatically creates the cache and
the `sitecustomize.py` that is used to load the importer into the Python
session. The cache is a standard Python dictionary in
`sage/misc/modules_cache.py`.
{{{
[vbraun@volker-laptop-two hg]$ strace -e file -f sage -c quit |& grep
ENOENT | wc -l
26327
[vbraun@volker-laptop-two hg]$ sage -b
...
[vbraun@volker-laptop-two hg]$ strace -e file -f sage -c quit |& grep
ENOENT | wc -l
3785
}}}
If you encounter any problems while testing this patch, you have to
{{{
rm $SAGE_LOCAL/lib/python/site-packages/sitecustomize.py*
}}}
to not load the importer during Python startup.
Apply trac_11729_cached_importer.patch to the sage library and
trac_11729_import_cache_during_build.patch to the sage_scripts
(`$AGE_LOCAL/bin`) repository.
--
Comment(by vbraun):
I've added another workaround for `PIL.Image`, now `make ptest` passes! I
would say that the patch is now feature-complete, though it lacks
documentation and doctests. Though writing doctests is tricky without
breaking the module importing. Somebody should test it on OSX :-)
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11729#comment:8>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.