pypa / pypa/hatch

hatch run - suggest close defined "script" names when the command is not found

Open
#2,012 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
7.2k
Forks
462
Avg merge
19h 36m
Merged PRs (30d)
10

Description

when using a project setup like


[tool.hatch.envs.default]
detached = true
python = "3.12"
installer = "uv"
dependencies = [
    "ipython",
    "sphinx-tabs",
    "sphinx>=8.2.0",
    "sphinx-autobuild",
    "myst_parser",
    "sphinx-tabs",
    "sphinxawesome-theme",
]

[tool.hatch.envs.default.scripts]
build = "sphinx-build src public -d doctrees"
live-build = "sphinx-autobuild src public -d doctrees --open-browser"

when i try to run something like

$  LC_ALL=C hatch run build-live
/bin/sh: line 1: build-live: command not found

it takes a while to figure what the issue is
it would be a big help if the ux was more along the lines of

$  LC_ALL=C hatch run build-live
ERROR: command build-live not found
Please ensure the necessary dependencies/extras/groups are part of the environment
PS: the script names defined in $configfile are:
- live-build
- build

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the hatch run command-not-found handling and inspect how scripts from the project configuration are loaded and displayed. Reproduce the missing build-live command with the shown configuration; done means the error identifies the missing command and lists the configured script names, while retaining the dependency guidance.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.