pypa/hatch

"env show --json" fails with an error if some plugin is not installed

Open

#2011 opened on Jun 24, 2025

View on GitHub
 (12 comments) (4 reactions) (0 assignees)Python (4,451 stars) (240 forks)batch import
enhancementgood first issue

Description

I am working on integrating Hatch in PyCharm and encountered an issue with the --json flag, which breaks our integration.

steps to reproduce:

  1. hatch-container plugin is not installed

  2. git clone https://github.com/ofek/hatch-showcase

  3. ➜ hatch-showcase git:(master) hatch env show --json Environment all.py3.7 has unknown type: container

  4. hatch-showcase git:(master) hatch env show Standalone ┏━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓ ┃ Name ┃ Type ┃ Dependencies ┃ Scripts ┃ ┡━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩ │ default │ virtual │ coverage[toml]>=6.5 │ cov │ │ │ │ pytest │ cov-report │ │ │ │ │ test │ │ │ │ │ test-cov │ ├─────────┼─────────┼─────────────────────┼────────────┤ │ lint │ virtual │ black>=22.10.0 │ all │ │ │ │ mypy>=0.991 │ fmt │ │ │ │ ruff>=0.0.166 │ style │ │ │ │ │ typing │ └─────────┴─────────┴─────────────────────┴────────────┘ Matrices ┏━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓ ┃ Name ┃ Type ┃ Envs ┃ Dependencies ┃ Scripts ┃ ┡━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩ │ all │ container │ all.py3.7 │ coverage[toml]>=6.5 │ cov │ │ │ │ all.py3.8 │ pytest │ cov-report │ │ │ │ all.py3.9 │ │ test │ │ │ │ all.py3.10 │ │ test-cov │ │ │ │ all.py3.11 │ │ │ └──────┴───────────┴────────────┴─────────────────────┴────────────┘

Expected Behaviour:

Hatch shows environments in json format, at least available ones

Contributor guide