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

use mkdocstrings to generate API docs #79

Merged
merged 19 commits into from Jan 4, 2023

Conversation

branfosj
Copy link
Member

@branfosj branfosj commented Nov 27, 2022

Uses:

Based on the example at https://mkdocstrings.github.io/recipes/#automatic-code-reference-pages.

This expects to find the easybuild framework checked out in src

  • I.e. git clone git@github.com:easybuilders/easybuild-framework.git src

Issue:

  • py2.py causes this to fail
    • I suspect that this tries to import the modules and fails on py2.py as we are using Python 3
    • This gets replaced during document generation

@branfosj branfosj marked this pull request as draft November 27, 2022 17:28
@branfosj branfosj marked this pull request as ready for review December 3, 2022 09:50
@boegel
Copy link
Member

boegel commented Dec 3, 2022

While playing with this, I hit the following error when building the docs with mkdocs build:

ERROR    -  Error reading page 'api/easybuild/index.md': 'easyconfigs'
Traceback (most recent call last):
  File "/Users/kehoste/Library/Python/3.9/lib/python/site-packages/griffe/loader.py", line 473, in _member_parent
    return module[parent_parts]
  File "/Users/kehoste/Library/Python/3.9/lib/python/site-packages/griffe/mixins.py", line 27, in __getitem__
    return self.members[parts[0]][parts[1:]]  # type: ignore[attr-defined]
KeyError: 'easyconfigs'

This is somehow caused by having all easybuild-* code repos (+ vsc-install and vsc-base) listed in my $PYTHONPATH:

$ echo $PYTHONPATH
/Users/kehoste/work/easybuild-easyconfigs:/Users/kehoste/work/easybuild-easyblocks:/Users/kehoste/work/easybuild-framework:/Users/kehoste/work/vsc-install/lib:/Users/kehoste/work/vsc-base/lib

Workaround is to just wipe $PYTHONPATH while running mkdocs build:

PYTHONPATH= mkdocs build

@branfosj branfosj changed the title use mkdocstrings to generate API docs (WIP) use mkdocstrings to generate API docs Dec 3, 2022
@boegel boegel added the porting-to-mkdocs Porting effort from Sphinx/.rst to MkDocs/.md label Jan 3, 2023
mkdocs.yml Outdated Show resolved Hide resolved
default_handler: python
handlers:
python:
paths: [src]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe src/easybuild-framework makes more sense?

Eventually, it could be interesting to also have auto-generated API docs for easybuild.easyblocks, perhaps...

We can tackle this in a follow-up PR, where we also try to avoid that src must be populated in order for the documentation build to work, since this also requires changes to gen_ref_pages.py

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can tackle that in a follow on to this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opened #88 to follow up on this

mkdocs.yml Outdated Show resolved Hide resolved
mkdocs.yml Outdated Show resolved Hide resolved
mkdocs.yml Outdated Show resolved Hide resolved
Co-authored-by: Kenneth Hoste <kenneth.hoste@ugent.be>
@boegel boegel merged commit 6a410fa into easybuilders:main Jan 4, 2023
@branfosj branfosj deleted the mkdocstrings branch January 4, 2023 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
porting-to-mkdocs Porting effort from Sphinx/.rst to MkDocs/.md
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants