Skip to content

Repository files navigation

ComPWA notebook hooks

BSD 3-Clause licenseSpelling checkedCITest coveragepre-commit.ci statuscode style: prettieruvRuffty

This repository provides pre-commit hooks for formatting and standardizing Jupyter notebooks in repositories of the ComPWA organization (see our Help developing page).

Usage

Add a .pre-commit-config.yaml file to your repository with the following content:

repos:
- repo: https://github.com/ComPWA/nbhooksrev: ""hooks:
- id: colab-toc-visible
- id: fix-nbformat-version
- id: remove-empty-tags
- id: set-nb-cells
- id: set-nb-display-name
- id: strip-nb-whitespace

then run

pre-commit autoupdate --repo=https://github.com/ComPWA/nbhooks

This example lists all available hooks (listed here as ids) ― you can remove some of them.

Hook IDDescription
colab-toc-visibleShow the table-of-contents sidebar in Google Colab by default.
fix-nbformat-versionSet the nbformat minor version to 4 and remove cell IDs.
remove-empty-tagsRemove the tags metadata field from cells when it is empty.
set-nb-cellsAdd or replace standard cells (install cell, config cell, autolink).
set-nb-display-nameReset the notebook kernel display name to a standard value.
strip-nb-whitespaceRemove trailing whitespace from notebook cells.

Releases

Used by

Contributors

Languages