pypa / hatch

Modern, extensible Python project management
https://hatch.pypa.io/latest/
MIT License
6.11k stars 310 forks source link

portable way to call a command with the same name as a a script #1589

Open RonnyPfannschmidt opened 5 months ago

RonnyPfannschmidt commented 5 months ago

currently when one wants to call a operating system command with the same name as a script, an error is triggered unless one uses a non-portable wrapper (like env on posix)


[tool.hatch.envs.default]
python = "3.12"
dependencies = ["pytest", "schemathesis", "mypy>=1.10"]
scripts.pre-commit = "env pre-commit run -a || env pre-commit run -a"
scripts.test = "pytest {args}"
scripts.all = ["pre-commit", "test"]

i'd like to be able to run the pre-commit command in a portable way (as env is not available on other platforms) i'd like to avoid using a differently mangled name

ofek commented 5 months ago

I like your idea in Discord of starting with a ! to prevent script lookups as there is already precedent with starting with - to ignore the exit code. Are you still fine with that idea?

RonnyPfannschmidt commented 5 months ago

It would be nice to consider the ! For internal commands and have something like cmd from bash that runs an os command for sur