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 script for add code/api snippets into docs. #823

Merged
merged 2 commits into from
Aug 23, 2024

Conversation

richard-to
Copy link
Collaborator

This script will go through the markdown documentation and inserts code examples and api docstrings into the docs.

This code needs to import mesop, so your terminal needs to have mesop imported via pip.
It does not seem to work when .cli.venv is loaded.

python transform_markdown.py
python transform_markdown.py --cache_files_list
python transform_markdown.py --use_cached_files_list

You can use the cached_files list to create a block list to ignore specific files that are not relevant.

This script is not integrated with the existing workflow yet.


It fails to find:

  • mesop.components.select.select.SelectOpenedChangeEvent
  • mesop.components.progress_bar.progress_bar.ProgressBarAnimationEndEvent

These two classes do not seem to be imported in the init.py file in Mesop, so I can look the inspect the classes. Not sure if that's intentional or not.

This script will integrate go through the markdown documentation and
inserting code examples and api docstrings into the docs.

python transform_markdown.py
python transform_markdown.py --cache_files_list
python transform_markdown.py --use_cached_files_list

You can use the cached_files list to create a block list to ignore
specific files that are not relevant.

This script is not integrated with the existing workflow yet.
@wwwillchen
Copy link
Collaborator

This script will go through the markdown documentation and inserts code examples and api docstrings into the docs.

This code needs to import mesop, so your terminal needs to have mesop imported via pip. It does not seem to work when .cli.venv is loaded.

python transform_markdown.py
python transform_markdown.py --cache_files_list
python transform_markdown.py --use_cached_files_list

You can use the cached_files list to create a block list to ignore specific files that are not relevant.

This script is not integrated with the existing workflow yet.

It fails to find:

  • mesop.components.select.select.SelectOpenedChangeEvent
  • mesop.components.progress_bar.progress_bar.ProgressBarAnimationEndEvent

These two classes do not seem to be imported in the init.py file in Mesop, so I can look the inspect the classes. Not sure if that's intentional or not.

We should export those two classes since they're part of our public API. I think it was just an oversight

Copy link
Collaborator

@wwwillchen wwwillchen left a comment

Choose a reason for hiding this comment

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

Overall I like this approach much better than my HTML approach - it's a lot cleaner and easier to extend. nice work!

ai/prompt_context/transform_markdown.py Show resolved Hide resolved
ai/prompt_context/transform_markdown.py Outdated Show resolved Hide resolved
ai/prompt_context/transform_markdown.py Outdated Show resolved Hide resolved
ai/prompt_context/transform_markdown.py Outdated Show resolved Hide resolved
@richard-to
Copy link
Collaborator Author

Ok.

  • Exported the progressbar end event and the select opened change event to the mesop init object.
  • Also added a check for enabling both flags at the same time (I had left it as is since I think it would be a noop in that situation. Would just end up overwriting the existing file with the same cached elements, but I think easy enough to add a check)

@richard-to richard-to merged commit 78c973f into google:main Aug 23, 2024
4 checks passed
@richard-to richard-to deleted the transform-md branch September 28, 2024 18:25
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