Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PythonInfo's use of platform.check_command() can make troubleshooting difficult #1758

Open
rsyring opened this issue Oct 17, 2024 · 0 comments

Comments

@rsyring
Copy link

rsyring commented Oct 17, 2024

I use mise to manage my Python installs and virtualenvs. For whatever reason, the way it creates and upgrades it's Python installs causes existing virtualenvs to break. When that happens, I just clear the old virtualenvs out and start over.

A week or two ago, I upgraded my Python version. Today, I jumped into a project I hadn't used for awhile and ran hatch version on a project that uses a dynamic version. The version command exited with no output and an exit code of 1.

It took me some time to track down what was going on (a broken venv) due to the lack of any kind of debugging output. This is due to PythonInfo's use of platform.check_command() which raises a SystemExit exception if the called command has any kind of error. SystemExit causes the interpreter to exit with no output.

IMO, the troubleshooting DX would improve by showing the output of a failed command. Maybe just switching check_command() to run_command() would be sufficient here.

You can easily generate a test case by modifying DEP_CHECK_DATA_SCRIPT so it throws an error. Then run hatch version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant