# `juq`
Query, run, and clean Jupyter notebooks (name is inspired by "`jq` for Jupyter")
[](https://badge.fury.io/py/juq.py)
<!-- toc -->
- [Installation](#installation)
- [Usage](#usage)
- [`juq cells`](#juq-cells)
- [`juq merge-outputs`](#juq-merge-outputs)
- [`juq papermill clean`](#juq-papermill-clean)
- [`juq papermill run`](#juq-papermill-run)
<!-- /toc -->
## Installation <a id="installation"></a>
```bash
pip install juq.py
```
## Usage <a id="usage"></a>
### `juq cells` <a id="juq-cells"></a>
Slice/Filter cells:
```bash
juq cells --help
# Usage: juq cells [OPTIONS] CELLS_SLICE [NB_PATH]
#
# Slice/Filter cells.
#
# Options:
# -m, --metadata / -M, --no-metadata
# Explicitly include or exclude each cell's
# "metadata" key. If only `-m` is passed, only
# the "metadata" value of each cell is printed
# -o, --outputs / -O, --no-outputs
# Explicitly include or exclude each cell's
# "outputs" key. If only `-o` is passed, only
# the "outputs" value of each cell is printed
# -s, --source / -S, --no-source Explicitly include or exclude each cell's
# "source" key. If only `-s` is passed, the
# source is printed directly (not as JSON)
# -t, --cell-type TEXT Only print cells of this type. Recognizes
# abbreviations: "c" for "code", {"m","md"}
# for "markdown", "r" for "raw"
# --help Show this message and exit.
```
### `juq merge-outputs` <a id="juq-merge-outputs"></a>
Merge consecutive "stream" outputs (e.g. stderr):
<!-- `bmdf -- juq merge-outputs --help` -->
```bash
juq merge-outputs --help
# Usage: juq merge-outputs [OPTIONS] [NB_PATH]
#
# Merge consecutive "stream" outputs (e.g. stderr).
#
# Options:
# -i, --in-place Modify [NB_PATH] in-place
# -n, --indent INTEGER Indentation level for the output notebook
# JSON (default: infer from input)
# -o, --out-path TEXT Write to this file instead of stdout
# -t, --trailing-newline / -T, --no-trailing-newline
# Enforce presence or absence of a trailing
# newline (default: match input)
# --help Show this message and exit.
```
e.g.:
```bash
juq merge-outputs -i notebook.ipynb
```
Useful for situations like:
- [jupyter-book#973](https://github.com/executablebooks/jupyter-book/issues/973)
- [nbval#138](https://github.com/computationalmodelling/nbval/issues/138#issuecomment-1869177219)
As of [nbconvert#2089](https://github.com/jupyter/nbconvert/pull/2089), this should be redundant with:
```bash
jupyter nbconvert --coalesce-streams --inplace notebook.ipynb
```
### `juq papermill clean` <a id="juq-papermill-clean"></a>
<!-- `bmdf -- juq papermill clean --help` -->
```bash
juq papermill clean --help
# Usage: juq papermill clean [OPTIONS] [NB_PATH]
#
# Remove Papermill metadata from a notebook.
#
# Removes `.metadata.papermill` and
# `.cells[*].metadata.{papermill,execution,widgets}`.
#
# Options:
# -i, --in-place Modify [NB_PATH] in-place
# -n, --indent INTEGER Indentation level for the output notebook
# JSON (default: infer from input)
# -o, --out-path TEXT Write to this file instead of stdout
# -t, --trailing-newline / -T, --no-trailing-newline
# Enforce presence or absence of a trailing
# newline (default: match input)
# --help Show this message and exit.
```
### `juq papermill run` <a id="juq-papermill-run"></a>
<!-- `bmdf -- juq papermill run --help` -->
```bash
juq papermill run --help
# Usage: juq papermill run [OPTIONS] [NB_PATH]
#
# Run a notebook using Papermill, clean nondeterministic metadata.
#
# Options:
# -i, --in-place Modify [NB_PATH] in-place
# -n, --indent INTEGER Indentation level for the output notebook
# JSON (default: infer from input)
# -o, --out-path TEXT Write to this file instead of stdout
# -t, --trailing-newline / -T, --no-trailing-newline
# Enforce presence or absence of a trailing
# newline (default: match input)
# --help Show this message and exit.
```
Raw data
{
"_id": null,
"home_page": "https://github.com/runsascoded/juq",
"name": "juq.py",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Ryan Williams",
"author_email": "ryan@runsascoded.com",
"download_url": "https://files.pythonhosted.org/packages/c1/c6/0bfae12168e5911dd5ebfb940372957e93c75f876a842fbe34c0f37c5edf/juq.py-0.2.1.tar.gz",
"platform": null,
"description": "# `juq`\nQuery, run, and clean Jupyter notebooks (name is inspired by \"`jq` for Jupyter\")\n\n[](https://badge.fury.io/py/juq.py)\n\n<!-- toc -->\n- [Installation](#installation)\n- [Usage](#usage)\n - [`juq cells`](#juq-cells)\n - [`juq merge-outputs`](#juq-merge-outputs)\n - [`juq papermill clean`](#juq-papermill-clean)\n - [`juq papermill run`](#juq-papermill-run)\n<!-- /toc -->\n\n## Installation <a id=\"installation\"></a>\n```bash\npip install juq.py\n```\n\n## Usage <a id=\"usage\"></a>\n\n### `juq cells` <a id=\"juq-cells\"></a>\nSlice/Filter cells:\n```bash\njuq cells --help\n# Usage: juq cells [OPTIONS] CELLS_SLICE [NB_PATH]\n#\n# Slice/Filter cells.\n#\n# Options:\n# -m, --metadata / -M, --no-metadata\n# Explicitly include or exclude each cell's\n# \"metadata\" key. If only `-m` is passed, only\n# the \"metadata\" value of each cell is printed\n# -o, --outputs / -O, --no-outputs\n# Explicitly include or exclude each cell's\n# \"outputs\" key. If only `-o` is passed, only\n# the \"outputs\" value of each cell is printed\n# -s, --source / -S, --no-source Explicitly include or exclude each cell's\n# \"source\" key. If only `-s` is passed, the\n# source is printed directly (not as JSON)\n# -t, --cell-type TEXT Only print cells of this type. Recognizes\n# abbreviations: \"c\" for \"code\", {\"m\",\"md\"}\n# for \"markdown\", \"r\" for \"raw\"\n# --help Show this message and exit.\n```\n\n### `juq merge-outputs` <a id=\"juq-merge-outputs\"></a>\nMerge consecutive \"stream\" outputs (e.g. stderr):\n\n<!-- `bmdf -- juq merge-outputs --help` -->\n```bash\njuq merge-outputs --help\n# Usage: juq merge-outputs [OPTIONS] [NB_PATH]\n#\n# Merge consecutive \"stream\" outputs (e.g. stderr).\n#\n# Options:\n# -i, --in-place Modify [NB_PATH] in-place\n# -n, --indent INTEGER Indentation level for the output notebook\n# JSON (default: infer from input)\n# -o, --out-path TEXT Write to this file instead of stdout\n# -t, --trailing-newline / -T, --no-trailing-newline\n# Enforce presence or absence of a trailing\n# newline (default: match input)\n# --help Show this message and exit.\n```\ne.g.:\n```bash\njuq merge-outputs -i notebook.ipynb\n```\n\nUseful for situations like:\n- [jupyter-book#973](https://github.com/executablebooks/jupyter-book/issues/973)\n- [nbval#138](https://github.com/computationalmodelling/nbval/issues/138#issuecomment-1869177219)\n\nAs of [nbconvert#2089](https://github.com/jupyter/nbconvert/pull/2089), this should be redundant with:\n\n```bash\njupyter nbconvert --coalesce-streams --inplace notebook.ipynb\n```\n\n### `juq papermill clean` <a id=\"juq-papermill-clean\"></a>\n<!-- `bmdf -- juq papermill clean --help` -->\n```bash\njuq papermill clean --help\n# Usage: juq papermill clean [OPTIONS] [NB_PATH]\n#\n# Remove Papermill metadata from a notebook.\n#\n# Removes `.metadata.papermill` and\n# `.cells[*].metadata.{papermill,execution,widgets}`.\n#\n# Options:\n# -i, --in-place Modify [NB_PATH] in-place\n# -n, --indent INTEGER Indentation level for the output notebook\n# JSON (default: infer from input)\n# -o, --out-path TEXT Write to this file instead of stdout\n# -t, --trailing-newline / -T, --no-trailing-newline\n# Enforce presence or absence of a trailing\n# newline (default: match input)\n# --help Show this message and exit.\n```\n\n### `juq papermill run` <a id=\"juq-papermill-run\"></a>\n<!-- `bmdf -- juq papermill run --help` -->\n```bash\njuq papermill run --help\n# Usage: juq papermill run [OPTIONS] [NB_PATH]\n#\n# Run a notebook using Papermill, clean nondeterministic metadata.\n#\n# Options:\n# -i, --in-place Modify [NB_PATH] in-place\n# -n, --indent INTEGER Indentation level for the output notebook\n# JSON (default: infer from input)\n# -o, --out-path TEXT Write to this file instead of stdout\n# -t, --trailing-newline / -T, --no-trailing-newline\n# Enforce presence or absence of a trailing\n# newline (default: match input)\n# --help Show this message and exit.\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Query, run, and clean Jupyter notebooks (name is inspired by \"`jq` for Jupyter\")",
"version": "0.2.1",
"project_urls": {
"Homepage": "https://github.com/runsascoded/juq"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b429b6e7644d64052dbbb664bea4a922039920fc9f653d344e31314d0da29ff0",
"md5": "013884309089ffa2b40212b1ae62e8a2",
"sha256": "837081dabf47c4ac1109b9a5d57fbd13ab42b23f05dc4100c68ff79a49e3abb2"
},
"downloads": -1,
"filename": "juq.py-0.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "013884309089ffa2b40212b1ae62e8a2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 5410,
"upload_time": "2024-10-20T16:33:12",
"upload_time_iso_8601": "2024-10-20T16:33:12.716898Z",
"url": "https://files.pythonhosted.org/packages/b4/29/b6e7644d64052dbbb664bea4a922039920fc9f653d344e31314d0da29ff0/juq.py-0.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c1c60bfae12168e5911dd5ebfb940372957e93c75f876a842fbe34c0f37c5edf",
"md5": "8ad4c1e053010344392be7a595fa7374",
"sha256": "f2d4cb79bc0b9705eb12f201934c5ccc1288f8d945a66a8afd0f92697f6946e0"
},
"downloads": -1,
"filename": "juq.py-0.2.1.tar.gz",
"has_sig": false,
"md5_digest": "8ad4c1e053010344392be7a595fa7374",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4837,
"upload_time": "2024-10-20T16:33:13",
"upload_time_iso_8601": "2024-10-20T16:33:13.991905Z",
"url": "https://files.pythonhosted.org/packages/c1/c6/0bfae12168e5911dd5ebfb940372957e93c75f876a842fbe34c0f37c5edf/juq.py-0.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-20 16:33:13",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "runsascoded",
"github_project": "juq",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "click",
"specs": []
}
],
"lcname": "juq.py"
}