# -*- coding: utf-8 -*-
from setuptools import setup

package_dir = \
{'': 'src'}

packages = \
['nb_clean']

package_data = \
{'': ['*']}

install_requires = \
['nbformat>=5.1.2,<6.0.0']

entry_points = \
{'console_scripts': ['nb-clean = nb_clean.cli:main']}

setup_kwargs = {
    'name': 'nb-clean',
    'version': '2.4.0',
    'description': 'Clean Jupyter notebooks for versioning',
    'long_description': '<p align="center"><img src="images/nb-clean.png" width=300></p>\n\n[![Licence](https://img.shields.io/github/license/srstevenson/nb-clean?label=Licence&color=blue)](https://github.com/srstevenson/nb-clean/blob/main/LICENCE)\n[![GitHub release](https://img.shields.io/github/v/release/srstevenson/nb-clean?label=GitHub)](https://github.com/srstevenson/nb-clean)\n[![PyPI version](https://img.shields.io/pypi/v/nb-clean?label=PyPI)](https://pypi.org/project/nb-clean/)\n[![Python versions](https://img.shields.io/pypi/pyversions/nb-clean?label=Python)](https://pypi.org/project/nb-clean/)\n[![CI status](https://github.com/srstevenson/nb-clean/workflows/CI/badge.svg)](https://github.com/srstevenson/nb-clean/actions)\n[![Coverage](https://img.shields.io/codecov/c/gh/srstevenson/nb-clean?label=Coverage)](https://app.codecov.io/gh/srstevenson/nb-clean)\n\n`nb-clean` cleans Jupyter notebooks of cell execution counts, metadata, outputs,\nand (optionally) empty cells, preparing them for committing to version control.\nIt provides both a Git filter and pre-commit hook to automatically clean\nnotebooks before they\'re staged, and can also be used with other version control\nsystems, as a command line tool, and as a Python library. It can determine if a\nnotebook is clean or not, which can be used as a check in your continuous\nintegration pipelines.\n\n:warning: _`nb-clean` 2.0.0 introduced a new command line interface to make\ncleaning notebooks in place easier. If you upgrade from a previous release,\nyou\'ll need to migrate to the new interface as described under\n[Migrating to `nb-clean` 2](#migrating-to-nb-clean-2)._\n\n## Installation\n\nTo install the latest release from [PyPI], use [pip]:\n\n```bash\npython3 -m pip install nb-clean\n```\n\n`nb-clean` can also be installed with [Conda]:\n\n```bash\nconda install -c conda-forge nb-clean\n```\n\nIn Python projects using [Poetry] or [Pipenv] for dependency management, add\n`nb-clean` as a development dependency with `poetry add --dev nb-clean` or\n`pipenv install --dev nb-clean`. `nb-clean` requires Python 3.7 or later.\n\n## Usage\n\n### Checking\n\nYou can check if a notebook is clean with:\n\n```bash\nnb-clean check notebook.ipynb\n```\n\nor by passing the notebook contents on standard input:\n\n```bash\nnb-clean check < notebook.ipynb\n```\n\nTo also check for empty cells, add the `-e`/`--remove-empty-cells` flag. To\nignore cell metadata, add the `-m`/`--preserve-cell-metadata` flag, optionally\nwith a selection of metadata fields to ignore. To ignore cell outputs, add the\n`-o`/`--preserve-cell-outputs` flag.\n\n`nb-clean` will exit with status code 0 if the notebook is clean, and status\ncode 1 if it is not. `nb-clean` will also print details of cell execution\ncounts, metadata, outputs, and empty cells it finds.\n\n### Cleaning (interactive)\n\nYou can clean a Jupyter notebook with:\n\n```bash\nnb-clean clean notebook.ipynb\n```\n\nThis cleans the notebook in place. You can also pass the notebook content on\nstandard input, in which case the cleaned notebook is written to standard\noutput:\n\n```bash\nnb-clean clean < original.ipynb > cleaned.ipynb\n```\n\nTo also remove empty cells, add the `-e`/`--remove-empty-cells` flag. To\npreserve cell metadata, add the `-m`/`--preserve-cell-metadata` flag, optionally\nwith a selection of metadata fields to preserve. To preserve cell outputs, add\nthe `-o`/`--preserve-cell-outputs` flag.\n\n### Cleaning (Git filter)\n\nTo add a filter to an existing Git repository to automatically clean notebooks\nwhen they\'re staged, run the following from the working tree:\n\n```bash\nnb-clean add-filter\n```\n\nThis will configure a filter to remove cell execution counts, metadata, and\noutputs. To also remove empty cells, use:\n\n```bash\nnb-clean add-filter --remove-empty-cells\n```\n\nTo preserve cell metadata, such as that required by tools such as [papermill],\nuse:\n\n```bash\nnb-clean add-filter --preserve-cell-metadata\n```\n\nTo preserve only specific cell metadata, e.g., `tags` and `special`, use:\n\n```bash\nnb-clean add-filter --preserve-cell-metadata tags special\n```\n\nTo preserve cell outputs, use:\n\n```bash\nnb-clean add-filter --preserve-cell-outputs\n```\n\n`nb-clean` will configure a filter in the Git repository in which it is run, and\nwon\'t mutate your global or system Git configuration. To remove the filter, run:\n\n```bash\nnb-clean remove-filter\n```\n\n### Cleaning (pre-commit hook)\n\n`nb-clean` can also be used as a [pre-commit] hook. You may prefer this to the\nGit filter if your project already uses the pre-commit framework.\n\nNote that the Git filter and pre-commit hook work differently, with different\neffects on your working directory. The pre-commit hook operates on the notebook\non disk, cleaning the copy in your working directory. The Git filter cleans\nnotebooks as they are added to the index, leaving the copy in your working\ndirectory dirty. This means cell outputs are still visible to you in your local\nJupyter instance when using the Git filter, but not when using the pre-commit\nhook.\n\nAfter installing [pre-commit], add the `nb-clean` hook by adding the following\nsnippet to `.pre-commit-config.yaml` in the root of your repository:\n\n```yaml\nrepos:\n  - repo: https://github.com/srstevenson/nb-clean\n    rev: "2.4.0"\n    hooks:\n      - id: nb-clean\n```\n\nYou can pass additional arguments to `nb-clean` with an `args` array. The\nfollowing example shows how to preserve only two specific metadata fields. Note\nthat, in the example, the final item `--` in the arg list is mandatory. The\noption `--preserve-cell-metadata` may take an arbitrary number of field\narguments, and the `--` argument is needed to separate them from notebook\nfilenames, which `pre-commit` will append to the list of arguments.\n\n```yaml\nrepos:\n  - repo: https://github.com/srstevenson/nb-clean\n    rev: "2.4.0"\n    hooks:\n      - id: nb-clean\n        args:\n          - --remove-empty-cells\n          - --preserve-cell-metadata\n          - tags\n          - slideshow\n          - --\n```\n\nRun `pre-commit install` to ensure the hook is installed, and\n`pre-commit autoupdate` to update the hook to the latest release of `nb-clean`.\n\n### Preserving all nbformat metadata\n\nTo ignore or preserve specifically the metadata defined in the\n[`nbformat` documentation](https://nbformat.readthedocs.io/en/latest/format_description.html#cell-metadata),\nuse the following options:\n`--preserve-cell-metadata collapsed scrolled deletable editable format name tags jupyter execution`.\n\n### Migrating to `nb-clean` 2\n\nThe following table maps from the command line interface of `nb-clean` 1.6.0 to\nthat of `nb-clean` 2.4.0.\n\n| Description                                                  | `nb-clean` 1.6.0                                                    | `nb-clean` 2.4.0                                                         |\n| ------------------------------------------------------------ | ------------------------------------------------------------------- | ------------------------------------------------------------------------ |\n| Clean notebook                                               | `nb-clean clean -i/--input notebook.ipynb \\| sponge notebook.ipynb` | `nb-clean clean notebook.ipynb`                                          |\n| Clean notebook (remove empty cells)                          | `nb-clean clean -i/--input notebook.ipynb -e/--remove-empty`        | `nb-clean clean notebook.ipynb -e/--remove-empty-cells`                  |\n| Clean notebook (preserve cell metadata)                      | `nb-clean clean -i/--input notebook.ipynb -m/--preserve-metadata`   | `nb-clean clean notebook.ipynb -m/--preserve-cell-metadata`              |\n| Clean notebook (preserve `tags` and `special` cell metadata) |                                                                     | `nb-clean clean notebook.ipynb -m/--preserve-cell-metadata tags special` |\n| Clean notebook (preserve cell outputs)                       |                                                                     | `nb-clean clean notebook.ipynb -o/--preserve-cell-outputs`               |\n| Check notebook                                               | `nb-clean check -i/--input notebook.ipynb`                          | `nb-clean check notebook.ipynb`                                          |\n| Check notebook (ignore non-empty cells)                      | `nb-clean check -i/--input notebook.ipynb -e/--remove-empty`        | `nb-clean check notebook.ipynb -e/--remove-empty-cells`                  |\n| Check notebook (ignore cell metadata)                        | `nb-clean check -i/--input notebook.ipynb -m/--preserve-metadata`   | `nb-clean check notebook.ipynb -m/--preserve-cell-metadata`              |\n| Check notebook (ignore `tags` and `special` cell metadata)   |                                                                     | `nb-clean check notebook.ipynb -m/--preserve-cell-metadata tags special` |\n| Check notebook (ignore cell outputs)                         |                                                                     | `nb-clean check notebook.ipynb -o/--preserve-cell-outputs`               |\n| Add Git filter to clean notebooks                            | `nb-clean configure-git`                                            | `nb-clean add-filter`                                                    |\n| Remove Git filter                                            | `nb-clean unconfigure-git`                                          | `nb-clean remove-filter`                                                 |\n\n## Copyright\n\nCopyright © 2017-2022 [Scott Stevenson].\n\n`nb-clean` is distributed under the terms of the [ISC licence].\n\n[conda]: https://docs.conda.io/\n[isc licence]: https://opensource.org/licenses/ISC\n[papermill]: https://papermill.readthedocs.io/\n[pip]: https://pip.pypa.io/\n[pipenv]: https://pipenv.readthedocs.io/\n[poetry]: https://python-poetry.org/\n[pre-commit]: https://pre-commit.com/\n[pypi]: https://pypi.org/project/nb-clean/\n[scott stevenson]: https://scott.stevenson.io\n',
    'author': 'Scott Stevenson',
    'author_email': 'scott@stevenson.io',
    'maintainer': 'None',
    'maintainer_email': 'None',
    'url': 'https://github.com/srstevenson/nb-clean',
    'package_dir': package_dir,
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'entry_points': entry_points,
    'python_requires': '>=3.7,<4.0',
}


setup(**setup_kwargs)
