Skip to main content

With this tool, one can define pieces of a notebook that belong to teachers and should not be exposed to students.

Project description

nbprune

typical use case is, a teacher writes a notebook, with solution(s) to a problem that students must solve

so this means 2 versions, one for the teacher(s) with the solutions, and one for the students

this tool defines annotations that the teacher can use to define the parts that will be automatically removed by the tool

keywords

here are the recognized keywords

tag meaning
prune-line (*) remove just that one line from the output
prune-cell remove this cell from the output
prune-begin remove this cell and the ones below from the output
prune-end remove this cell, but resume insertion on the next cell
prune-begin-next (**) keep this cell from the output, and start pruning at the next one
prune-end-previous (**) stop pruning, and insert the current cell

NOTES

  • (*) prune-line of course is not relevant, and ignored, if set in the cell's metadata tags
  • (**) because prune-begin-next and prune-end-previous appear in a cell that is visible, the whole line containing the tag is removed from the output, so it is probably best to keep these tags on a separate

line format

the tool will consider a tag is present in a cell if any line in the cell contains one of the above keywords, with the beginning of the line containing only # and spaces or tabs

so for exemple

line match
prune-cell yes
# prune-cell yes
# # prune-cell yes
some code prune-cell no

cell metadata

the tags can also be set in the cell's metadata as well (except for prune-line) ; something like this

{
  "tags": [
    "prune-cell"
  ]
}

examples

so that these 2 scenarios are equivalent

cell tag preserved
1 y
2 prune-cell n
3 y
4 y
5 prune-begin-next y
6 n
7 n
8 n
9 prune-end-previous y
10 y

or


cell tag preserved
1 y
2 prune-cell n
3 y
4 y
5 y
6 prune-begin n
7 n
8 prune-end n
9 y
10 y

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nbprune-0.3.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

nbprune-0.3.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file nbprune-0.3.0.tar.gz.

File metadata

  • Download URL: nbprune-0.3.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for nbprune-0.3.0.tar.gz
Algorithm Hash digest
SHA256 21ae398c7b69823b13e00b76389f41bb12895901c6c08839e1f862b7915d4c95
MD5 3e0e14007dd48a5c3f49798a77a3458a
BLAKE2b-256 a45127fd308e5c4df907c216692189486ba9a12e4eecd3b13f0efa79ac02bea0

See more details on using hashes here.

File details

Details for the file nbprune-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: nbprune-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for nbprune-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e587936db5e1ab1060327c26f9b9560589eb8fa597fabe99343906d988a69308
MD5 70a9057f8742e985ed99856378d69c67
BLAKE2b-256 f4c020e726bec72d4cb4f2611355e3a714328e0d2de06a82c9c098f5e373ae72

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page