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

Enable Python docs on readthedocs #246

Merged
merged 4 commits into from
Feb 6, 2023

Conversation

kontura
Copy link
Contributor

@kontura kontura commented Jan 23, 2023

Follow up for: #163

Currently Python docs on readthedocs are empty: https://dnf5.readthedocs.io/en/latest/api/python/libdnf5_base_base.html
This is because readthedocs doesn't use cmake workflow to create the documentation (since it doesn't need to build the library to generate the docs). This PR adds readthedocs workflow to generate it using Sphinx AutoAPI that parses documented swig code itself, it doesn't need (to include) working Python module.

This is only used in readthedocs because sphinx-autoapi is currenly not packaged in fedora. However since in fedora we do regular full builds it is not a problem and Autodoc can be used normally.

For: #213

We require newer version of swig that is only present in ubuntu-22 (it
should become the default soon anyway) because of -doxygen flag which is
needed to generate python docs.

This also changes the way in which python is configured. The current
approach is deprecated: https://docs.readthedocs.io/en/latest/config-file/v2.html#python-version
We need to generate the bindings files so that they can be used to
generate python docs.
Readthedocs doesn't have to do a full build in order to generate
documentation so it doesn't use the cmake specified workflow. It has a
custom workflow that needs to run swig manually.

The approach here tries to use all interface files except `shared.i`, this may
break in the future if there is for example another shared file. The
actual list is hardcoded in cmake: https://github.com/rpm-software-management/dnf5/blob/main/bindings/CMakeLists.txt#L51-L56
Autoapi uses a custom parser to read in the doc strings and doesn't need
to include the python modules.
This allows to generate the docs even without full build of the library,
we just need to run swig but there is no need to compile the library
with the swig layer to create working Python module.

This is only used in readthedocs because sphinx-autoapi is currenly not
packaged in fedora. However since in fedora we do regular full builds it
is not a problem and Autodoc can be used normally.
@m-blaha m-blaha self-assigned this Feb 2, 2023
@m-blaha m-blaha merged commit e2ffa79 into rpm-software-management:main Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants