William Stein wrote:
> Nothing is "forbidden" yet, but we should try not to load whatever we
> can get away with not loading in order to improve the import time.
Well, it sounds like you are forbidding matplotlib and numpy being
loaded at startup, if you're making a doctest for that.
>
> Despite us both trying, numpy and matplotlib now are both imported by
> default. Incidentally, it's a bit ironic to say that you took care
> not to import numpy without worrying about matplotlib, because numpy
> arrays are a basic datastructure matplotlib, so I think importing
> matplotlib imports numpy.
>
> flat:ggz wstein$ sage -startuptime |grep numpy|wc -l
> 50
> flat:ggz wstein$ sage -startuptime |grep matplotlib|wc -l
> 17
>
> Anyway, actually looking at the output of startuptime reveals this:
>
> sage.plot.all: 0.500 (cubegroup)
> plot: 0.491 (sage.plot.all)
> ...
> matplotlib.ticker: 0.453 (plot)
> ...
> matplotlib.colors: 0.249 (rcsetup)
> numpy: 0.219 (matplotlib.colors)
>
> So in fact plotting now imports matplotlib, which import numpy.
> This might be because of the new (massively awesome!!) switch to using
> matplotlib axes that you did...
>
> I'm not trying to blame anybody, but just to raise awareness about an issue.
I understand. I thought matplotlib was okay to import, but numpy
wasn't. I didn't even think of dependency imports.
> sage: os.popen('sage -startuptime|grep matplotlib |wc -l').read().strip() ==
> '0'
> True
Yep, if we had a doctest that failed when we imported something we
weren't supposed by default, then it would be easier to take care of
dependency situations.
--
Jason Grout
--~--~---------~--~----~------------~-------~--~----~
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-support
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---