On Tue, Feb 26, 2013 at 6:28 PM, Stefan van Zwam
<stefanvanz...@gmail.com> wrote:
> Hi all,
>
> The matroid code we want to submit to Sage soon has a reasonably complex web 
> of imports: the base class Matroid is abstract, but invokes subclasses of 
> itself (DualMatroid, MinorMatroid, sometimes BasisMatroid) for several of the 
> standard implementations of methods. Of course each of these, in its own 
> file, inherits from the abstract class.
>
> For the end user, we only want to auto-import a few classes and a constructor 
> function. We want to use lazy_import to play nice with Sage's startup time. 
> After a little struggle I got it to work fine (autocomplete, runtime 
> docstrings and all), but that gives trouble with building the reference 
> manual. I get errors like
>
> [matroids ] 
> /Users/svanzwam/sage-5.8.beta1/devel/sage/doc/en/reference/matroids/sage/matroids/basis_exchange_matroid.rst:11:
>  WARNING: autodoc can't import/find module 
> 'sage.matroids.basis_exchange_matroid', it reported error: "'module' object 
> has no attribute 'BasisExchangeMatroid'", please check your spelling and 
> sys.path
>
> Not only that, but the corresponding documentation files will be basically 
> empty (or, depending on the command issued, it fails to build)
>
> With normal imports these warnings vanish and the documentation builds as 
> expected. Should I give up on lazy_import, or is there another way out?

How about lazily importing the whole thing, rather than trying to have
part of it lazy and part of it not? Lazy import works best with
top-level constructors than individual objects anyways.

- Robert

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to