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

[Docs] Add python processing locally #12009

Merged
merged 10 commits into from
Feb 5, 2024

Conversation

sunethwarna
Copy link
Member

@sunethwarna sunethwarna commented Feb 2, 2024

This PR adds capability to add python snippet output to the docs automatically. Following is the documentation on how to use it.

  1. Add ## POST_PROCESS_PAGES_PYTHON_OUTPUT_GENERATION anywhere in the python snippet. It should not have any leading or trailing spaces/tabs.
  2. Run the local build in your computer [Make sure to initialize kratos environment or any other library environments in the terminal which is being used by the snippet]. This will run the snippet and capture the output. It will also remove the ## POST_PROCESS_PAGES_PYTHON_OUTPUT_GENERATION tag line from the python snippet.
  3. Now you will see some block after the python snippet which contains the python output.

This generation is only done if process_pages.py is passed with -t local flag.

** This will not change any existing python snippets. If the automated output is required, the above tag needs to be placed within the python snippet. **

🆕 Changelog

  • Adds capability to automatically add python snippet output.

@sunethwarna sunethwarna marked this pull request as ready for review February 2, 2024 21:57
@sunethwarna sunethwarna self-assigned this Feb 2, 2024
Copy link
Member

@philbucher philbucher left a comment

Choose a reason for hiding this comment

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

Some comments :)

sunethwarna and others added 2 commits February 5, 2024 09:08
Co-authored-by: Philipp Bucher <[email protected]>
Co-authored-by: Philipp Bucher <[email protected]>
@@ -258,6 +318,10 @@ def CreateNavigatonBar(root_path: str, max_levels: int, default_header_dict: dic
file_output.write("entries:\n")
file_output.writelines(list_of_strings)

if is_locally_built:
from KratosMultiphysics.testing.utilities import GetPython3Command
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
from KratosMultiphysics.testing.utilities import GetPython3Command

unused

Copy link
Member Author

@sunethwarna sunethwarna Feb 5, 2024

Choose a reason for hiding this comment

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

It is used within the method following this line, I did the import their so, specially in the CI, you don't need to have Kratos environment to depoly the pages.

Co-authored-by: Philipp Bucher <[email protected]>
Co-authored-by: Philipp Bucher <[email protected]>
philbucher
philbucher previously approved these changes Feb 5, 2024
@sunethwarna
Copy link
Member Author

Fixed the pushing of cpp outputs by adding "-u" arg. @philbucher could you check it ? Thanks :)

@sunethwarna sunethwarna enabled auto-merge February 5, 2024 13:30
@sunethwarna sunethwarna merged commit 616375d into master Feb 5, 2024
8 of 9 checks passed
@sunethwarna sunethwarna deleted the docs/add_python_processing_locally branch February 5, 2024 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants