Repository: pypa/cibuildwheel

Issue:
feat: include size in the final printout
Would it be helpful to include the size in the final wheel printout? I find myself checking things like this:

```
11 wheels produced in 14 minutes:
  cmake_example-0.0.1-cp27-cp27m-macosx_10_9_x86_64.whl
  cmake_example-0.0.1-cp35-cp35m-macosx_10_9_x86_64.whl
  cmake_example-0.0.1-cp36-cp36m-macosx_10_9_x86_64.whl
  cmake_example-0.0.1-cp37-cp37m-macosx_10_9_x86_64.whl
  cmake_example-0.0.1-cp38-cp38-macosx_10_9_universal2.whl
  cmake_example-0.0.1-cp38-cp38-macosx_10_9_x86_64.whl
  cmake_example-0.0.1-cp39-cp39-macosx_10_9_universal2.whl
  cmake_example-0.0.1-cp39-cp39-macosx_10_9_x86_64.whl
  cmake_example-0.0.1-pp27-pypy_73-macosx_10_9_x86_64.whl
  cmake_example-0.0.1-pp36-pypy36_pp73-macosx_10_9_x86_64.whl
  cmake_example-0.0.1-pp37-pypy37_pp73-macosx_10_9_x86_64.whl
```

And wondering if the Universal2 part worked. If the size was listed at the end, that would help.


Discussion:
I think that it will be helpful. 
Agree!

Resolving patch:
diff --git a/cibuildwheel/util.py b/cibuildwheel/util.py
--- a/cibuildwheel/util.py
+++ b/cibuildwheel/util.py
@@ -12,7 +12,7 @@
 from enum import Enum
 from pathlib import Path
 from time import sleep
-from typing import Any, Dict, Iterable, Iterator, List, Optional, TextIO
+from typing import Any, Dict, Iterable, Iterator, List, NamedTuple, Optional, TextIO
 
 import bracex
 import certifi
@@ -352,11 +352,27 @@ def print_new_wheels(msg: str, output_dir: Path) -> Iterator[None]:
     existing_contents = set(output_dir.iterdir())
     yield
     final_contents = set(output_dir.iterdir())
-    new_contents = final_contents - existing_contents
+
+    class FileReport(NamedTuple):
+        name: str
+        size: str
+
+    new_contents = [
+        FileReport(wheel.name, f"{(wheel.stat().st_size + 1023) // 1024:,d}")
+        for wheel in final_contents - existing_contents
+    ]
+    max_name_len = max(len(f.name) for f in new_contents)
+    max_size_len = max(len(f.size) for f in new_contents)
     n = len(new_contents)
     s = time.time() - start_time
     m = s / 60
-    print(msg.format(n=n, s=s, m=m), *sorted(f"  {f.name}" for f in new_contents), sep="\n")
+    print(
+        msg.format(n=n, s=s, m=m),
+        *sorted(
+            f"  {f.name:<{max_name_len}s}   {f.size:>{max_size_len}s} kB" for f in new_contents
+        ),
+        sep="\n",
+    )
 
 
 def get_pip_version(env: Dict[str, str]) -> str:


Test patch:
diff --git a/unit_test/wheel_print_test.py b/unit_test/wheel_print_test.py
--- a/unit_test/wheel_print_test.py
+++ b/unit_test/wheel_print_test.py
@@ -6,15 +6,15 @@
 def test_printout_wheels(tmp_path, capsys):
     tmp_path.joinpath("example.0").touch()
     with print_new_wheels("TEST_MSG: {n}", tmp_path):
-        tmp_path.joinpath("example.1").touch()
-        tmp_path.joinpath("example.2").touch()
+        tmp_path.joinpath("example.1").write_bytes(b"0" * 1023)
+        tmp_path.joinpath("example.2").write_bytes(b"0" * 1025)
 
     captured = capsys.readouterr()
     assert captured.err == ""
 
     assert "example.0" not in captured.out
-    assert "example.1\n" in captured.out
-    assert "example.2\n" in captured.out
+    assert "example.1   1 kB\n" in captured.out
+    assert "example.2   2 kB\n" in captured.out
     assert "TEST_MSG:" in captured.out
     assert "TEST_MSG: 2\n" in captured.out