microsoft / microsoft/typespec

[http-client-python] Fix emitter set up

Open
#8,333 3 comments 0 reactions 0 assignees View on GitHub
emitter:client:python
Dominant language
Java
Stars
5.9k
Forks
394
Avg merge
1d 23h
Merged PRs (30d)
104

Description

**Problem:**
Today, we check for python and set up the environment in the same step and if any part of that fails, we ignore the issue saying that we'll use pyodide and continue. The problem is that if python does exist on the machine but the venv set up failed (for example if the generator/ directory was unsuccessfully installed), this will still cause the emitter to fail later on during compile when the emitter sees that python does exist on the machine and assumes that set up was successful.

**Fix:**
We need to separate checking for python on the machine and the environment set up steps. If python is not found then we can skip the virtual environment set up and log that we'll use pyodide. If python was found, we can continue to the environment set up. If environment set up fails for any reason fail immediately and surface the error so the user can address the issue.

**Example:**
We've had several instances of pygen not found errors reported, it seems this can be due to long paths issues on widnows, however, emitter installation/setup doesnt fail it only logs that pyodide will be used and the user gets an error at compile time. We should have failed immediately in these cases and surfaced the error to the user.

cc @iscai-msft @msyyc

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.