Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vinayak-mehta/nbcommands
Unix commands for Jupyter notebooks.
https://github.com/vinayak-mehta/nbcommands
Last synced: 14 days ago
JSON representation
Unix commands for Jupyter notebooks.
- Host: GitHub
- URL: https://github.com/vinayak-mehta/nbcommands
- Owner: vinayak-mehta
- License: apache-2.0
- Created: 2019-10-31T07:01:19.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-09-20T13:55:28.000Z (about 3 years ago)
- Last Synced: 2024-10-15T09:31:13.758Z (29 days ago)
- Language: Python
- Homepage: https://nbcommands.readthedocs.io
- Size: 1.51 MB
- Stars: 229
- Watchers: 7
- Forks: 12
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# nbcommands
[![image](https://readthedocs.org/projects/nbcommands/badge/?version=latest)](https://nbcommands.readthedocs.io/en/latest/) [![image](https://img.shields.io/pypi/v/nbcommands.svg)](https://pypi.org/project/nbcommands/) [![image](https://img.shields.io/pypi/pyversions/nbcommands.svg)](https://pypi.org/project/nbcommands/) [![image](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)
nbcommands bring the goodness of Unix commands to Jupyter notebooks.
## Installation
You can simply use pip to install nbcommands:
$ pip install nbcommandsor conda:
$ conda install -c conda-forge nbcommands## Usage
nbcommands installs the following commands which let you interact with your Jupyter notebooks without spinning up a notebook server.
- `nbtouch`: Update the access and modification times of each Jupyter notebook to the current time.
$ nbtouch notebook1.ipynb notebook2.ipynb
![nbtouch](https://raw.githubusercontent.com/vinayak-mehta/nbcommands/master/docs/_static/nbtouch.gif)- `nbgrep`: Search for a pattern in Jupyter notebooks.
$ nbgrep "os" notebook1.ipynb notebook2.ipynb
$ nbgrep "os" directory/
![nbgrep](https://raw.githubusercontent.com/vinayak-mehta/nbcommands/master/docs/_static/nbgrep.gif)- `nbhead`: Print the first 5 cells of a Jupyter notebook to standard output.
$ nbhead notebook1.ipynb
![nbhead](https://raw.githubusercontent.com/vinayak-mehta/nbcommands/master/docs/_static/nbhead.gif)Note: You can also specify the number of cells you want to print using the `-n` option.
$ nbhead -n 10 notebook1.ipynb- `nbtail`: Print the last 5 cells of a Jupyter notebook to standard output.
$ nbtail notebook2.ipynb
![nbtail](https://raw.githubusercontent.com/vinayak-mehta/nbcommands/master/docs/_static/nbtail.gif)Note: You can also specify the number of cells you want to print using the `-n` option.
$ nbtail -n 10 notebook2.ipynb- `nbcat`: Concatenate Jupyter notebooks to standard output.
$ nbcat notebook1.ipynb notebook2.ipynb
![nbcat](https://raw.githubusercontent.com/vinayak-mehta/nbcommands/master/docs/_static/nbcat.gif)Note: You can create a new notebook by concatenating multiple notebooks using the `-o` option.
$ nbcat notebook1.ipynb notebook2.ipynb -o notebook3.ipynb- `nbless`: Print a Jupyter notebook using a pager program.
$ nbless notebook1.ipynb
![nbless](https://raw.githubusercontent.com/vinayak-mehta/nbcommands/master/docs/_static/nbless.gif)And some non-Unix goodness,
- `nbblack`: Blacken Jupyter notebooks.
$ nbblack notebook1.ipynb notebook2.ipynb
![nbblack](https://raw.githubusercontent.com/vinayak-mehta/nbcommands/master/docs/_static/nbblack.gif)---
Planned enhancements:
- `nbstrip`: Strip outputs from Jupyter notebooks.
- `nbdiff`: Find the diff between two Jupyter notebooks.
- `nbecho`: Add a code cell to a Jupyter notebook.
- `nbedit`: Interactively edit a Jupyter notebook.
- `nbtime`: Run and time a Jupyter notebook.
- `nbwc`: Print word count for a Jupyter notebook.## Versioning
nbcommands uses [Semantic Versioning](https://semver.org/). For the available versions, see the tags on this repository.
## License
This project is licensed under the Apache License, see the [LICENSE](https://raw.githubusercontent.com/vinayak-mehta/nbcommands/master/LICENSE) file for details.