├── .gitignore ├── .readthedocs.yml ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── HISTORY.md ├── LICENSE ├── README.md ├── docs ├── Makefile ├── _static │ ├── favicon.ico │ ├── nbblack.gif │ ├── nbblack.png │ ├── nbcat.gif │ ├── nbcat.png │ ├── nbcommands.png │ ├── nbgrep.gif │ ├── nbgrep.png │ ├── nbhead.gif │ ├── nbhead.png │ ├── nbless.gif │ ├── nbtail.gif │ ├── nbtail.png │ ├── nbtouch.gif │ └── nbtouch.png ├── _templates │ ├── hacks.html │ ├── sidebarintro.html │ └── sidebarlogo.html ├── _themes │ ├── .gitignore │ ├── LICENSE │ └── flask_theme_support.py ├── conf.py ├── index.rst └── make.bat ├── nbcommands ├── __init__.py ├── __version__.py ├── _black.py ├── _cat.py ├── _grep.py ├── _head.py ├── _less.py ├── _tail.py ├── _touch.py └── terminal.py ├── setup.py └── tests ├── test.ipynb └── test_nbcommands.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | MANIFEST 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | .pytest_cache/ 49 | 50 | # Translations 51 | *.mo 52 | *.pot 53 | 54 | # Django stuff: 55 | *.log 56 | local_settings.py 57 | db.sqlite3 58 | 59 | # Flask stuff: 60 | instance/ 61 | .webassets-cache 62 | 63 | # Scrapy stuff: 64 | .scrapy 65 | 66 | # Sphinx documentation 67 | docs/_build/ 68 | 69 | # PyBuilder 70 | target/ 71 | 72 | # Jupyter Notebook 73 | .ipynb_checkpoints 74 | 75 | # pyenv 76 | .python-version 77 | 78 | # celery beat schedule file 79 | celerybeat-schedule 80 | 81 | # SageMath parsed files 82 | *.sage.py 83 | 84 | # Environments 85 | .env 86 | .venv 87 | env/ 88 | venv/ 89 | ENV/ 90 | env.bak/ 91 | venv.bak/ 92 | 93 | # Spyder project settings 94 | .spyderproject 95 | .spyproject 96 | 97 | # Rope project settings 98 | .ropeproject 99 | 100 | # mkdocs documentation 101 | /site 102 | 103 | # mypy 104 | .mypy_cache/ 105 | -------------------------------------------------------------------------------- /.readthedocs.yml: -------------------------------------------------------------------------------- 1 | # .readthedocs.yml 2 | # Read the Docs configuration file 3 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details 4 | 5 | # Required 6 | version: 2 7 | 8 | # Build documentation in the docs/ directory with Sphinx 9 | sphinx: 10 | configuration: docs/conf.py 11 | 12 | # Build documentation with MkDocs 13 | #mkdocs: 14 | # configuration: mkdocs.yml 15 | 16 | # Optionally build your docs in additional formats such as PDF 17 | formats: 18 | - pdf 19 | 20 | # Optionally set the version of Python and requirements required to build your docs 21 | python: 22 | version: 3.8 23 | install: 24 | - method: pip 25 | path: . 26 | extra_requirements: 27 | - dev 28 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | Be cordial or be on your way. --Kenneth Reitz 2 | 3 | https://www.kennethreitz.org/essays/be-cordial-or-be-on-your-way 4 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributor's Guide 2 | 3 | If you're reading this, you're probably looking to contribute to nbcommands. *Time is the only real currency*, and the fact that you're considering spending some here is *very* generous of you. Thank you very much! 4 | 5 | This document will help you get started with contributing code, testing (future) and filing issues. If you have any questions, feel free to reach out to [Vinayak Mehta](https://vinayak-mehta.github.io), the author and maintainer. 6 | 7 | ## Code Of Conduct 8 | 9 | The following quote sums up the **Code Of Conduct**. 10 | 11 | > Be cordial or be on your way. --Kenneth Reitz 12 | 13 | As the [Requests Code Of Conduct](https://github.com/psf/requests/blob/master/CODE_OF_CONDUCT.md) states, **all contributions are welcome**, as long as everyone involved is treated with respect. 14 | 15 | ## Your first contribution 16 | 17 | A great way to start contributing to nbcommands is to pick an issue with the [good first issue](https://github.com/vinayak-mehta/nbcommands/labels/good%20first%20issue) label. If you're unable to find a good first issue, feel free to contact the maintainer. 18 | 19 | ## Setting up a development environment 20 | 21 | To install the dependencies needed for development, you can use pip: 22 | 23 |
24 | $ pip install conference-radar[dev] 25 |26 | 27 | Alternatively, you can clone the project repository, and install using pip: 28 | 29 |
30 | $ pip install ".[dev]" 31 |32 | 33 | ## Pull Requests 34 | 35 | ### Submit a pull request 36 | 37 | The preferred workflow for contributing to nbcommands is to fork the [project repository](https://github.com/vinayak-mehta/nbcommands) on GitHub, clone, develop on a branch and then finally submit a pull request. Here are the steps: 38 | 39 | 1. Fork the project repository. Click on the ‘Fork’ button near the top of the page. This creates a copy of the code under your account on the GitHub. 40 | 41 | 2. Clone your fork of nbcommands from your GitHub account: 42 | 43 |
44 | $ git clone https://www.github.com/[username]/nbcommands 45 |46 | 47 | 3. Create a branch to hold your changes: 48 | 49 |
50 | $ git checkout -b my-feature 51 |52 | 53 | Always branch out from `master` to work on your contribution. It's good practice to never work on the `master` branch! 54 | 55 | **Protip: `git stash` is a great way to save the work that you haven't committed yet, to move between branches.** 56 | 57 | 4. Work on your contribution. Add changed files using `git add` and then `git commit` them: 58 | 59 |
60 | $ git add modified_files 61 | $ git commit 62 |63 | 64 | 5. Finally, push them to your GitHub fork: 65 | 66 |
67 | $ git push -u origin my-feature 68 |69 | 70 | Now it's time to go to the your fork of nbcommands and create a pull request! You can [follow these instructions](https://help.github.com/articles/creating-a-pull-request-from-a-fork/) to do this. 71 | 72 | ### Work on your pull request 73 | 74 | It is recommended that your pull request complies with the following rules: 75 | 76 | - Make sure your code follows [pep8](http://pep8.org). You should [blacken](https://github.com/psf/black) your code. 77 | 78 | - Make sure your commit messages follow [the seven rules of a great git commit message](https://chris.beams.io/posts/git-commit/): 79 | - Separate subject from body with a blank line 80 | - Limit the subject line to 50 characters 81 | - Capitalize the subject line 82 | - Do not end the subject line with a period 83 | - Use the imperative mood in the subject line 84 | - Wrap the body at 72 characters 85 | - Use the body to explain what and why vs. how 86 | 87 | - Please prefix the title of your pull request with [MRG] (Ready for Merge), if the contribution is complete and ready for a detailed review. An incomplete pull request's title should be prefixed with [WIP] (to indicate a work in progress), and changed to [MRG] when it's complete. A good [task list](https://blog.github.com/2013-01-09-task-lists-in-gfm-issues-pulls-comments/) in the PR description will ensure that other people get a better idea of what it proposes to do, which will also increase collaboration. 88 | 89 | - If contributing new functionality, make sure that you add a unit test for it, while making sure that all previous tests pass. nbcommands uses [pytest](https://docs.pytest.org/en/latest/) for testing (future). Tests can be run using: 90 | 91 |
92 | $ python setup.py test 93 |94 | 95 | ## Filing Issues 96 | 97 | [GitHub issues](https://github.com/vinayak-mehta/nbcommands/issues) are used to keep track of all issues and pull requests. Before opening an issue (which asks a question or reports a bug), please use GitHub search to look for existing issues (both open and closed) that may be similar. 98 | 99 | ### Bug Reports 100 | 101 | In bug reports, make sure you include: 102 | 103 | - Your operating system type and Python version: 104 | 105 |
106 | import platform; print(platform.platform()) 107 | import sys; print('Python', sys.version) 108 |109 | 110 | - The complete traceback. Just adding the exception message or a part of the traceback won't help the maintainer fix your issue sooner. 111 | -------------------------------------------------------------------------------- /HISTORY.md: -------------------------------------------------------------------------------- 1 | Release History 2 | =============== 3 | 4 | master 5 | ------ 6 | 7 | 0.5.1 (2021-06-21) 8 | ------------------ 9 | 10 | - Minor documentation changes. 11 | 12 | 0.5.0 (2021-06-21) 13 | ------------------ 14 | 15 | **Improvements** 16 | 17 | - Support directories in nbgrep. [#26](https://github.com/vinayak-mehta/nbcommands/pull/26) by [Min RK](https://github.com/minrk). 18 | 19 | 0.4.0 (2020-08-01) 20 | ------------------ 21 | 22 | **Improvements** 23 | 24 | - [#3](https://github.com/vinayak-mehta/nbcommands/issues/3) Add nbless. [#4](https://github.com/vinayak-mehta/nbcommands/pull/4) by [Deepu Thomas Philip](https://github.com/deepu-tp). 25 | - Add Sphinx docs! 26 | 27 | **Bugfixes** 28 | 29 | - [#19](https://github.com/vinayak-mehta/nbcommands/issues/19) Fix KeyError when execution count is None. [#21](https://github.com/vinayak-mehta/nbcommands/pull/21) by Vinayak Mehta. 30 | 31 | 0.3.2 (2019-11-02) 32 | ------------------ 33 | 34 | **Bugfixes** 35 | 36 | - Fix black source check. Fix: [1d49970](https://github.com/vinayak-mehta/nbcommands/commit/1d4997076df3cd799e28cc9dcb94ef597dadd940). 37 | 38 | 0.3.1 (2019-11-02) 39 | ------------------ 40 | 41 | **Bugfixes** 42 | 43 | - [#9](https://github.com/vinayak-mehta/nbcommands/issues/9) nbblack does not ignore jupyter magic cell lines. Fix: [e8aa30b](https://github.com/vinayak-mehta/nbcommands/commit/e8aa30b7bc657d7c921eb633143b2a23a98c6901). 44 | 45 | 0.3.0 (2019-11-02) 46 | ------------------ 47 | 48 | **Improvements** 49 | 50 | - Add nbblack. ✨ 🍰 ✨ 51 | 52 | 0.2.2 (2019-11-01) 53 | ------------------ 54 | 55 |
56 | HTTPError: 400 Client Error: This filename has already been used, use a different version. See https://pypi.org/help/#file-name-reuse for url: https://upload.pypi.org/legacy/ 57 |58 | 59 | 0.2.1 (2019-11-01) 60 | ------------------ 61 | 62 | **Bugfixes** 63 | 64 | * Fix README links. 65 | 66 | 0.2.0 (2019-11-01) 67 | ------------------ 68 | 69 | **Improvements** 70 | 71 | * Add nbtouch, nbgrep, nbhead, nbtail and nbcat. 72 | 73 | 0.1.0 (2019-10-31) 74 | ------------------ 75 | 76 | * Birth! 77 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2019 Vinayak Mehta 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |
3 |
16 | $ pip install nbcommands 17 |18 | 19 | or conda: 20 | 21 |
22 | $ conda install -c conda-forge nbcommands 23 |24 | 25 | ## Usage 26 | 27 | nbcommands installs the following commands which let you interact with your Jupyter notebooks without spinning up a notebook server. 28 | 29 | - `nbtouch`: Update the access and modification times of each Jupyter notebook to the current time. 30 | 31 |
32 | $ nbtouch notebook1.ipynb notebook2.ipynb33 |  34 | 35 | - `nbgrep`: Search for a pattern in Jupyter notebooks. 36 | 37 |
38 | $ nbgrep "os" notebook1.ipynb notebook2.ipynb 39 | $ nbgrep "os" directory/40 |  41 | 42 | - `nbhead`: Print the first 5 cells of a Jupyter notebook to standard output. 43 | 44 |
45 | $ nbhead notebook1.ipynb46 |  47 | 48 | Note: You can also specify the number of cells you want to print using the `-n` option. 49 |
50 | $ nbhead -n 10 notebook1.ipynb51 | 52 | - `nbtail`: Print the last 5 cells of a Jupyter notebook to standard output. 53 | 54 |
55 | $ nbtail notebook2.ipynb56 |  57 | 58 | Note: You can also specify the number of cells you want to print using the `-n` option. 59 |
60 | $ nbtail -n 10 notebook2.ipynb61 | 62 | - `nbcat`: Concatenate Jupyter notebooks to standard output. 63 | 64 |
65 | $ nbcat notebook1.ipynb notebook2.ipynb66 |  67 | 68 | Note: You can create a new notebook by concatenating multiple notebooks using the `-o` option. 69 |
70 | $ nbcat notebook1.ipynb notebook2.ipynb -o notebook3.ipynb71 | 72 | - `nbless`: Print a Jupyter notebook using a pager program. 73 | 74 |
75 | $ nbless notebook1.ipynb76 |  77 | 78 | And some non-Unix goodness, 79 | 80 | - `nbblack`: Blacken Jupyter notebooks. 81 | 82 |
83 | $ nbblack notebook1.ipynb notebook2.ipynb84 |  85 | 86 | --- 87 | 88 | Planned enhancements: 89 | 90 | - `nbstrip`: Strip outputs from Jupyter notebooks. 91 | - `nbdiff`: Find the diff between two Jupyter notebooks. 92 | - `nbecho`: Add a code cell to a Jupyter notebook. 93 | - `nbedit`: Interactively edit a Jupyter notebook. 94 | - `nbtime`: Run and time a Jupyter notebook. 95 | - `nbwc`: Print word count for a Jupyter notebook. 96 | 97 | ## Versioning 98 | 99 | nbcommands uses [Semantic Versioning](https://semver.org/). For the available versions, see the tags on this repository. 100 | 101 | ## License 102 | 103 | This project is licensed under the Apache License, see the [LICENSE](https://raw.githubusercontent.com/vinayak-mehta/nbcommands/master/LICENSE) file for details. 104 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line, and also 5 | # from the environment for the first two. 6 | SPHINXOPTS ?= 7 | SPHINXBUILD ?= sphinx-build 8 | SOURCEDIR = . 9 | BUILDDIR = _build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 | -------------------------------------------------------------------------------- /docs/_static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vinayak-mehta/nbcommands/5bc82cf9ca5ce03d0d11524d9cd081f1bc4cd768/docs/_static/favicon.ico -------------------------------------------------------------------------------- /docs/_static/nbblack.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vinayak-mehta/nbcommands/5bc82cf9ca5ce03d0d11524d9cd081f1bc4cd768/docs/_static/nbblack.gif -------------------------------------------------------------------------------- /docs/_static/nbblack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vinayak-mehta/nbcommands/5bc82cf9ca5ce03d0d11524d9cd081f1bc4cd768/docs/_static/nbblack.png -------------------------------------------------------------------------------- /docs/_static/nbcat.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vinayak-mehta/nbcommands/5bc82cf9ca5ce03d0d11524d9cd081f1bc4cd768/docs/_static/nbcat.gif -------------------------------------------------------------------------------- /docs/_static/nbcat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vinayak-mehta/nbcommands/5bc82cf9ca5ce03d0d11524d9cd081f1bc4cd768/docs/_static/nbcat.png -------------------------------------------------------------------------------- /docs/_static/nbcommands.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vinayak-mehta/nbcommands/5bc82cf9ca5ce03d0d11524d9cd081f1bc4cd768/docs/_static/nbcommands.png -------------------------------------------------------------------------------- /docs/_static/nbgrep.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vinayak-mehta/nbcommands/5bc82cf9ca5ce03d0d11524d9cd081f1bc4cd768/docs/_static/nbgrep.gif -------------------------------------------------------------------------------- /docs/_static/nbgrep.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vinayak-mehta/nbcommands/5bc82cf9ca5ce03d0d11524d9cd081f1bc4cd768/docs/_static/nbgrep.png -------------------------------------------------------------------------------- /docs/_static/nbhead.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vinayak-mehta/nbcommands/5bc82cf9ca5ce03d0d11524d9cd081f1bc4cd768/docs/_static/nbhead.gif -------------------------------------------------------------------------------- /docs/_static/nbhead.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vinayak-mehta/nbcommands/5bc82cf9ca5ce03d0d11524d9cd081f1bc4cd768/docs/_static/nbhead.png -------------------------------------------------------------------------------- /docs/_static/nbless.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vinayak-mehta/nbcommands/5bc82cf9ca5ce03d0d11524d9cd081f1bc4cd768/docs/_static/nbless.gif -------------------------------------------------------------------------------- /docs/_static/nbtail.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vinayak-mehta/nbcommands/5bc82cf9ca5ce03d0d11524d9cd081f1bc4cd768/docs/_static/nbtail.gif -------------------------------------------------------------------------------- /docs/_static/nbtail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vinayak-mehta/nbcommands/5bc82cf9ca5ce03d0d11524d9cd081f1bc4cd768/docs/_static/nbtail.png -------------------------------------------------------------------------------- /docs/_static/nbtouch.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vinayak-mehta/nbcommands/5bc82cf9ca5ce03d0d11524d9cd081f1bc4cd768/docs/_static/nbtouch.gif -------------------------------------------------------------------------------- /docs/_static/nbtouch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vinayak-mehta/nbcommands/5bc82cf9ca5ce03d0d11524d9cd081f1bc4cd768/docs/_static/nbtouch.png -------------------------------------------------------------------------------- /docs/_templates/hacks.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/_templates/sidebarintro.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
7 | 9 |
10 | 11 |
2 |
3 |
4 |
5 |
7 | 9 |
-------------------------------------------------------------------------------- /docs/_themes/.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.pyo -------------------------------------------------------------------------------- /docs/_themes/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010 by Armin Ronacher. 2 | 3 | Some rights reserved. 4 | 5 | Redistribution and use in source and binary forms of the theme, with or 6 | without modification, are permitted provided that the following conditions 7 | are met: 8 | 9 | * Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above 13 | copyright notice, this list of conditions and the following 14 | disclaimer in the documentation and/or other materials provided 15 | with the distribution. 16 | 17 | * The names of the contributors may not be used to endorse or 18 | promote products derived from this software without specific 19 | prior written permission. 20 | 21 | We kindly ask you to only use these themes in an unmodified manner just 22 | for Flask and Flask-related products, not for unrelated projects. If you 23 | like the visual style and want to use it for your own projects, please 24 | consider making some larger changes to the themes (such as changing 25 | font faces, sizes, colors or margins). 26 | 27 | THIS THEME IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 28 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 29 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 30 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 31 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 32 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 33 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 34 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 35 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 36 | ARISING IN ANY WAY OUT OF THE USE OF THIS THEME, EVEN IF ADVISED OF THE 37 | POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /docs/_themes/flask_theme_support.py: -------------------------------------------------------------------------------- 1 | # flasky pygments style based on tango style 2 | from pygments.style import Style 3 | from pygments.token import ( 4 | Keyword, 5 | Name, 6 | Comment, 7 | String, 8 | Error, 9 | Number, 10 | Operator, 11 | Generic, 12 | Whitespace, 13 | Punctuation, 14 | Other, 15 | Literal, 16 | ) 17 | 18 | 19 | class FlaskyStyle(Style): 20 | background_color = "#f8f8f8" 21 | default_style = "" 22 | 23 | styles = { 24 | # No corresponding class for the following: 25 | # Text: "", # class: '' 26 | Whitespace: "underline #f8f8f8", # class: 'w' 27 | Error: "#a40000 border:#ef2929", # class: 'err' 28 | Other: "#000000", # class 'x' 29 | Comment: "italic #8f5902", # class: 'c' 30 | Comment.Preproc: "noitalic", # class: 'cp' 31 | Keyword: "bold #004461", # class: 'k' 32 | Keyword.Constant: "bold #004461", # class: 'kc' 33 | Keyword.Declaration: "bold #004461", # class: 'kd' 34 | Keyword.Namespace: "bold #004461", # class: 'kn' 35 | Keyword.Pseudo: "bold #004461", # class: 'kp' 36 | Keyword.Reserved: "bold #004461", # class: 'kr' 37 | Keyword.Type: "bold #004461", # class: 'kt' 38 | Operator: "#582800", # class: 'o' 39 | Operator.Word: "bold #004461", # class: 'ow' - like keywords 40 | Punctuation: "bold #000000", # class: 'p' 41 | # because special names such as Name.Class, Name.Function, etc. 42 | # are not recognized as such later in the parsing, we choose them 43 | # to look the same as ordinary variables. 44 | Name: "#000000", # class: 'n' 45 | Name.Attribute: "#c4a000", # class: 'na' - to be revised 46 | Name.Builtin: "#004461", # class: 'nb' 47 | Name.Builtin.Pseudo: "#3465a4", # class: 'bp' 48 | Name.Class: "#000000", # class: 'nc' - to be revised 49 | Name.Constant: "#000000", # class: 'no' - to be revised 50 | Name.Decorator: "#888", # class: 'nd' - to be revised 51 | Name.Entity: "#ce5c00", # class: 'ni' 52 | Name.Exception: "bold #cc0000", # class: 'ne' 53 | Name.Function: "#000000", # class: 'nf' 54 | Name.Property: "#000000", # class: 'py' 55 | Name.Label: "#f57900", # class: 'nl' 56 | Name.Namespace: "#000000", # class: 'nn' - to be revised 57 | Name.Other: "#000000", # class: 'nx' 58 | Name.Tag: "bold #004461", # class: 'nt' - like a keyword 59 | Name.Variable: "#000000", # class: 'nv' - to be revised 60 | Name.Variable.Class: "#000000", # class: 'vc' - to be revised 61 | Name.Variable.Global: "#000000", # class: 'vg' - to be revised 62 | Name.Variable.Instance: "#000000", # class: 'vi' - to be revised 63 | Number: "#990000", # class: 'm' 64 | Literal: "#000000", # class: 'l' 65 | Literal.Date: "#000000", # class: 'ld' 66 | String: "#4e9a06", # class: 's' 67 | String.Backtick: "#4e9a06", # class: 'sb' 68 | String.Char: "#4e9a06", # class: 'sc' 69 | String.Doc: "italic #8f5902", # class: 'sd' - like a comment 70 | String.Double: "#4e9a06", # class: 's2' 71 | String.Escape: "#4e9a06", # class: 'se' 72 | String.Heredoc: "#4e9a06", # class: 'sh' 73 | String.Interpol: "#4e9a06", # class: 'si' 74 | String.Other: "#4e9a06", # class: 'sx' 75 | String.Regex: "#4e9a06", # class: 'sr' 76 | String.Single: "#4e9a06", # class: 's1' 77 | String.Symbol: "#4e9a06", # class: 'ss' 78 | Generic: "#000000", # class: 'g' 79 | Generic.Deleted: "#a40000", # class: 'gd' 80 | Generic.Emph: "italic #000000", # class: 'ge' 81 | Generic.Error: "#ef2929", # class: 'gr' 82 | Generic.Heading: "bold #000080", # class: 'gh' 83 | Generic.Inserted: "#00A000", # class: 'gi' 84 | Generic.Output: "#888", # class: 'go' 85 | Generic.Prompt: "#745334", # class: 'gp' 86 | Generic.Strong: "bold #000000", # class: 'gs' 87 | Generic.Subheading: "bold #800080", # class: 'gu' 88 | Generic.Traceback: "bold #a40000", # class: 'gt' 89 | } 90 | -------------------------------------------------------------------------------- /docs/conf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # 3 | # nbcommands documentation build configuration file, created by 4 | # sphinx-quickstart on Tue Jul 19 13:44:18 2016. 5 | # 6 | # This file is execfile()d with the current directory set to its 7 | # containing dir. 8 | # 9 | # Note that not all possible configuration values are present in this 10 | # autogenerated file. 11 | # 12 | # All configuration values have a default; values that are commented out 13 | # serve to show the default. 14 | 15 | import os 16 | import sys 17 | 18 | # If extensions (or modules to document with autodoc) are in another directory, 19 | # add these directories to sys.path here. If the directory is relative to the 20 | # documentation root, use os.path.abspath to make it absolute, like shown here. 21 | # 22 | # sys.path.insert(0, os.path.abspath('..')) 23 | 24 | # Insert nbcommands's path into the system. 25 | sys.path.insert(0, os.path.abspath("..")) 26 | sys.path.insert(0, os.path.abspath("_themes")) 27 | 28 | import nbcommands 29 | 30 | 31 | # -- General configuration ------------------------------------------------ 32 | 33 | # If your documentation needs a minimal Sphinx version, state it here. 34 | # 35 | # needs_sphinx = '1.0' 36 | 37 | # Add any Sphinx extension module names here, as strings. They can be 38 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 39 | # ones. 40 | extensions = [] 41 | 42 | # Add any paths that contain templates here, relative to this directory. 43 | templates_path = ["_templates"] 44 | 45 | # The suffix(es) of source filenames. 46 | # You can specify multiple suffix as a list of string: 47 | # 48 | # source_suffix = ['.rst', '.md'] 49 | source_suffix = ".rst" 50 | 51 | # The encoding of source files. 52 | # 53 | # source_encoding = 'utf-8-sig' 54 | 55 | # The master toctree document. 56 | master_doc = "index" 57 | 58 | # General information about the project. 59 | project = u"conference-radar" 60 | copyright = u"2021, Vinayak Mehta" 61 | author = u"Vinayak Mehta" 62 | 63 | # The version info for the project you're documenting, acts as replacement for 64 | # |version| and |release|, also used in various other places throughout the 65 | # built documents. 66 | 67 | # The short X.Y version. 68 | version = nbcommands.__version__ 69 | # The full version, including alpha/beta/rc tags. 70 | release = nbcommands.__version__ 71 | 72 | # The language for content autogenerated by Sphinx. Refer to documentation 73 | # for a list of supported languages. 74 | # 75 | # This is also used if you do content translation via gettext catalogs. 76 | # Usually you set "language" from the command line for these cases. 77 | language = None 78 | 79 | # There are two options for replacing |today|: either, you set today to some 80 | # non-false value, then it is used: 81 | # 82 | # today = '' 83 | # 84 | # Else, today_fmt is used as the format for a strftime call. 85 | # 86 | # today_fmt = '%B %d, %Y' 87 | 88 | # List of patterns, relative to source directory, that match files and 89 | # directories to ignore when looking for source files. 90 | # This patterns also effect to html_static_path and html_extra_path 91 | exclude_patterns = ["_build"] 92 | 93 | # The reST default role (used for this markup: `text`) to use for all 94 | # documents. 95 | # 96 | # default_role = None 97 | 98 | # If true, '()' will be appended to :func: etc. cross-reference text. 99 | add_function_parentheses = True 100 | 101 | # If true, the current module name will be prepended to all description 102 | # unit titles (such as .. function::). 103 | add_module_names = True 104 | 105 | # If true, sectionauthor and moduleauthor directives will be shown in the 106 | # output. They are ignored by default. 107 | # 108 | # show_authors = False 109 | 110 | # The name of the Pygments (syntax highlighting) style to use. 111 | pygments_style = "flask_theme_support.FlaskyStyle" 112 | 113 | # A list of ignored prefixes for module index sorting. 114 | # modindex_common_prefix = [] 115 | 116 | # If true, keep warnings as "system message" paragraphs in the built documents. 117 | # keep_warnings = False 118 | 119 | # If true, `todo` and `todoList` produce output, else they produce nothing. 120 | todo_include_todos = True 121 | 122 | 123 | # -- Options for HTML output ---------------------------------------------- 124 | 125 | # The theme to use for HTML and HTML Help pages. See the documentation for 126 | # a list of builtin themes. 127 | html_theme = "alabaster" 128 | 129 | # Theme options are theme-specific and customize the look and feel of a theme 130 | # further. For a list of options available for each theme, see the 131 | # documentation. 132 | html_theme_options = { 133 | "show_powered_by": False, 134 | "github_user": "vinayak-mehta", 135 | "github_repo": "nbcommands", 136 | "github_banner": True, 137 | "show_related": False, 138 | "note_bg": "#FFF59C", 139 | } 140 | 141 | # Add any paths that contain custom themes here, relative to this directory. 142 | # html_theme_path = [] 143 | 144 | # The name for this set of Sphinx documents. 145 | # "