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

Fix a bug where no warning is output when parsing of workspace settings fails. #4014

Merged
merged 3 commits into from
Jun 4, 2024

Conversation

Di-Is
Copy link
Contributor

@Di-Is Di-Is commented Jun 4, 2024

Summary

See #4013

uv pip ... command loads workspace settings from pyproject.toml and uv.toml.

Although a warning is implemented to output a warning when parsing fails, it is not actually output.

https://github.com/astral-sh/uv/blob/main/crates/uv-workspace/src/workspace.rs#L38-L61

The reason is that the flag to display warnings is enabled after loading the workspace settings.

This PR turns on the warning output flag before loading the workspace.

Test Plan

pyproject.toml for test

[project]
name = "sample"
version = "0.0.0"
dependencies = ["ruff"]

[tool.uv.pip]
# originally string type.
index-url = 1

command output (before modification)

uv pip compile pyproject.toml 

Resolved 1 package in 383ms
# This file was autogenerated by uv via the following command:
#    uv pip compile pyproject.toml
ruff==0.4.7
    # via sample (pyproject.toml)

command output (after modification)

uv pip compile pyproject.toml

warning: Failed to parse `pyproject.toml`: TOML parse error at line 7, column 13
  |
7 | index-url = true
  |             ^^^^
invalid type: boolean `true`, expected a string

Resolved 1 package in 107ms
# This file was autogenerated by uv via the following command:
#    uv pip compile pyproject.toml
ruff==0.4.7
    # via sample (pyproject.toml)

Copy link
Member

@konstin konstin left a comment

Choose a reason for hiding this comment

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

Thanks

@konstin konstin requested a review from charliermarsh June 4, 2024 12:47
@konstin
Copy link
Member

konstin commented Jun 4, 2024

CC @charliermarsh for the changes in cli-warnings handlings.

Copy link
Member

@charliermarsh charliermarsh left a comment

Choose a reason for hiding this comment

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

We should eventually change this to buffer and then print.

@charliermarsh charliermarsh merged commit 41ec302 into astral-sh:main Jun 4, 2024
46 checks passed
@charliermarsh charliermarsh added the preview Experimental behavior label Jun 4, 2024
@Di-Is Di-Is deleted the fix-quiet-workspace-warning branch July 13, 2024 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preview Experimental behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants