Skip to content

Setup fails with too-old identify: "Type tag 'jupyter' is not recognized" #3698

@jameslamb

Description

@jameslamb

search you tried in the issue tracker

identify jupyter

describe your issue

Stumbled on this in an environment that happened to have identify 1.1.x, but it's reproducible as follows.

From the root of https://github.com/jameslamb/pydistcheck, run

$ python -m venv .venv
$ source .venv/bin/activate
$ python -m pip install 'pre-commit>=4.6.0' 'identify==1.0.0'
$ pre-commit run --all-files
An error has occurred: InvalidConfigError: 
==> File .pre-commit-config.yaml
==> At Config()
==> At key: repos
==> At Repository(repo='https://github.com/astral-sh/ruff-pre-commit')
==> At key: hooks
==> At Hook(id='ruff-format')
==> At key: types_or
==> At index 1
=====> Type tag 'jupyter' is not recognized.  Try upgrading identify and pre-commit?
Check the log at /Users/jlamb/.cache/pre-commit/pre-commit.log

Looks like jupyter support was added in identify==1.4.20: pre-commit/identify#111

That works:

$ python -m pip install 'identify==1.4.20'
$ pre-commit run --all-files
check for added large files..............................................Passed
check for broken symlinks............................(no files to check)Skipped
check toml...............................................................Passed
detect destroyed symlinks................................................Passed
fix end of files.........................................................Passed
trim trailing whitespace.................................................Passed
ruff (legacy alias)......................................................Passed
ruff format..............................................................Passed

pre-commit --version

pre-commit 4.6.0

.pre-commit-config.yaml

---
repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v6.0.0
    hooks:
      - id: check-added-large-files
      - id: check-symlinks
      - id: check-toml
      - id: destroyed-symlinks
      - id: end-of-file-fixer
      - id: trailing-whitespace
  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: v0.15.9
    hooks:
      - id: ruff
        args: ["--config", "pyproject.toml"]
      - id: ruff-format
        args: ["--config", "pyproject.toml"]

~/.cache/pre-commit/pre-commit.log (if present)

version information

pre-commit version: 4.6.0
git --version: git version 2.47.1
sys.version:
    3.12.8 | packaged by conda-forge | (main, Dec  5 2024, 14:19:53) [Clang 18.1.8 ]
sys.executable: /Users/jlamb/repos/pydistcheck/.venv/bin/python
os.name: posix
sys.platform: darwin

error information

An error has occurred: InvalidConfigError: 
==> File .pre-commit-config.yaml
==> At Config()
==> At key: repos
==> At Repository(repo='https://github.com/astral-sh/ruff-pre-commit')
==> At key: hooks
==> At Hook(id='ruff-format')
==> At key: types_or
==> At index 1
=====> Type tag 'jupyter' is not recognized.  Try upgrading identify and pre-commit?
Traceback (most recent call last):
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/pre_commit/error_handler.py", line 73, in error_handler
    yield
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/pre_commit/main.py", line 429, in main
    return run(args.config, store, args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/pre_commit/commands/run.py", line 423, in run
    config = load_config(config_file)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 433, in load_from_filename
    with reraise_as(exc_tp):
         ^^^^^^^^^^^^^^^^^^
  File "/Users/jlamb/miniforge3/lib/python3.12/contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 45, in reraise_as
    raise tp(e).with_traceback(tb) from None
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 42, in reraise_as
    yield
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 437, in load_from_filename
    with validate_context(f'File {display_filename}'):
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jlamb/miniforge3/lib/python3.12/contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 36, in validate_context
    raise ValidationError(e, ctx=msg).with_traceback(tb) from None
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 33, in validate_context
    yield
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 449, in load_from_filename
    validate(data, schema)
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 412, in validate
    schema.check(v)
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 244, in check
    with validate_context(context):
         ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jlamb/miniforge3/lib/python3.12/contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 36, in validate_context
    raise ValidationError(e, ctx=msg).with_traceback(tb) from None
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 33, in validate_context
    yield
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 246, in check
    item.check(v)
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 75, in _check_required
    _check_optional(self, dct)
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 55, in _check_optional
    with validate_context(f'At key: {self.key}'):
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jlamb/miniforge3/lib/python3.12/contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 36, in validate_context
    raise ValidationError(e, ctx=msg).with_traceback(tb) from None
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 33, in validate_context
    yield
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 56, in _check_optional
    self.check_fn(dct[self.key])
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 81, in check_fn
    validate(val, self.schema)
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 412, in validate
    schema.check(v)
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 308, in check
    validate(val, self.of)
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 412, in validate
    schema.check(v)
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 244, in check
    with validate_context(context):
         ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jlamb/miniforge3/lib/python3.12/contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 36, in validate_context
    raise ValidationError(e, ctx=msg).with_traceback(tb) from None
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 33, in validate_context
    yield
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 246, in check
    item.check(v)
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 108, in _check_conditional
    inner(self, dct)
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 75, in _check_required
    _check_optional(self, dct)
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 55, in _check_optional
    with validate_context(f'At key: {self.key}'):
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jlamb/miniforge3/lib/python3.12/contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 36, in validate_context
    raise ValidationError(e, ctx=msg).with_traceback(tb) from None
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 33, in validate_context
    yield
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 56, in _check_optional
    self.check_fn(dct[self.key])
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 81, in check_fn
    validate(val, self.schema)
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 412, in validate
    schema.check(v)
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 308, in check
    validate(val, self.of)
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 412, in validate
    schema.check(v)
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 244, in check
    with validate_context(context):
         ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jlamb/miniforge3/lib/python3.12/contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 36, in validate_context
    raise ValidationError(e, ctx=msg).with_traceback(tb) from None
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 33, in validate_context
    yield
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 246, in check
    item.check(v)
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 55, in _check_optional
    with validate_context(f'At key: {self.key}'):
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jlamb/miniforge3/lib/python3.12/contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 36, in validate_context
    raise ValidationError(e, ctx=msg).with_traceback(tb) from None
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 33, in validate_context
    yield
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 56, in _check_optional
    self.check_fn(dct[self.key])
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 399, in check_array_fn
    with validate_context(f'At index {i}'):
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jlamb/miniforge3/lib/python3.12/contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 36, in validate_context
    raise ValidationError(e, ctx=msg).with_traceback(tb) from None
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 33, in validate_context
    yield
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/cfgv.py", line 400, in check_array_fn
    inner_check(val)
  File "/Users/jlamb/repos/pydistcheck/.venv/lib/python3.12/site-packages/pre_commit/clientlib.py", line 44, in check_type_tag
    raise cfgv.ValidationError(
pre_commit.clientlib.InvalidConfigError: 
==> File .pre-commit-config.yaml
==> At Config()
==> At key: repos
==> At Repository(repo='https://github.com/astral-sh/ruff-pre-commit')
==> At key: hooks
==> At Hook(id='ruff-format')
==> At key: types_or
==> At index 1
=====> Type tag 'jupyter' is not recognized.  Try upgrading identify and pre-commit?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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