Skip to content

Refactor build_html_site.py #149

@ehmatthes

Description

@ehmatthes

The script can certainly be cleaned up. Some improvements would be in-script refactoring work, some would involve modifying notebooks and templates.

  • Instead of manually specifying which notebooks get show/hide all output buttons, either set a notebook metadata property and check for that in the template, or examine the notebook and look for any output blocks. If no output blocks, don't include the show/hide all output buttons. (See Only place show/hide all output buttons on notebooks with output blocks #148)
  • Approach to deleting and rebuilding html_site/ has five levels of nesting. That can be simplified or refactored into functions.
  • The script currently calls nbconvert from the command line from within a python script. I did this because I first learned to use nbconvert from the command line. Since we're using a python script, it would be better to use nbconvert as a library. See here. This might reduce the need for separate files like scripts/my_config.py, and would eliminate the use of environment variables.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions