Open wis opened 4 months ago
Oh that stacktrace is hard to read, hatch uses rich
to format traceback, your terminal must not play nicely with some of the pretty printing it's doing.
hatch-pip-compile
is not finding its expected header: https://github.com/juftin/hatch-pip-compile/blob/251fcd7e1f5a8041cc698d94abb9b18fab8559d9/requirements/requirements-test.txt#L1-L5
LockFileError: Could not find lock file python version
I'll look into making this a better UX.
I just started trying out hatch-pip-compile, also trying out hatch for the first time too, with uv for fast installs. it's working great so far, I'm excited about this setup.
..But it errored with a nonobvious stacktrace error message the first time I ran it with
pipx run hatch env run -- python myscript.py
, which is supposed to have hatch install hatch-pip-compile and have it start running hatch-pip-compile automatically:The stacktrace: (i'm not sure why it looks like that, with the weird characters framing the code)
the content of the existing (old) requirements.txt file I had:
I generated it with this small python script, that generates a requirements.txt lock file with hashes from a Pipfile.lock. (in the process of migrating away from Pipenv, well my first attempt with pip, now I use hatch with hatch-pip-compile)
I deleted/renamed the old requirements.txt file manually and reran the command to have hatch install and run hatch-pip-compile, and it worked.
Suggested improved behavior: hatch-pip-compile should mark the requirements.txt it generates with a kind of a magic string prepended at the top of the requirements.txt in a comment, and if it does not exist, it should print that there's an existing requirements.txt and if it should overwrite it.