Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sage -docbuild: error building docs of single file with relative imports #30475

Open
mkoeppe opened this issue Aug 30, 2020 · 5 comments
Open

Comments

@mkoeppe
Copy link
Member

mkoeppe commented Aug 30, 2020

Follow-up from #29651:

The approach of SingleFileBuilder, creating a symlink to the source file, is not compatible with from .module import.

Example:

$ ./sage -docbuild file=src/sage/geometry/polyhedron/base.py html 
[html     ] building [html]: targets for 1 source files that are out of date
[html     ] updating environment: [new config] 1 added, 0 changed, 0 removed
[html     ] WARNING: autodoc: failed to import module 'base'; the following exception was raised:
[html     ] attempted relative import with no known parent package
[html     ] writing additional pages...  searchdone
[html     ] copying static files... ... done
[html     ] dumping search index in English (code: en)... done
[html     ] The HTML pages are in ../../../../.sage/docbuild/base/output/html.
Error building the documentation.

Instead, we should infer the fully qualified module name from the file name (see for example #30452) and import this module.

See also:

CC: @jhpalmieri @DaveWitteMorris

Component: build

Issue created by migration from https://trac.sagemath.org/ticket/30475

@mkoeppe mkoeppe added this to the sage-9.2 milestone Aug 30, 2020
@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe modified the milestones: sage-9.2, sage-9.3 Oct 24, 2020
@mkoeppe
Copy link
Member Author

mkoeppe commented Feb 13, 2021

comment:4

Setting new milestone based on a cursory review of ticket status, priority, and last modification date.

@mkoeppe mkoeppe modified the milestones: sage-9.3, sage-9.4 Feb 13, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.4, sage-9.5 Jul 19, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.5, sage-9.6 Dec 18, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.6, sage-9.7 Apr 7, 2022
@kwankyu
Copy link
Collaborator

kwankyu commented Jul 12, 2022

comment:8

Sorry for a naive question. What is the primary use of the single file doc builder? I didn't have an occasion to use it myself.

If the file is in the sage library, isn't it enough to use sage -docbuild reference/discrete_geometry html for src/sage/geometry/polyhedron/base.py, for instance?

@mkoeppe
Copy link
Member Author

mkoeppe commented Jul 12, 2022

comment:9

I think it can be useful for users who are working on a file outside of the Sage source tree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants