On Thu Dec 18 2014 at 1:51:17 PM Vincent Knight <knigh...@cf.ac.uk> wrote:

> On Thu Dec 18 2014 at 1:33:08 PM Jeroen Demeyer <jdeme...@cage.ugent.be>
> wrote:
>
>> I think the error message is clear enough, you shouldn't be resolving
>> lazy imports on Sage startup.
>
>
> Thanks for the reply. I'm afraid that it's not quite clear enough for me
> which I think probably means my understanding of it isn't good enough :)
>
>
>> Usually, lazy imports are used to limit
>> the amount of imports done at Sage startup. So if a lazy import is used
>> during Sage startup, that's usually a bug.
>>
>
> I don't quite understand what you mean by the above: if the point of lazy
> import is to limit imports at Sage startup am I not supposed to use it at
> Sage startup?
>

I've thought about this a bit more. Is the issue coming from the fact that
we're using lazy_import in the front matter of our library, and this is
what is being kicked in on startup? Whereas we want to actually use
lazy_import in methods etc... so that they import as necessary?

If I've understood that correctly I think I should be able to refactor as
you suggested :)

>
>
>>
>> Now the underlying problem is that you use is_package_installed() in
>> code which is executed on startup. I suggest you try to refactor your
>> code to avoid the use of is_package_installed (for example, use
>> try:/except ImportError: instead).
>>
>
> We've managed to remove the error message by running:
>
> lazy_import('sage.misc.package', 'is_package_installed', at_startup=True)
>
> but I think you're saying that this is not the right way to go...
> I think that I understood elsewhere that using `is_package_installed` is
> preferred over try/except statements...
>
> Am I missing some documentation somewhere that would clarify would fix  my
> lack of understanding :) (Apologies if this is something I should have
> already read).
>
> Thanks for the help,
> Vince
>
>
>
>> On 2014-12-18 12:44, Vincent Knight wrote:
>> > Resolving lazy import is_package_installed during startup
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sage-devel" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to sage-devel+unsubscr...@googlegroups.com.
>> To post to this group, send email to sage-devel@googlegroups.com.
>> Visit this group at http://groups.google.com/group/sage-devel.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to