Skip to content

Commit 6c08562

Browse files
authored
fix: faster CLI on Python 3.15 (#2797)
* chore: lazy imports Signed-off-by: Henry Schreiner <[email protected]> * chore: bump flake8-lazy, rerun Signed-off-by: Henry Schreiner <[email protected]> * chore: include android Signed-off-by: Henry Schreiner <[email protected]> * fix: after rebase Assisted-by: ClaudeCode:claude-sonnet-4.6 Signed-off-by: Henry Schreiner <[email protected]> * chore: autofix __lazy_modules__ Signed-off-by: Henry Schreiner <[email protected]> * chore: avoid touching resources Signed-off-by: Henry Schreiner <[email protected]> * chore: bump flake8-lazy to v0.8.2, rerun Assisted-by: ClaudeCode:claude-sonnet-4-6 --------- Signed-off-by: Henry Schreiner <[email protected]>
1 parent 4f42ee3 commit 6c08562

29 files changed

Lines changed: 303 additions & 0 deletions

‎.pre-commit-config.yaml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ repos:
7777
files: '^(README\.md|docs/changelog\.md|docs/options\.md|bin/readme.*)$'
7878
additional_dependencies: [cogapp>=3.5]
7979

80+
- repo: https://github.com/henryiii/flake8-lazy
81+
rev: 65b94e97b1091634368592d98072160842265fe4 # frozen: v0.8.2
82+
hooks:
83+
- id: flake8-lazy
84+
args: ["--apply=set"]
85+
files: '^cibuildwheel'
86+
exclude: "^cibuildwheel/resources/"
87+
8088
- repo: https://github.com/codespell-project/codespell
8189
rev: 2ccb47ff45ad361a21071a7eedda4c37e6ae8c5a # frozen: v2.4.2
8290
hooks:

‎cibuildwheel/__main__.py‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,30 @@
11
from __future__ import annotations
22

3+
__lazy_modules__ = {
4+
"argparse",
5+
"cibuildwheel._compat",
6+
"cibuildwheel._compat.tarfile",
7+
"cibuildwheel.architecture",
8+
"cibuildwheel.ci",
9+
"cibuildwheel.logger",
10+
"cibuildwheel.options",
11+
"cibuildwheel.platforms",
12+
"cibuildwheel.selector",
13+
"cibuildwheel.typing",
14+
"cibuildwheel.util",
15+
"cibuildwheel.util.file",
16+
"cibuildwheel.util.helpers",
17+
"cibuildwheel.util.resources",
18+
"contextlib",
19+
"functools",
20+
"io",
21+
"pathlib",
22+
"shutil",
23+
"tempfile",
24+
"textwrap",
25+
"traceback",
26+
}
27+
328
import argparse
429
import contextlib
530
import dataclasses

‎cibuildwheel/architecture.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from __future__ import annotations
22

3+
__lazy_modules__ = {"platform", "re", "shutil", "subprocess"}
4+
35
import platform as platform_module
46
import re
57
import shutil

‎cibuildwheel/audit.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
from __future__ import annotations
22

3+
__lazy_modules__ = {
4+
"cibuildwheel.logger",
5+
"cibuildwheel.util",
6+
"cibuildwheel.util.cmd",
7+
"cibuildwheel.util.helpers",
8+
"cibuildwheel.util.packaging",
9+
"cibuildwheel.venv",
10+
"pathlib",
11+
"subprocess",
12+
}
13+
314
import subprocess
415
import sys
516
from pathlib import Path

‎cibuildwheel/bashlex_eval.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from __future__ import annotations
22

3+
__lazy_modules__ = {"bashlex", "subprocess"}
4+
35
import dataclasses
46
import subprocess
57

‎cibuildwheel/ci.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
__lazy_modules__ = {"cibuildwheel.util", "cibuildwheel.util.helpers"}
2+
13
import os
24
import re
35
from enum import Enum

‎cibuildwheel/environment.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from __future__ import annotations
22

3+
__lazy_modules__ = {"bashlex", "bashlex.errors"}
4+
35
import dataclasses
46
from typing import Protocol
57

‎cibuildwheel/errors.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
semantically clear and unique.
55
"""
66

7+
__lazy_modules__ = {"textwrap"}
8+
79
import textwrap
810

911

‎cibuildwheel/extra.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
from __future__ import annotations
66

7+
__lazy_modules__ = {"io", "json", "urllib", "urllib.error", "urllib.request"}
8+
79
import json
810
import time
911
import typing

‎cibuildwheel/frontend.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from __future__ import annotations
22

3+
__lazy_modules__ = {"cibuildwheel.util", "cibuildwheel.util.helpers", "shlex"}
4+
35
import dataclasses
46
import shlex
57
import typing

0 commit comments

Comments
 (0)