From ded1e99a001e46e41ca7e2a7115bd20499459af1 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Thu, 3 Oct 2024 11:27:42 +0300 Subject: [PATCH 1/2] Check `python/uv/` folder with `mypy` --- pyproject.toml | 5 ++++- python/uv/_build_backend.py | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 74b53112c4bb..5401bd03a533 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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 diff --git a/python/uv/_build_backend.py b/python/uv/_build_backend.py index a1284fe40b73..014f7451b967 100644 --- a/python/uv/_build_backend.py +++ b/python/uv/_build_backend.py @@ -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]) + sdtout = result.stdout.decode("utf-8").strip().splitlines(keepends=True) + sys.stdout.writelines(sdtout[:-1]) # Fail explicitly instead of an irrelevant stacktrace - if not result: + if not sdtout: print("uv subprocess did not return a filename on stdout", file=sys.stderr) sys.exit(1) - return result[-1].strip() + return sdtout[-1].strip() def build_sdist(sdist_directory: str, config_settings: "dict | None" = None): From 0bd7c9832246b2d375d0141764751a2a9d923b91 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Thu, 3 Oct 2024 13:39:11 +0300 Subject: [PATCH 2/2] Typo! --- python/uv/_build_backend.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/uv/_build_backend.py b/python/uv/_build_backend.py index 014f7451b967..5ab4cb1ba3f4 100644 --- a/python/uv/_build_backend.py +++ b/python/uv/_build_backend.py @@ -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) - sdtout = result.stdout.decode("utf-8").strip().splitlines(keepends=True) - sys.stdout.writelines(sdtout[:-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 sdtout: + if not stdout: print("uv subprocess did not return a filename on stdout", file=sys.stderr) sys.exit(1) - return sdtout[-1].strip() + return stdout[-1].strip() def build_sdist(sdist_directory: str, config_settings: "dict | None" = None):