Skip to content

click 8.3.0 is crashing hatch run #2050

@adrianlyjak

Description

@adrianlyjak

Presumably something about the click 8.3.0 release broke hatch run.

Reproduction: https://github.com/adrianlyjak/repro

or manually

uv init hatchdead
cd hatchdead
uv add hatch --dev
uv run hatch run help

errors

(test-proj) [14:41:32] ~/dev/hatchdead $ uv run hatch run help
warning: `VIRTUAL_ENV=/Users/adrianlyjak/dev/template-document-qa/test-proj/.venv` does not match the project environment path `.venv` and will be ignored; use `--active` to target the active environment instead
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /Users/adrianlyjak/dev/hatchdead/.venv/lib/python3.13/site-packages/hatch/cli/__init__.py:221 in │
│ main                                                                                             │
│                                                                                                  │
│   218                                                                                            │
│   219 def main():  # no cov                                                                      │
│   220 │   try:                                                                                   │
│ ❱ 221 │   │   hatch(prog_name='hatch', windows_expand_args=False)                                │
│   222 │   except Exception:  # noqa: BLE001                                                      │
│   223 │   │   import sys                                                                         │
│   224                                                                                            │
│                                                                                                  │
│ /Users/adrianlyjak/dev/hatchdead/.venv/lib/python3.13/site-packages/click/core.py:1462 in        │
│ __call__                                                                                         │
│                                                                                                  │
│ /Users/adrianlyjak/dev/hatchdead/.venv/lib/python3.13/site-packages/click/core.py:1383 in main   │
│                                                                                                  │
│ /Users/adrianlyjak/dev/hatchdead/.venv/lib/python3.13/site-packages/click/core.py:1850 in invoke │
│                                                                                                  │
│ /Users/adrianlyjak/dev/hatchdead/.venv/lib/python3.13/site-packages/click/core.py:1246 in invoke │
│                                                                                                  │
│ /Users/adrianlyjak/dev/hatchdead/.venv/lib/python3.13/site-packages/click/core.py:814 in invoke  │
│                                                                                                  │
│ /Users/adrianlyjak/dev/hatchdead/.venv/lib/python3.13/site-packages/click/decorators.py:34 in    │
│ new_func                                                                                         │
│                                                                                                  │
│ /Users/adrianlyjak/dev/hatchdead/.venv/lib/python3.13/site-packages/hatch/cli/run/__init__.py:14 │
│ 7 in run                                                                                         │
│                                                                                                  │
│   144 │   elif not env_name:                                                                     │
│   145 │   │   env_name = 'system'                                                                │
│   146 │                                                                                          │
│ ❱ 147 │   ctx.invoke(                                                                            │
│   148 │   │   run_command,                                                                       │
│   149 │   │   args=[command, *final_args],                                                       │
│   150 │   │   env_names=[env_name],                                                              │
│                                                                                                  │
│ /Users/adrianlyjak/dev/hatchdead/.venv/lib/python3.13/site-packages/click/core.py:814 in invoke  │
│                                                                                                  │
│ /Users/adrianlyjak/dev/hatchdead/.venv/lib/python3.13/site-packages/click/decorators.py:46 in    │
│ new_func                                                                                         │
│                                                                                                  │
│ /Users/adrianlyjak/dev/hatchdead/.venv/lib/python3.13/site-packages/hatch/cli/env/run.py:123 in  │
│ run                                                                                              │
│                                                                                                  │
│   120 │   if filter_json:                                                                        │
│   121 │   │   import json                                                                        │
│   122 │   │                                                                                      │
│ ❱ 123 │   │   filter_data = json.loads(filter_json)                                              │
│   124 │   │   if not isinstance(filter_data, dict):                                              │
│   125 │   │   │   app.abort('The --filter/-f option must be a JSON mapping')                     │
│   126                                                                                            │
│                                                                                                  │
│ /Users/adrianlyjak/.local/share/uv/python/cpython-3.13.3-macos-aarch64-none/lib/python3.13/json/ │
│ __init__.py:339 in loads                                                                         │
│                                                                                                  │
│   336 │   │   │   │   │   │   │   │     s, 0)                                                    │
│   337 │   else:                                                                                  │
│   338 │   │   if not isinstance(s, (bytes, bytearray)):                                          │
│ ❱ 339 │   │   │   raise TypeError(f'the JSON object must be str, bytes or bytearray, '           │
│   340 │   │   │   │   │   │   │   f'not {s.__class__.__name__}')                                 │
│   341 │   │   s = s.decode(detect_encoding(s), 'surrogatepass')                                  │
│   342                                                                                            │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: the JSON object must be str, bytes or bytearray, not Sentinel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions