{"id":14977169,"url":"https://github.com/chrisjsewell/pytest-notebook","last_synced_at":"2025-04-04T16:10:45.310Z","repository":{"id":35057169,"uuid":"200959165","full_name":"chrisjsewell/pytest-notebook","owner":"chrisjsewell","description":"A pytest plugin for regression testing and regenerating Jupyter Notebooks","archived":false,"fork":false,"pushed_at":"2025-03-24T20:30:00.000Z","size":3951,"stargazers_count":52,"open_issues_count":27,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-25T05:35:05.309Z","etag":null,"topics":["coverage","ipython-notebook","jupyter","jupyter-notebook","nbdime","notebook","pytest","pytest-plugin","python"],"latest_commit_sha":null,"homepage":"https://pytest-notebook.readthedocs.io","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chrisjsewell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-07T02:43:36.000Z","updated_at":"2025-03-19T14:01:52.000Z","dependencies_parsed_at":"2023-02-19T15:16:29.129Z","dependency_job_id":"47f80434-eddb-423c-806b-d4acfc9601f1","html_url":"https://github.com/chrisjsewell/pytest-notebook","commit_stats":{"total_commits":87,"total_committers":9,"mean_commits":9.666666666666666,"dds":"0.24137931034482762","last_synced_commit":"94e86f4157d41442f1ae3606ccb09b3193b88835"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisjsewell%2Fpytest-notebook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisjsewell%2Fpytest-notebook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisjsewell%2Fpytest-notebook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisjsewell%2Fpytest-notebook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chrisjsewell","download_url":"https://codeload.github.com/chrisjsewell/pytest-notebook/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247208142,"owners_count":20901570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coverage","ipython-notebook","jupyter","jupyter-notebook","nbdime","notebook","pytest","pytest-plugin","python"],"created_at":"2024-09-24T13:55:14.098Z","updated_at":"2025-04-04T16:10:45.271Z","avatar_url":"https://github.com/chrisjsewell.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pytest-notebook\n\n[![CI][ci-badge]][ci-link]\n[![Coverage][cov-badge]][cov-link]\n[![RTD][rtd-badge]][rtd-link]\n[![PyPI][pypi-badge]][pypi-link]\n[![Conda][conda-badge]][conda-link]\n[![Code style: black][black-badge]][black-link]\n\nA [pytest](https://github.com/pytest-dev/pytest) plugin for regression testing and regenerating [Jupyter Notebooks](https://jupyter.org/).\n\n![Example Test](pytest-notebook-screenshot.png)\n\n------------------------------------------------------------------------\n\n## Purpose\n\nThe purpose of the plugin is to ensure that changes to the python\nenvironment (e.g. updating packages), have not affected the outputs\nof the notebook. If the notebook has changed, this plugin can also\nregenerate the notebooks, saving the new outputs.\n\n## Features\n\n- Recognise, collect, execute (optionally output) then diff input vs. output [Jupyter Notebooks](https://jupyter.org/).\n- Provides clear and colorized diffs of the notebooks (using [nbdime](https://nbdime.readthedocs.io))\n- Regenerate failing notebooks.\n- Integration with [coverage](https://coverage.readthedocs.io) and [pytest_cov](https://pytest-cov.readthedocs.io).\n\n- A well defined API allows notebook regression tests to be run:\n\n    1. Using the pytest test collection architecture.\n    2. As a pytest fixtures (`nb_regression.check(filename)`).\n    3. Using the `pytest_notebook` python package.\n\n- All stages are highly configurable *via*:\n\n    1. The pytest command-line interface.\n    2. The pytest configuration file.\n    3. The notebook and cell level metadata.\n\n- Post-processor plugin entry-points, allow for customisable modifications of the notebook,\n  including source code formatting with [black](https://github.com/ambv/black)\n\n![Configuration Examples](docs/source/_static/collaged_in_out.png)\n\n## Installation\n\nTo install from [Conda](https://docs.conda.io) (recommended):\n\n```shell\nconda install -c conda-forge pytest-notebook\n```\n\nTo install *via* [pip](https://pypi.org/project/pip/) from [PyPI](https://pypi.org/project):\n\n```shell\npip install pytest-notebook\n```\n\nTo install the development version:\n\n```shell\ngit clone https://github.com/chrisjsewell/pytest-notebook .\ncd pytest-notebook\npip install --upgrade pip\npip install -e .\n# pip install -e .[code_style,testing,docs] # install extras for more features\n```\n\n## Usage\n\nSee the documentation at: http://pytest-notebook.readthedocs.io/\n\nIf you want to test some sample notebooks, add the `--nb-test-files` flag:\n\n```shell\ngit clone https://github.com/chrisjsewell/pytest-notebook\ncd pytest-notebook/examples\npip install pytest ipykernel pytest-notebook\npytest --nb-test-files *.ipynb\n```\n\nYou should see `success.ipynb` passed the test and `fail.ipynb` failed the test.\n\nYou can regenerate the outputs of `fail.ipynb` with the `--nb-force-regen` flag:\n\n```shell\npytest --nb-test-files --nb-force-regen *.ipynb\n```\n\n## Contributing\n\nContributions are very welcome.\n\nThe following will discover and run all unit test:\n\n```shell\npip install -e .[testing]\npytest -v\n```\n\n### Coding Style Requirements\n\nThe code style is tested using [flake8](http://flake8.pycqa.org),\nwith the configuration set in `.flake8`,\nand code should be formatted with [black](https://github.com/ambv/black).\n\nInstalling with `pytest-notebook[code_style]` makes the [pre-commit](https://pre-commit.com/)\npackage available, which will ensure these tests are passed by reformatting the code\nand testing for lint errors before submitting a commit.\nIt can be setup by:\n\n```shell\ncd pytest-notebook\npre-commit install\n```\n\nOptionally you can run `black` and `flake8` separately:\n\n```shell\nblack .\nflake8 .\n```\n\nEditors like VS Code also have automatic code reformat utilities, which can adhere to this standard.\n\n## License\n\nDistributed under the terms of the [BSD-3](http://opensource.org/licenses/BSD-3-Clause) license,\n`pytest-notebook` is free and open source software.\n\n## Issues\n\nIf you encounter any problems, please [file an issue](https://github.com/chrisjsewell/pytest-notebook/issues) along with a detailed description.\n\n## Acknowledgements\n\n- [nbdime](https://nbdime.readthedocs.io)\n- [nbval](https://github.com/computationalmodelling/nbval)\n\n[ci-badge]: https://github.com/chrisjsewell/pytest-notebook/workflows/continuous-integration/badge.svg?branch=master\n[ci-link]: https://github.com/chrisjsewell/pytest-notebook\n[cov-badge]:https://codecov.io/gh/chrisjsewell/pytest-notebook/branch/master/graph/badge.svg\n[cov-link]: https://codecov.io/gh/chrisjsewell/pytest-notebook\n[rtd-badge]: https://readthedocs.org/projects/pytest-notebook/badge\n[rtd-link]: http://pytest-notebook.readthedocs.io/\n[pypi-badge]: https://img.shields.io/pypi/v/pytest-notebook.svg\n[pypi-link]: https://pypi.org/project/pytest-notebook\n[conda-badge]: https://anaconda.org/conda-forge/pytest-notebook/badges/version.svg\n[conda-link]: https://anaconda.org/conda-forge/pytest-notebook\n[black-badge]: https://img.shields.io/badge/code%20style-black-000000.svg\n[black-link]: https://github.com/ambv/black\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisjsewell%2Fpytest-notebook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrisjsewell%2Fpytest-notebook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisjsewell%2Fpytest-notebook/lists"}