hatch
hatch copied to clipboard
Hatch Test System Python Option
We're looking into adopting the hatch test pattern in jupyter_server, but are stuck on the fact that pypy isn't supported. What we'd like to be able to do is tell hatch test to use the system python $(which python) in our CI.
Hey! Do you mean you have an environment already set up with the proper dependencies and you want to avoid that step and start running scripts without any setup phase?
I mean effectively UV_SYSTEM_PYTHON since we're using uv under the hood.
I ran into a similar issue in my CI, which I fixed by setting the HATCH_PYTHON environment variable to the appropriate path: https://github.com/SupImDos/pydantic-argparse/pull/67
It seems like there should be a better / more intuitive way to do this though. Without having thought about it too much, I'm not sure that the preferred Python should be the one Hatch is using - especially since Hatch seems to install Python 3.12 along with itself (at least in CI).
https://github.com/pypa/hatch/blob/d73037fe7e9b66eeeba2e72d37074373594221c5/src/hatch/env/virtual.py#L325-L333
Maybe the resolution order should prefer the Python version in the active shell (i.e., $(which python)) first?