You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tried going through the "create environment..." flow with a pyproject.toml file but I had an error since my pyproject.toml file was incorrectly formatted. Would be good if the error message was better or it failed more gracefully
Resolved Python Environment /Users/eleanorboyd/python-envs-scenarios/existing-env-folder/.venv/bin/python
2025-05-14 09:19:39.308 [info] Running: uv pip install --python /Users/eleanorboyd/python-envs-scenarios/existing-env-folder/.venv/bin/python -e /Users/eleanorboyd/python-envs-scenarios/existing-env-folder
2025-05-14 09:19:39.378 [info] error: Failed to extract static metadata from `pyproject.toml`
Caused by: TOML parse error at line 6, column 8
|
6 | name = "existing env folder"
| ^^^^^^^^^^^^^^^^^^^^^
Not a valid package or extra name: "existing env folder". Names must start and end with a letter or digit and may only contain -, _, ., and alphanumeric characters.
I looked into the issue and found several problems with the current user experience:
Although the popup window shows that an error occurred, users only see a generic “Error managing packages” message with no context. It doesn’t mention pyproject.toml at all. The actual error is buried in the logs, and users have to click “View Output” and scroll through the output to find the real message.
The environment is created successfully first, but the package installation then fails, leaving users with a half-working environment in a confusing state.
I’m thinking of improving the user experience by adding early validation. We could validate pyproject.toml when the user clicks Create Environment. If it’s invalid, we would show a warning with the error message and give the user three options: Open pyproject.toml, Create anyway, or Cancel, which corresponds to open the file, proceed despite the issue, or stop the process.
One challenge is that the warning dialog has limited space, so the error message will need to be concise and easy to understand. Benefit of this approach is that once we start parsing pyproject.toml up front, we can also validate other formatting and configuration issues early based on relevant PEPs, making the fix more general.
Thanks for this detailed investigation! When you say the "create environment" step which one are you talking about specifically? Like before this one?
my worry is that if a user selects "quick create" we will try to use the pyproject.toml but if the user selects "venv" and configures it themself they could choose to not use the pyproject.toml to create their environment and thus present the issue unnecessarily.
So I love the 3 options and doing early validation is good but I just want to make sure we aren't confusing users who aren't going to end up selecting the pyproject.toml
I wasn’t able to repro the behavior. When I removed a closing quote in pyproject.toml, I saw a warning during environment creation:
Failed to parse pyproject.toml during environment creation: TOML parse error at line 5, column 11 | 5 | "rich | ^ invalid basic string, expected "
and the environment was not created.
That said, I do agree with your point. While the current implementation focuses on catching some of the most common and straightforward formatting errors, it’s definitely something worth adding to further validate the dependencies format and improve the overall experience.
Activity
StellaHuang95 commentedon Dec 10, 2025
I looked into the issue and found several problems with the current user experience:
pyproject.tomlat all. The actual error is buried in the logs, and users have to click “View Output” and scroll through the output to find the real message.I’m thinking of improving the user experience by adding early validation. We could validate
pyproject.tomlwhen the user clicksCreate Environment. If it’s invalid, we would show a warning with the error message and give the user three options:Open pyproject.toml,Create anyway, orCancel, which corresponds to open the file, proceed despite the issue, or stop the process.One challenge is that the warning dialog has limited space, so the error message will need to be concise and easy to understand. Benefit of this approach is that once we start parsing
pyproject.tomlup front, we can also validate other formatting and configuration issues early based on relevant PEPs, making the fix more general.Eleanor Boyd (@eleanorjboyd) What do you think about this approach?
eleanorjboyd commentedon Dec 10, 2025
Thanks for this detailed investigation! When you say the "create environment" step which one are you talking about specifically? Like before this one?
my worry is that if a user selects "quick create" we will try to use the pyproject.toml but if the user selects "venv" and configures it themself they could choose to not use the pyproject.toml to create their environment and thus present the issue unnecessarily.
So I love the 3 options and doing early validation is good but I just want to make sure we aren't confusing users who aren't going to end up selecting the pyproject.toml
Validate pyproject.toml before installing dependencies (#1066)
eleanorjboyd commentedon Jan 5, 2026
closed by #1066
amunger commentedon Jan 7, 2026
tried adding some malformed stuff to a pyproject.toml, and it just seems to ignore the file entirely. is that expected?
amunger commentedon Jan 7, 2026
specifically, removing a
", just creates the venv without any packages installed:StellaHuang95 commentedon Jan 8, 2026
I wasn’t able to repro the behavior. When I removed a closing quote in
pyproject.toml, I saw a warning during environment creation:and the environment was not created.
That said, I do agree with your point. While the current implementation focuses on catching some of the most common and straightforward formatting errors, it’s definitely something worth adding to further validate the dependencies format and improve the overall experience.
eleanorjboyd commentedon Sep 24, 2026
Stella Huang (@StellaHuang95) will let you decide on this issue and if we need to make changes here or if the state we are in is good
fix: fail gracefully on invalid pyproject.toml (Fixes microsoft#411) (m…