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

Sphinx 5.0 autosummary fails with binded cpp module #10509

Closed
robin-cls opened this issue Jun 2, 2022 · 1 comment
Closed

Sphinx 5.0 autosummary fails with binded cpp module #10509

robin-cls opened this issue Jun 2, 2022 · 1 comment

Comments

@robin-cls
Copy link

robin-cls commented Jun 2, 2022

Describe the bug

I currently work on a project that includes CPP module binded with pybind11. This means in addition to the classical .py modules, there will be .so modules generated by pybind.

On previous Sphinx versions, the autosummary plugin did not complain about the format of .so modules, but Sphinx 5.0 now fails because of it (see the stack trace below):

robin-cls@px-2019:~/dev/sphinx5_autosummary_fail/doc$ sphinx-build . ../buildSphinx v5.0.0 en cours d'exécution
création du dossier de destinataire... fait
[autosummary] engendrement d’un auto-sommaire pour : index.rst

Extension error (sphinx.ext.autosummary):
Le gestionnaire <function process_generate_options at 0x7f842948b670> de l'évènement 'builder-inited' a créé une exception. (exception: source is not a .py file: '/home/robin-cls/dev/sphinx5_autosummary_fail/doc/example.cpython-39-x86_64-linux-gnu.so')

How to Reproduce

I reduced my problem to a simple reproductible case here : https://github.com/robin-cls/sphinx5_autosummary_fail (see the README.MD for generating the binded module and the documentation).

Expected behavior

I expected a run that properly generates the autosummary for the binded CPP module. Sphinx 4.5 runs without errors and generate HTML documentation for the binded module

Sphinx v4.5.0 en cours d'exécution
[autosummary] engendrement d’un auto-sommaire pour : index.rst
[autosummary] engendrement d’un auto-sommaire pour : /home/robin-cls/dev/sphinx5_autosummary_fail/doc/example.rst, /home/robin-cls/dev/sphinx5_autosummary_fail/doc/test.rst
Construction en cours [mo] : cibles périmées pour les fichiers po 0
Construction [html] : cibles périmées pour les fichiers sources 1
Mise à jour de l'environnement : [nouvelle configuration] 3 ajouté(s), 0 modifié(s), 0 supprimé(s)
Lecture des sources... [100%] test                                                                                                                  
Recherche des fichiers périmés... aucun résultat
Environnement de sérialisation... fait
Vérification de la cohérence... fait
Document en préparation... fait
Écriture... [100%] test                                                                                                                             
Génération des index... genindex py-modindex fait
écriture des pages additionnelles... search fait
copie des fichiers statiques... fait
Copie des fichiers complémentaires... fait
Export de l'index de recherche dans English (code: en)... fait
Export de l'inventaire des objets... fait
La compilation a réussi.

Les pages HTML sont dans ../build.

Your project

https://github.com/robin-cls/sphinx5_autosummary_fail

Screenshots

image

OS

Linux

Python version

3.9

Sphinx version

5.0

Sphinx extensions

sphinx.ext.autosummary

Extra tools

No response

Additional context

No response

@tk0miya tk0miya added this to the 5.0.1 milestone Jun 2, 2022
@tk0miya
Copy link
Member

tk0miya commented Jun 2, 2022

Note: Reproduced with this Dockerfile:

FROM python:3.9-slim

RUN apt update; apt install -y build-essential curl git unzip vim
RUN git clone https://github.com/robin-cls/sphinx5_autosummary_fail
WORKDIR /sphinx5_autosummary_fail/pybind11
RUN pip install pybind11
RUN c++ -O3 -Wall -shared -std=c++11 -fPIC $(python3 -m pybind11 --includes) example.cpp -o example$(python3-config --extension-suffix)
RUN cp *.so ../doc
WORKDIR /sphinx5_autosummary_fail/doc
RUN pip install Sphinx==5.0.0
RUN sphinx-build . ../build

@tk0miya tk0miya closed this as completed in ce345a2 Jun 2, 2022
tk0miya added a commit that referenced this issue Jun 2, 2022
…object

Fix #10509: autosummary: autosummary fails with a shared library
@tk0miya tk0miya modified the milestones: 5.0.1, 5.0.2 Jun 2, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants