Skip to content

Improve handling of missing interpreters during discovery - #4218

Merged
zanieb merged 2 commits into
mainfrom
zb/interp-io
Jun 10, 2024
Merged

zanieb merged 2 commits into
mainfrom
zb/interp-io

Conversation

@zanieb

@zanieb zanieb commented Jun 10, 2024 •

Copy link
Copy Markdown
Member

Cherry-picked from #4214

The first commit gets us some context on an IO error during queries:

Previously:

failed to canonicalize path `[VENV]/bin/python3`
    Caused by: No such file or directory (os error 2)

Now:

Failed to query Python interpreter
    Caused by: failed to canonicalize path `[VENV]/bin/python3`
    Caused by: No such file or directory (os error 2)

but really we shouldn't attempt to query a missing interpreter during discovery anyway, so we improve handling of that too.

@zanieb zanieb added the bug Something isn't working label Jun 10, 2024
Comment thread crates/uv/tests/pip_compile.rs Outdated
Comment on lines 141 to 142

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh hey this is way better, why would we fail here anyway?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I'm actually not sure.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well I know why we did but yeah there's no reason to

Comment thread crates/uv/tests/pip_sync.rs Outdated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now this isn't amazing, I guess with -v you'd see why your VIRTUAL_ENV was ignored. We could add some sort of hint in the future?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it literally doesn't exist this seems okay for now though

Comment thread crates/uv-toolchain/src/interpreter.rs Resolved
This feels kind of obvious, but the query code never checked if the requested interpreter exists so we would fail with an IO error and stop discovery which does not feel quite right
@zanieb
zanieb merged commit 98d1ea6 into main Jun 10, 2024
@zanieb
zanieb deleted the zb/interp-io branch June 10, 2024 22:26
zanieb added a commit that referenced this pull request Jun 10, 2024
A merge kerfuffle from #4222  and #4218 

Now we fail because we genuinely can't find any interpreters since tests
contexts are isolated by default. I'll improve the error message and
maybe add another test case once `main` is fixed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants