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

Add doc generation script with doc templates #49

Merged
merged 4 commits into from
Aug 22, 2024

Conversation

debermudez
Copy link
Contributor

@debermudez debermudez commented Aug 22, 2024

Trying to centralize the doc maintenance.

Now there is a perf_analyzer/templates directory. In that directory exists template_vars.yaml, generate_docs.py, and a directory of genai-perf jinja2 templates for the docs.

All of the templates are in normal markdown except where a release number or variable that needs to be updated exists. When you run generate_docs.py in the templates directory, the script will iterate over the files in the template_vars.yaml file, populating all fields in the template with the respective value in the yaml file.
Finally, the generated docs are written out to their current location to avoid manual copying.

Now, instead of scouring the codebase for release values to update every month, we can update 1 file and regenerate the docs. Only the docs that change need to be committed.

The next step is to expand this to perf_analyzer's docs where this is even more helpful.

templates/generate_docs.py Fixed Show fixed Hide fixed
README:
filename: README.md
template: genai-perf-templates/README_template
release: 24.08
Copy link
Contributor

Choose a reason for hiding this comment

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

Great work!

Is there a way to centralize the variables here? It seems like this moves us from needing to find the variables to update to being able to update them in one file then run the script. The next step for me would be to just having one centralized list of variables (maybe in this file?) to then know we need to update each one once. We'd go to the top of the and update release version, CLI version, etc. once and be done.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was a conscientious decision on my part to provide flexibility for every file while still centralizing all variables.
I can see going forward making a central list and then only overwrite if it is specified for a file. However, I did not want to over engineer this right now when ops is likely to take this completely out of this repo.
I wanted a short term solution that had room to evolve for later.

For now, search and replace in this one file is still very straight forward.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah I had the same suggestion. I had your branch pulled and was working on it when the suggestion came through. Seems like it's not as straight-forward as I'd hoped, though I'm no YML expert. I think we can extend this in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the script to centralize the variables to a single general set.
Now each file may specialize a variable which will take precedence over the general variable if both are defined.
Thank you for the suggestion, @dyastremsky and @fpetrini15!

@fpetrini15
Copy link
Collaborator

Great work @debermudez! In my testing, many of the files are unchanged because there is no version to modify. I'm assuming you expected this and are just generating templates in advance? Would it be better to only add template files as needed to reduce bloat?

@debermudez
Copy link
Contributor Author

Great work @debermudez! In my testing, many of the files are unchanged because there is no version to modify. I'm assuming you expected this and are just generating templates in advance? Would it be better to only add template files as needed to reduce bloat?

That is expected behavior yes. Most of the docs are not going to need updates.
My intention here was to set up templates to make it easy to update in the future without much work. If you would prefer I only template the files that need updating now, i can remove the ones that are not changing.

Copy link
Collaborator

@fpetrini15 fpetrini15 left a comment

Choose a reason for hiding this comment

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

Thanks again for taking this on! 🚀

@debermudez debermudez merged commit 3ec6ef2 into main Aug 22, 2024
7 checks passed
@debermudez debermudez deleted the dbermudez-automate-doc-updates branch August 22, 2024 20:04
lkomali pushed a commit that referenced this pull request Aug 27, 2024
* Add doc generation script with doc templates

* Set autoescape to True to avoid XSS attacks

* Further centralize template vars to 1 entry with the ability to specialize

* Add ability to run script from the root dir
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.

4 participants