Skip to content

Commit 7893835

Browse files
committed
fix: faster CLI on Python 3.15 with lazy imports
1 parent cb1fdd0 commit 7893835

32 files changed

Lines changed: 392 additions & 0 deletions

cibuildwheel/__main__.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
__lazy_modules__ = [
2+
"argparse",
3+
"cibuildwheel.architecture",
4+
"cibuildwheel.ci",
5+
"cibuildwheel.logger",
6+
"cibuildwheel.options",
7+
"cibuildwheel.platforms",
8+
"cibuildwheel.selector",
9+
"cibuildwheel.typing",
10+
"cibuildwheel.util",
11+
"cibuildwheel.util.file",
12+
"cibuildwheel.util.helpers",
13+
"cibuildwheel.util.resources",
14+
"collections",
15+
"collections.abc",
16+
"contextlib",
17+
"functools",
18+
"os",
19+
"pathlib",
20+
"shutil",
21+
"sys",
22+
"tarfile",
23+
"tempfile",
24+
"textwrap",
25+
"traceback",
26+
"typing",
27+
]
28+
129
import argparse
230
import contextlib
331
import dataclasses

cibuildwheel/architecture.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
__lazy_modules__ = [
2+
"cibuildwheel.typing",
3+
"collections",
4+
"collections.abc",
5+
"platform",
6+
"re",
7+
"shutil",
8+
"subprocess",
9+
"sys",
10+
]
11+
112
import platform as platform_module
213
import re
314
import shutil

cibuildwheel/bashlex_eval.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
__lazy_modules__ = ["bashlex", "subprocess"]
2+
13
import dataclasses
24
import subprocess
35
from collections.abc import (

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.helpers", "os"]
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,3 +1,5 @@
1+
__lazy_modules__ = ["bashlex", "bashlex.errors", "collections", "collections.abc"]
2+
13
import dataclasses
24
from collections.abc import Mapping, Sequence
35
from typing import Any, Protocol

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: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22
These are utilities for the `/bin` scripts, not for the `cibuildwheel` program.
33
"""
44

5+
__lazy_modules__ = [
6+
"collections",
7+
"collections.abc",
8+
"io",
9+
"json",
10+
"time",
11+
"urllib",
12+
"urllib.error",
13+
"urllib.request",
14+
]
15+
516
import json
617
import time
718
import typing

cibuildwheel/frontend.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
__lazy_modules__ = [
2+
"cibuildwheel.logger",
3+
"cibuildwheel.util.helpers",
4+
"collections",
5+
"collections.abc",
6+
"shlex",
7+
]
8+
19
import dataclasses
210
import shlex
311
import typing

cibuildwheel/logger.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
__lazy_modules__ = [
2+
"cibuildwheel.ci",
3+
"codecs",
4+
"collections",
5+
"collections.abc",
6+
"contextlib",
7+
"functools",
8+
"hashlib",
9+
"humanize",
10+
"io",
11+
"os",
12+
"pathlib",
13+
"re",
14+
"sys",
15+
"textwrap",
16+
"time",
17+
]
18+
119
import codecs
220
import contextlib
321
import dataclasses

cibuildwheel/oci_container.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
__lazy_modules__ = [
2+
"cibuildwheel.ci",
3+
"cibuildwheel.errors",
4+
"cibuildwheel.logger",
5+
"cibuildwheel.typing",
6+
"cibuildwheel.util.cmd",
7+
"cibuildwheel.util.helpers",
8+
"collections",
9+
"collections.abc",
10+
"io",
11+
"json",
12+
"os",
13+
"pathlib",
14+
"platform",
15+
"shlex",
16+
"shutil",
17+
"subprocess",
18+
"sys",
19+
"textwrap",
20+
"types",
21+
"uuid",
22+
]
23+
124
import dataclasses
225
import io
326
import json

0 commit comments

Comments
 (0)