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

[Python][Docs] API docs are broken for dev version #40623

Closed
AlenkaF opened this issue Mar 18, 2024 · 11 comments
Closed

[Python][Docs] API docs are broken for dev version #40623

AlenkaF opened this issue Mar 18, 2024 · 11 comments

Comments

@AlenkaF
Copy link
Member

AlenkaF commented Mar 18, 2024

Describe the bug, including details regarding any error messages, version, and platform.

Development version of the docs seems to be broken for generated Python API Reference documentation.

Example: https://arrow.apache.org/docs/dev/python/generated/pyarrow.Schema.html
Screenshot 2024-03-18 at 09 13 57

Did a hard refresh, hope it is not just me?

Component(s)

Documentation, Python

@AlenkaF
Copy link
Member Author

AlenkaF commented Mar 18, 2024

cc @raulcd

@jorisvandenbossche
Copy link
Member

This started with the update apache/arrow-site@05cb617 from the nightly build of 2024-03-12, so that matches the timeframe of potential candidate cause #40442

@kou
Copy link
Member

kou commented Mar 19, 2024

#40442 may be related...: #40442 (comment)

But it has different result:

image

@jorisvandenbossche
Copy link
Member

That looks like the same issue

@jorisvandenbossche
Copy link
Member

Starting to run the doc build locally, it seems that the issue is that the generated API files are now generated as .md files (but there content is restructuredtext).

With https://www.sphinx-doc.org/en/master/man/sphinx-autogen.html it seems there is an option to specify which extension to use, but not sure how that can be tweaked from conf.py

It seems that adding myst_parser to the list of extensions has (unintended) effect on the default extension that sphinx uses for this ..

@kou
Copy link
Member

kou commented Mar 19, 2024

Oh... Does this solve?

diff --git a/docs/source/conf.py b/docs/source/conf.py
index 7915e2c2c4..b67833112b 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -208,8 +208,8 @@ templates_path = ['_templates']
 #
 
 source_suffix = {
-    '.md': 'markdown',
     '.rst': 'restructuredtext',
+    '.md': 'markdown',
 }
 
 autosummary_generate = True

@kou
Copy link
Member

kou commented Mar 19, 2024

Hmm. Sphinx may have a problem:

diff --git a/sphinx/ext/autosummary/__init__.py b/sphinx/ext/autosummary/__init__.py
index 22e616c3f..9a469d23e 100644
--- a/sphinx/ext/autosummary/__init__.py
+++ b/sphinx/ext/autosummary/__init__.py
@@ -770,7 +770,7 @@ class AutoLink(SphinxRole):
 
 def get_rst_suffix(app: Sphinx) -> str | None:
     def get_supported_format(suffix: str) -> tuple[str, ...]:
-        parser_class = app.registry.get_source_parsers().get(suffix)
+        parser_class = app.registry.get_source_parsers().get(suffix.removeprefix('.'))
         if parser_class is None:
             return ('restructuredtext',)
         return parser_class.supported

@jorisvandenbossche
Copy link
Member

Oh... Does this solve?

That indeed seems to do the trick ..

@kou
Copy link
Member

kou commented Mar 20, 2024

@kou
Copy link
Member

kou commented Mar 22, 2024

The fix was merged.

kou added a commit to kou/arrow that referenced this issue Mar 22, 2024
AlenkaF pushed a commit that referenced this issue Mar 25, 2024
### Rationale for this change

Sphinx < 7.3.0 has a problem that auto generated files may use wrong suffix.

See sphinx-doc/sphinx#12147 for details.

### What changes are included in this PR?

Use `.rst` as the first `source_suffix` item as a workaround of this problem.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #40623

Authored-by: Sutou Kouhei <kou@clear-code.com>
Signed-off-by: AlenkaF <frim.alenka@gmail.com>
@AlenkaF AlenkaF added this to the 16.0.0 milestone Mar 25, 2024
@AlenkaF
Copy link
Member Author

AlenkaF commented Mar 25, 2024

Issue resolved by pull request 40739
#40739

@AlenkaF AlenkaF closed this as completed Mar 25, 2024
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

3 participants