Skip to content

Generate api docs for EESSI test suite #319

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

Open
wants to merge 40 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
30b717a
generate api docs
xinan1911 Oct 10, 2024
3fdb896
Update deploy.yml and schedule
xinan1911 Oct 11, 2024
80f2c3a
Update deploy.yml syntax
xinan1911 Oct 11, 2024
5c7ef65
Update test.yml
xinan1911 Oct 11, 2024
65131b8
Update deploy.yml for action version
xinan1911 Oct 14, 2024
1994da4
Update test.yml
xinan1911 Oct 14, 2024
33762ff
Update deploy.yml resolve failed build
xinan1911 Oct 14, 2024
0004eb3
Update test.yml resolve failed build
xinan1911 Oct 14, 2024
12dc637
Update test.yml actions/setup-python@v5
xinan1911 Oct 14, 2024
9ca30ae
Moved location of testsuite API docs, as well as subdir
Apr 28, 2025
170da31
Resolved conflicts with upstream
Apr 28, 2025
9a027b2
Don't clone into src subdir, the subdir will already be test-suite, t…
Apr 28, 2025
422a20e
Put back EESSI in CI section, it was unintendely removed in this feat…
Apr 28, 2025
dd28578
Also remove the subdir for the checkout of EESSI test-suite in the te…
Apr 28, 2025
b870f15
Expand update_generated_time functionality so that we may reuse it in…
Apr 28, 2025
0d242ef
Make this a manual action
Apr 28, 2025
a99c6db
Restore original deploy.yml
Apr 28, 2025
322d0d4
.github/workflows/test.yml
Apr 28, 2025
1e31fd7
Simplify gen_ref_pages by removing commented code and documenting the…
Apr 28, 2025
e1ab323
Cleaned up code for automatically generating docs with mkdocs for EES…
Apr 28, 2025
51c3d48
Now really do it only on manual trigger
Apr 28, 2025
15ff385
Fix codespell issue
Apr 28, 2025
2aae108
Specify dedicated checkout path for cloning the testsuite repo
Apr 28, 2025
6726d44
Checking in test-suite path, otherwise the checkout overwrite any pre…
Apr 28, 2025
7d3189f
Makre sure te summary MD is also written to testsuite_api
Apr 29, 2025
af73133
Fix cross reference
Apr 29, 2025
09a7a5f
Change deployment strategy, as the autogenerated API docs end up dire…
Apr 29, 2025
3364006
add error for when test-suite repo is not available
laraPPr Jun 25, 2025
25e5c37
resolve merge conflicts
laraPPr Jun 26, 2025
4d9deda
updated the versions of the actions in the pr
laraPPr Jun 26, 2025
3c5ee20
update github actions
laraPPr Jun 26, 2025
29dbb15
fix workflow. hopefully?
laraPPr Jun 26, 2025
b92db86
fix workflow. With a little help
laraPPr Jun 26, 2025
8a3aa5d
fix now test.yml as well
laraPPr Jun 26, 2025
fb59aab
another fix of the CI
laraPPr Jun 26, 2025
25c86d5
fix typo in workflow
laraPPr Jun 26, 2025
f213810
make sure that the test-suite is available in the right location
laraPPr Jun 26, 2025
6c593b3
don't use fetch-true
laraPPr Jun 26, 2025
d831e05
check if the CI is now building the docs with the main branch of the …
laraPPr Jun 26, 2025
2597103
make sure that the latest release of test-suite is used and not the m…
laraPPr Jun 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# documentation: https://help.github.com/en/articles/workflow-syntax-for-github-actions
name: deploy documentation (only on push to main branch)
on:
schedule:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually, I don't think we want this in the regular deploy.yml. Having a cronjob that directly deploys the API docs means we have no human in the loop to check the changes to the API docs, and whether they make sense. I think the way this was implemented for the software overview in https://github.com/EESSI/docs/blob/main/.github/workflows/update_available_software.yml makes more sense for now: do a build of the docs, then create a PR based on that. It means the auto-generated docs will actually be part of this repo, i.e. the physical *.md files will be files within the EESSI/docs repo. That'll allow us to do a check on them before they get deployed.

Long term, we might want to do this fully automatically, without human in the loop. But to start with, I think the human in the loop would be a good thing (even if someone needs to keep an eye on those PRs and merge them).

# schedule the job to run at 12am every Saturday
- cron: '0 0 * * 0'
push:
branches: main
# Declare default permissions as read only.
Expand All @@ -13,15 +16,21 @@ jobs:
contents: write
steps:
- name: checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
uses: actions/checkout@v4
with:
fetch-depth: 0 # need to fetch all history to ensure correct Git revision dates in docs

- name: set up Python
uses: actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984 # v4.3.0
uses: actions/setup-python@v4
with:
python-version: '3.10'


- name: checkout test suite
uses: actions/checkout@v4
with:
repository: eessi/test-suite
path: src
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why don't we just do this without path, i.e. in the current workdir? It will still clone into a subidr test-suite by default right? No need to nest that further inside a src I'd think.


- name: install mkdocs + plugins
run: |
pip install -r requirements.txt
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
uses: actions/checkout@v4

- name: set up Python
uses: actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984 # v4.3.0
uses: actions/setup-python@v5
with:
python-version: '3.10'

Expand All @@ -30,6 +30,13 @@ jobs:
# config: '/lint/config/changelog.yml'
# args: '.'


- name: checkout test suite
uses: actions/checkout@v4
with:
repository: eessi/test-suite
path: src
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why don't we just do this without path, i.e. in the current workdir? It will still clone into a subidr test-suite by default right? No need to nest that further inside a src I'd think.


- name: install mkdocs + plugins
run: |
pip install -r requirements.txt
Expand Down
79 changes: 79 additions & 0 deletions docs/gen_ref_pages.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
"""
Generate the code reference pages.
Based off https://mkdocstrings.github.io/recipes/#automatic-code-reference-pages
"""

from pathlib import Path

import mkdocs_gen_files

# need to adjust to the test suite hook
Copy link
Collaborator

Choose a reason for hiding this comment

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

There seem to be quite some comments that are no longer relevant in this gen_ref_pages.py. Would be good to clean those up.

#root = Path(__file__).parent.parent

TEST_SUITE = "src/test-suite"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here, this would then just be `"test-suite"

#src = TEST_SUITE / "eessi"
MKDOCS_SEARCH_PRIORITY = """---
search:
boost: 0.5
---
"""

# build a navigation for the menu and a dictionary of navigations for each section
#menu_nav = mkdocs_gen_files.Nav()
#navs = {}
nav = mkdocs_gen_files.Nav()

#for path in sorted(src.rglob("*.py")):
for path in sorted(Path(f"{TEST_SUITE}/eessi/").rglob("*.py")):
module_path = path.relative_to(TEST_SUITE).with_suffix("")
doc_path = path.relative_to(TEST_SUITE).with_suffix(".md")
full_doc_path = Path("api", doc_path)

#parts = tuple(module_path.parts)
parts = list(module_path.parts)

#if len(parts) > 1 and tuple(parts[:-1]) not in navs:
# navs[tuple(parts[:-1])] = mkdocs_gen_files.Nav()

if parts[-1] == "__init__":
parts = parts[:-1]
#doc_path = doc_path.with_name("index.md")
#full_doc_path = full_doc_path.with_name("index.md")
elif parts[-1] == "__main__":
continue

# add item to menu navigation
#menu_nav[parts] = doc_path.as_posix()
nav[parts] = doc_path.as_posix()

# walk through the parents to the item and add it to each navigation section
#for i in range(1, len(parts)):
# nav_tuple = tuple(parts[:-i])
# doc_path_relative_to_nav = doc_path.relative_to("/".join(parts[:len(parts)-i])).as_posix()
# navs[nav_tuple][parts] = doc_path_relative_to_nav

with mkdocs_gen_files.open(full_doc_path, "w") as fd:
#fd.write(MKDOCS_SEARCH_PRIORITY)
identifier = ".".join(parts)
#fd.write(f"::: {identifier}\n")
fd.write(f"::: {identifier}")

mkdocs_gen_files.set_edit_path(full_doc_path, path)

# Generate the menu navigation file
with mkdocs_gen_files.open("api/summary.md", "w") as nav_file:
#nav_file.write(MKDOCS_SEARCH_PRIORITY)
#nav_file.writelines(menu_nav.build_literate_nav())
nav_file.writelines(nav.build_literate_nav())

#Generate the section navigation files, appending to any existing API content
#for key, nav in navs.items():
# fp = '/'.join(key)
# filename = f"api/{fp}/index.md"
#
# if not Path(filename).is_file():
# with mkdocs_gen_files.open(filename, "w") as nav_file:
# nav_file.write(MKDOCS_SEARCH_PRIORITY)

# with mkdocs_gen_files.open(filename, "a") as nav_file:
# nav_file.writelines(nav.build_literate_nav())
25 changes: 22 additions & 3 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ nav:
- Set up environment: using_eessi/setting_up_environment.md
- Basic commands: using_eessi/basic_commands.md
- Demos: using_eessi/eessi_demos.md
- EESSI in CI: using_eessi/eessi_in_ci.md
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure why this was removed here, but this has a conflict with upstream that needs to be resolved anyway. I guess that'll sort this out too.

- Advanced usage:
- Setting up your Stratum: filesystem_layer/stratum1.md
- Building software with EESSI: using_eessi/building_on_eessi.md
Expand All @@ -57,6 +56,7 @@ nav:
- Release notes: test-suite/release-notes.md
- Known issues and workarounds:
- v2023.06: known_issues/eessi-2023.06.md
- API documentation: api/
- Adding software to EESSI:
- Overview: adding_software/overview.md
- For contributors:
Expand All @@ -74,7 +74,6 @@ nav:
- Talks: talks.md
# - Community meeting (Sept'22): meetings/2022-09-amsterdam.md
- Contact info: contact.md
- Systems where EESSI is available: systems.md
- Blog: blog/index.md
plugins:
- blog:
Expand All @@ -96,6 +95,26 @@ plugins:
contributing_sw/overview.md: adding_software/overview.md
software_layer/adding_software.md: adding_software/overview.md
pilot.md: repositories/pilot.md
# link to any Markdown heading
- autorefs
# api automatics documentation
- mkdocstrings:
default_handler: python
handlers:
python:
paths: [src/test-suite]
Copy link
Collaborator

@casparvl casparvl Nov 13, 2024

Choose a reason for hiding this comment

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

This could also be shortened to paths: [test-suite], see the above changes.

options:
docstring_style: sphinx
docstring_section_style: spacy
show_source: false
- gen-files:
scripts:
- docs/gen_ref_pages.py
- literate-nav:
nav_file: summary.md
- section-index


markdown_extensions:
# enable adding HTML attributes and CSS classes
- attr_list
Expand Down Expand Up @@ -130,7 +149,7 @@ extra:
- icon: fontawesome/brands/twitter
link: https://twitter.com/eessi_hpc
# this gets auto-updated via update_generated_time.sh script run in update_available_software.yml action
generated_time: "Sat, 05 Oct 2024 at 01:44:07 UTC"
generated_time: "Fri, 06 Sep 2024 at 12:37:43 UTC"
extra_javascript:
# mermaid diagram
- https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs
Expand Down
5 changes: 5 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@ mkdocs-redirects
mkdocs-git-revision-date-localized-plugin
mkdocs-toc-sidebar-plugin
mkdocs-macros-plugin
mkdocs-autorefs
mkdocstrings[python]
mkdocs-gen-files
mkdocs-literate-nav
mkdocs-section-index