1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
|
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.3.
.TH NBSTRIPOUT "1" "July 2025" "nbstripout 0.8.1" "User Commands"
.SH NAME
nbstripout \- strip output from Jupyter and IPython notebooks
.SH DESCRIPTION
usage: nbstripout [\-h] [\-\-dry\-run | \fB\-\-install\fR | \fB\-\-uninstall\fR | \fB\-\-is\-installed\fR |
.IP
\fB\-\-status\fR | \fB\-\-version]\fR [\-\-verify] [\-\-keep\-count]
[\-\-keep\-output] [\-\-keep\-id] [\-\-extra\-keys EXTRA_KEYS]
[\-\-keep\-metadata\-keys KEEP_METADATA_KEYS]
[\-\-drop\-empty\-cells] [\-\-drop\-tagged\-cells DROP_TAGGED_CELLS]
[\-\-strip\-init\-cells] [\-\-attributes FILEPATH] [\-\-global |
\fB\-\-system\fR | \fB\-\-python\fR PATH] [\-\-force] [\-\-max\-size SIZE]
[\-\-mode {jupyter,zeppelin}] [\-\-textconv]
[files ...]
.SS "positional arguments:"
.TP
files
Files to strip output from
.SS "options:"
.TP
\fB\-h\fR, \fB\-\-help\fR
show this help message and exit
.TP
\fB\-\-dry\-run\fR
Print which notebooks would have been stripped
.TP
\fB\-\-install\fR
Install nbstripout in the current repository (set up
the git filter and attributes)
.TP
\fB\-\-uninstall\fR
Uninstall nbstripout from the current repository
(remove the git filter and attributes)
.TP
\fB\-\-is\-installed\fR
Check if nbstripout is installed in current repository
.TP
\fB\-\-status\fR
Print status of nbstripout installation in current
repository and configuration summary if installed
.TP
\fB\-\-version\fR
Print version
.TP
\fB\-\-verify\fR
Return a non\-zero exit code if any files were changed,
Implies \fB\-\-dry\-run\fR
.TP
\fB\-\-keep\-count\fR
Do not strip the execution count/prompt number
.TP
\fB\-\-keep\-output\fR
Do not strip output
.TP
\fB\-\-keep\-id\fR
Keep the randomly generated cell ids, which will be
different after each execution.
.TP
\fB\-\-extra\-keys\fR EXTRA_KEYS
Space separated list of extra keys to strip from
metadata, e.g. metadata.foo cell.metadata.bar
.TP
\fB\-\-keep\-metadata\-keys\fR KEEP_METADATA_KEYS
Space separated list of metadata keys to keep, e.g.
metadata.foo cell.metadata.bar
.TP
\fB\-\-drop\-empty\-cells\fR
Remove cells where `source` is empty or contains only
whitepace
.TP
\fB\-\-drop\-tagged\-cells\fR DROP_TAGGED_CELLS
Space separated list of cell\-tags that remove an
entire cell
.TP
\fB\-\-strip\-init\-cells\fR
Remove cells with `init_cell: true` metadata (default:
False)
.TP
\fB\-\-attributes\fR FILEPATH
Attributes file to add the filter to (in combination
with \fB\-\-install\fR/\-\-uninstall), defaults to
\&.git/info/attributes
.TP
\fB\-\-global\fR
Use global git config (default is local config)
.TP
\fB\-\-system\fR
Use system git config (default is local config)
.TP
\fB\-\-python\fR PATH
Path to python executable to use when \fB\-\-install\fR'ing
(default is deduced from `sys.executable`)
.TP
\fB\-\-force\fR, \fB\-f\fR
Strip output also from files with non ipynb extension
.TP
\fB\-\-max\-size\fR SIZE
Keep outputs smaller than SIZE
.TP
\fB\-\-mode\fR, \fB\-m\fR {jupyter,zeppelin}
Specify mode between [jupyter (default) | zeppelin]
(to be used in combination with \fB\-f\fR)
.TP
\fB\-\-textconv\fR, \fB\-t\fR
Prints stripped files to STDOUT
.PP
Strip output from Jupyter and IPython notebooks
===============================================
.PP
Opens a notebook, strips its output, and writes the outputless version to the
original file.
.PP
Useful mainly as a git filter or pre\-commit hook for users who don't want to
track output in VCS.
.PP
This does mostly the same thing as the `Clear All Output` command in the
notebook UI.
.PP
Usage
=====
.PP
Strip output from IPython / Jupyter / Zeppelin notebook (modifies the file in\-place): ::
.IP
nbstripout <file.ipynb>
nbstripout <file.zpln>
.PP
By default, nbstripout will only modify files ending in '.ipynb' or '.zpln', to
process other files us the '\-f' flag to force the application.
.IP
nbstripout \fB\-f\fR <file.ipynb.bak>
.SS "For using Zeppelin mode while processing files with other extensions use:"
.IP
nbstripout \fB\-m\fR zeppelin \fB\-f\fR <file.ext>
.PP
Use as part of a shell pipeline: ::
.IP
cat FILE.ipynb | nbstripout > OUT.ipynb
cat FILE.zpln | nbstripout \fB\-m\fR zeppelin > OUT.zpln
.PP
Set up the git filter and attributes as described in the manual installation
instructions below: ::
.IP
nbstripout \fB\-\-install\fR
.PP
Set up the git filter using ``.gitattributes`` ::
.IP
nbstripout \fB\-\-install\fR \fB\-\-attributes\fR .gitattributes
.PP
Set up the git filter in your global ``~/.gitconfig`` ::
.IP
nbstripout \fB\-\-install\fR \fB\-\-global\fR
.PP
Set up the git filter in your system\-wide ``$(prefix)/etc/gitconfig`` (most installations will require you to ``sudo``) ::
.IP
[sudo] nbstripout \fB\-\-install\fR \fB\-\-system\fR
.PP
Remove the git filter and attributes: ::
.IP
nbstripout \fB\-\-uninstall\fR
.PP
Remove the git filter from your global ``~/.gitconfig`` and attributes ::
.IP
nbstripout \fB\-\-uninstall\fR \fB\-\-global\fR
.PP
Remove the git filter from your system\-wide ``$(prefix)/etc/gitconfig`` and attributes ::
.IP
nbstripout \fB\-\-uninstall\fR \fB\-\-system\fR
.PP
Remove the git filter and attributes from ``.gitattributes``: ::
.IP
nbstripout \fB\-\-uninstall\fR \fB\-\-attributes\fR .gitattributes
.PP
Check if ``nbstripout`` is installed in the current repository
(exits with code 0 if installed, 1 otherwise): ::
.IP
nbstripout \fB\-\-is\-installed\fR
.PP
Print status of ``nbstripout`` installation in the current repository and
configuration summary of filter and attributes if installed
(exits with code 0 if installed, 1 otherwise): ::
.IP
nbstripout \fB\-\-status\fR
.PP
Do a dry run and only list which files would have been stripped: ::
.IP
nbstripout \fB\-\-dry\-run\fR FILE.ipynb [FILE2.ipynb ...]
.PP
Print the version: ::
.IP
nbstripout \fB\-\-version\fR
.PP
Show this help page: ::
.IP
nbstripout \fB\-\-help\fR
.PP
Manual filter installation
==========================
.PP
Set up a git filter using nbstripout as follows: ::
.IP
git config filter.nbstripout.clean '/path/to/nbstripout'
git config filter.nbstripout.smudge cat
.PP
Create a file ``.gitattributes`` or ``.git/info/attributes`` with: ::
.IP
*.ipynb filter=nbstripout
.PP
Apply the filter for git diff of ``*.ipynb`` files: ::
.IP
git config diff.ipynb.textconv '/path/to/nbstripout \fB\-t\fR'
.PP
In file ``.gitattributes`` or ``.git/info/attributes`` add: ::
.IP
*.ipynb diff=ipynb
|