hobscrk777
hobscrk777

Reputation: 2637

How to use Hatch to run Python CLI

I'm trying to work through a pretty basic "hello world" type of example to setup a Python CLI using the Hatch build system (which I understand uses the Click library under the hood).

I've got a minimally reproducible example below, and the error I'm running into appears below the following code snippet.

python -m venv .venv
source .venv/bin/activate
pip install hatch
hatch new "new cli" --cli
cd new-cli
hatch build
hatch run new-cli

And then I get the following error:

/bin/sh: new-cli: command not found

I've got the following defined in the pyproject.toml file that gets auto-generated by Hatch.

[tool.hatch.envs.default.scripts]
new-cli = "new_cli.cli:new_cli"

I feel like I'm overlooking some very basic here, but I can't seem to figure out what it is. I've tried running hatch shell prior to the hatch run new-cli, but nothing seems to work.

Upvotes: 0

Views: 415

Answers (0)

Related Questions