{ "info": { "author": "Sebastian Weigand", "author_email": "s.weigand.phy@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Framework :: Flake8", "Framework :: Jupyter", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: Quality Assurance" ], "description": "# flake8-nb\n\n[](https://pypi.org/project/flake8-nb/)\n[](https://anaconda.org/conda-forge/flake8-nb)\n[](https://pypi.org/project/flake8-nb/)\n[](https://github.com/pre-commit/pre-commit)\n[](https://opensource.org/licenses/Apache-2.0)\n\n[](https://github.com/s-weigand/flake8-nb/actions)\n[](https://flake8-nb.readthedocs.io/en/latest/?badge=latest)\n[](https://codecov.io/gh/s-weigand/flake8-nb)\n[](https://github.com/s-weigand/flake8-nb)\n\n[](https://www.codacy.com/manual/s.weigand.phy/flake8-nb?utm_source=github.com&utm_medium=referral&utm_content=s-weigand/flake8-nb&utm_campaign=Badge_Grade)\n[](#contributors)\n[](https://github.com/psf/black)\n[](https://mybinder.org/v2/gh/s-weigand/flake8-nb.git/main?urlpath=lab%2Ftree%2Ftests%2Fdata%2Fnotebooks)\n\n[`flake8`](https://gitlab.com/pycqa/flake8) checking for jupyter notebooks.\nBasically this is a hack on the `flake8`'s `Application` class,\nwhich adds parsing and a cell based formatter for `*.ipynb` files.\n\nThis is **NOT A PLUGIN** but a stand alone CLI tool/[pre-commit](https://pre-commit.com/) hook to be used instead of the `flake8` command/hook.\n\n## Features\n\n- flake8 CLI tests for jupyter notebooks\n- Full base functionality of `flake8` and its plugins\n- Input cell based error formatting (Execution count/code cell count/total cellcount)\n- Report fine tuning with cell-tags (`flake8-noqa-tags` see [usage](https://flake8-nb.readthedocs.io/en/latest/usage.html#cell-tags))\n- [pre-commit](https://pre-commit.com/) hook\n\n## Examples\n\n## Default reporting\n\nIf you had a notebook with name `example_notebook.ipynb`, where the code cell\nwhich was executed as 34th cell (`In[34]`) had the following code:\n\n```python\nbad_formatted_dict = {\"missing\":\"space\"}\n```\n\nrunning `flake8_nb` would result in the following output.\n\n### Execution count\n\n```bash\n$ flake8_nb example_notebook.ipynb\nexample_notebook.ipynb#In[34]:1:31: E231 missing whitespace after ':'\n```\n\n## Custom reporting\n\nIf you prefer the reports to show the cell number rather then the execution count you\ncan use the `--notebook-cell-format` option, given that the cell is the 5th `code` cell\nand 10th total cell (taking `raw` and `markdown` cells into account),\nyou will get the following output.\n\n### Code cell count\n\n```bash\n$ flake8_nb --notebook-cell-format '{nb_path}:code_cell#{code_cell_count}' example_notebook.ipynb\nexample_notebook.ipynb:code_cell#5:1:31: E231 missing whitespace after ':'\n```\n\n### Total cell count\n\n```bash\n$ flake8_nb --notebook-cell-format '{nb_path}:cell#{total_cell_count}' example_notebook.ipynb\nexample_notebook.ipynb:cell#10:1:31: E231 missing whitespace after ':'\n```\n\n## Contributors \u2728\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\n\n\n