Skip to content

Commit

Permalink
Check python/uv/ folder with mypy (#7891)
Browse files Browse the repository at this point in the history
It used to report:

```
» mypy 
python/uv/_build_backend.py:40: error: Incompatible types in assignment (expression has type "list[str]", variable has type "CompletedProcess[bytes]")  [assignment]
python/uv/_build_backend.py:41: error: Value of type "CompletedProcess[bytes]" is not indexable  [index]
python/uv/_build_backend.py:46: error: Value of type "CompletedProcess[bytes]" is not indexable  [index]
Found 3 errors in 1 file (checked 6 source files)
```

So, I had to fix this problem by renaming the `result` var.
  • Loading branch information
sobolevn authored Oct 3, 2024
1 parent c07cdc6 commit d5c5a29
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ version_files = [

[tool.mypy]
ignore_missing_imports = true
files = "crates/uv-python/*.py"
files = [
"crates/uv-python/*.py",
"python/uv/*.py",
]

[tool.uv]
managed = false
8 changes: 4 additions & 4 deletions python/uv/_build_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ def call(args: "list[str]", config_settings: "dict | None" = None) -> str:
if result.returncode != 0:
sys.exit(result.returncode)
# If there was extra stdout, forward it (there should not be extra stdout)
result = result.stdout.decode("utf-8").strip().splitlines(keepends=True)
sys.stdout.writelines(result[:-1])
stdout = result.stdout.decode("utf-8").strip().splitlines(keepends=True)
sys.stdout.writelines(stdout[:-1])
# Fail explicitly instead of an irrelevant stacktrace
if not result:
if not stdout:
print("uv subprocess did not return a filename on stdout", file=sys.stderr)
sys.exit(1)
return result[-1].strip()
return stdout[-1].strip()


def build_sdist(sdist_directory: str, config_settings: "dict | None" = None):
Expand Down

0 comments on commit d5c5a29

Please sign in to comment.