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

Process notebooks with pypandoc and a custom pandoc filter #2741

Merged
merged 31 commits into from
Mar 13, 2024
Merged

Conversation

svekars
Copy link
Contributor

@svekars svekars commented Jan 22, 2024

To fix a number of formatting issues with notebooks, adding pypandoc to process the notebooks and a custom pandoc filter and a post-processing script.
The custom filter does the following:

  • Handles admonitions - replaces notes, tips, and warnings with correct HTML blocks.
    Before:

  • Handles blocks of code that have video frames - adds a tag ``` {.python .jupyter-code-cell}

  • Handles images - prepends the pytorch.org/tutorials to the local paths so that the images display correctly.

  • Handles 2-colum grid layout - replaces with sid-by side cards:

The post-porocessing script:

  • Cleans up the resulting notebooks and remove the unneeded ```{=html} syntax that prevents the notebooks from rendering
  • Searches for ``` {.python .jupyter-code-cell} in the generated .ipynb files and slices the cells so that the HTML video frame can be run as a code cell and display that video

@svekars svekars added build issue Issues relating to the tutorials build notebook labels Jan 22, 2024
Copy link

pytorch-bot bot commented Jan 22, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/tutorials/2741

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 7adf3f6 with merge base 8c48ada (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@svekars svekars marked this pull request as ready for review March 8, 2024 23:15
@svekars svekars requested a review from malfet March 8, 2024 23:15
requirements.txt Outdated
Comment on lines 13 to 14
tqdm
numpy
Copy link
Contributor

Choose a reason for hiding this comment

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

Please do not unpin numpy and tqdm, but rather specify versions that do work for you (all those pins were added when updates broke tutorials)

Copy link
Contributor

@malfet malfet left a comment

Choose a reason for hiding this comment

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

Left a few comments (most particular, do not unpin the version of dependencies), but overall looks good to me

@svekars svekars merged commit 30e14df into main Mar 13, 2024
19 checks passed
@svekars svekars deleted the add-pypandoc branch March 13, 2024 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build issue Issues relating to the tutorials build cla signed notebook
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants