Skip to content

Mirrored pre-commit hook does not reformat notebooks #3835

Description

@brianhou

I've been using the black-jupyter pre-commit hook and was trying to update to the pre-commit mirror documented in #3828. However, the mirrored hook does not seem to reformat any files.

Describe the bug

To Reproduce

test.ipynb.txt (rename to remove the .txt extension)

With this entry in my .pre-commit-config.yaml and Jupyter notebook test.ipynb, running pre-commit run --hook-stage manual black-jupyter --files=test.ipynb does not reformat the notebook.

  - repo: https://github.com/psf/black-pre-commit-mirror
    rev: "23.7.0"
    hooks:
      - id: black-jupyter
        args:
          - --include='\.ipynb'
        stages: [manual]
        types_or: [jupyter]

With this entry in my .pre-commit-config.yaml and the same test.ipynb, running pre-commit run --hook-stage manual black-jupyter --files=test.ipynb does reformat the notebook.

  - repo: https://github.com/psf/black
    rev: "23.7.0"
    hooks:
      - id: black-jupyter
        args:
          - --include='\.ipynb'
        stages: [manual]
        types_or: [jupyter]

Expected behavior

The black-jupyter hook from the pre-commit mirror should reformat Jupyter notebooks.

Environment

  • Black's version: 23.7.0
  • OS and Python version: macOS, Python 3.10.5

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    T: bugSomething isn't working

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions