On Thu, Mar 11, 2021 at 5:18 AM Nathan Dunfield <nat...@dunfield.info> wrote:
>
>
>
> On Wednesday, March 10, 2021 at 4:50:41 AM UTC-6 Dima wrote:
>>
>> numpy does this:
>> https://numpy.org/devdocs/docs/howto_build_docs.html
>>
>> you can only build numpy docs after numpy is installed.
>
>
> Of course, with numpy "installed" doesn't necessarily mean installed in the 
> main site-packages, you can use a virtualenv.  Then you delete the virtualenv 
> once the docs are built and install the module and the docs for real.  It's 
> hard to avoid something like this if using Sphinx's autodoc features that 
> actually import the Python module and build the docs from the docstrings it 
> finds.
>
> Sage is likely too complicated for this to work, but you can skip the 
> virtualenv step by having Sphinx work off the copy of the in 
> "build/lib.macosx-10.9-x86_64-3.9" or similar.  This is the trick we use with 
> SnapPy:  https://github.com/3-manifolds/SnapPy/blob/master/doc_src/conf.py

You can also run `./setup.py develop` to have all extension modules
copied into the main package source, so that it can be directly
importable.  Then in Sphinx's conf.py you put something like (in
sage's case):

    sys.path.insert(0, '../src')

and now sage is importable from there without having to be "installed".

I have suggested this in the past over the way Sage has often been
developed by always re-installing the package into site-packages
before testing changes, but some people have been hostile to this out
of a distaste of having build artifacts cluttering the source tree.
And I sympathize with that distaste, though personally I don't mind
it.  I've argued in the past that both styles can work simultaneously
without much if any compromise.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/CAOTD34b_Gqjb2mA91g%3DdZ23vHX4BAKLe%2BM6CPnc6ZLgR8CEOfQ%40mail.gmail.com.

Reply via email to