https://github.com/andih/notebook-splitter

Split Jupyter Notebooks into Sub-Notebooks by Cell Metadata

https://github.com/andih/notebook-splitter

Science Score: 10.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 1 committers (100.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.5%) to scientific vocabulary

Keywords

classroom classroom-tools json jupyter jupyter-notebook python-script
Last synced: 5 months ago · JSON representation

Repository

Split Jupyter Notebooks into Sub-Notebooks by Cell Metadata

Basic Info
  • Host: GitHub
  • Owner: AndiH
  • License: mit
  • Language: Python
  • Default Branch: master
  • Size: 10.7 KB
Statistics
  • Stars: 3
  • Watchers: 2
  • Forks: 2
  • Open Issues: 0
  • Releases: 0
Topics
classroom classroom-tools json jupyter jupyter-notebook python-script
Created almost 7 years ago · Last pushed over 6 years ago
Metadata Files
Readme License

README.md

Jupyter Notebook Splitter

This tool splits a Jupyter Notebook into Sub-Notebooks depending on cell metadata. It converts a Master Notebook into a Teacher Notebook and a Student Notebook; or into a Slides Notebook, a Tasks Notebook, and a Solutions Notebook.

Installation

Although the Notebook Splitter is only a single file it can be installed via pip

bash pip install notebook-splitter

Usage

Overview

TL;DR: See notebook-splitter --help.

  1. Add cell metadata to your Jupyter Notebook: Add an exercise key (default, can be changed) to the metadata (JSON); give it values (tags) on which to create Sub-Notebooks

    json { "exercise": "task" } // another cell { "exercise": "solution" }

  2. Use --keep and --remove flags of the Notebook Splitter to keep and remove cells with according tags; export it to the respective Notebook:

    bash notebook-splitter input.ipynb --keep task --remove solution -o tasks.ipynb notebook-splitter input.ipynb --keep solution --remove task -o solutions.ipynb notebook-splitter input.ipynb --remove task --remove solution -o slides.ipynb

Examples in Action

See the examples directory in this repository.

Options

  • Repeated Parameters: --keep and --remove parameters on the command line of the script can be given multiple times: --keep task --keep onlytask --remove solution
  • Remove *All: As a special parameter value, --remove all will remove *all cells except those for which a --keep value is specified (--keep all is the default)
  • Stdin/Stdout: If no output file is given with -o/--output, the resulting Notebook will be printed to stdout; if no input file as a parameter is given, the input Notebook will be read from stdin (good for Linux-like daisy-chaining of tools)
  • Change *Basekey*: In the above example, the cell meta data key of discrimination is exercise which is the default. With --basekey, this can be changed.

Limitations

The values to the --keep and --remove parameters create sets of values to keep and remove. One could implement this tool probably quite cleverly with set operations (with the added complication of the --remove all ). If you can, feel free to file a merge request!

Owner

  • Name: Andreas Herten
  • Login: AndiH
  • Kind: user
  • Location: Langerwehe, Germany
  • Company: Jülich Supercomputing Centre

HPC, GPU Computing, Python, LaTeX, and, well…, take a look around…

GitHub Events

Total
Last Year

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 14
  • Total Committers: 1
  • Avg Commits per committer: 14.0
  • Development Distribution Score (DDS): 0.0
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Andreas Herten a****n@f****e 14
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: about 1 year ago

All Time
  • Total issues: 1
  • Total pull requests: 0
  • Average time to close issues: about 5 hours
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 0
  • Average comments per issue: 1.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • AndiH (1)
Pull Request Authors
Top Labels
Issue Labels
enhancement (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 225 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 5
  • Total maintainers: 1
pypi.org: notebook-splitter

Jupyter Notebook Splitter

  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 225 Last month
Rankings
Dependent packages count: 10.0%
Forks count: 19.1%
Dependent repos count: 21.7%
Average: 21.8%
Stargazers count: 25.0%
Downloads: 33.4%
Maintainers (1)
Last synced: about 1 year ago