8000 Merge branch 'main' into already-built · pypa/cibuildwheel@9ed9e6b · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit 9ed9e6b

Browse files
authored
Merge branch 'main' into already-built
2 parents ef18186 + d02366f commit 9ed9e6b

29 files changed

+430
-283
lines changed

.github/dependabot.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,3 @@ updates:
55
directory: "/"
66
schedule:
77
interval: "weekly"
8-
ignore:
9-
- dependency-name: "actions/*"
10-
update-types: ["version-update:semver-minor", "version-update:semver-patch"]

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ repos:
2727

2828
# Autoremoves unused imports
2929
- repo: https://github.com/hadialqattan/pycln
30-
rev: v1.3.3
30+
rev: v1.3.5
3131
hooks:
3232
- id: pycln
3333
args: [--all]

bin/bump_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def bump_version() -> None:
184184
print()
185185

186186
release_url = "https://github.com/pypa/cibuildwheel/releases/new?" + urllib.parse.urlencode(
187-
{"tag": new_version}
187+
{"tag": f"v{new_version}"}
188188
)
189189
print("Then create a release at the URL:")
190190
print(f" {release_url}")

bin/update_docker.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22
from __future__ import annotations
33

44
import configparser
5+
from dataclasses import dataclass
56
from pathlib import Path
6-
from typing import NamedTuple
77

88
import requests
99

1010
DIR = Path(__file__).parent.resolve()
1111
RESOURCES = DIR.parent / "cibuildwheel/resources"
1212

1313

14-
class Image(NamedTuple):
14+
@dataclass(frozen=True)
15+
class Image:
1516
manylinux_version: str
1617
platform: str
1718
image_name: str

bin/update_virtualenv.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
import logging
77
import subprocess
88
import sys
9+
from dataclasses import dataclass
910
from pathlib import Path
10-
from typing import NamedTuple
1111

1212
import click
1313
import rich
@@ -36,7 +36,8 @@
3636
] = f"{GET_VIRTUALENV_GITHUB}/blob/{{version}}/public/virtualenv.pyz?raw=true"
3737

3838

39-
class VersionTuple(NamedTuple):
39+
@dataclass(frozen=True)
40+
class VersionTuple:
4041
version: Version
4142
version_string: str
4243

cibuildwheel/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def main() -> None:
116116
help="Enable pre-release Python versions if available.",
117117
)
118118

119-
args = parser.parse_args(namespace=CommandLineArguments())
119+
args = CommandLineArguments(**vars(parser.parse_args()))
120120

121121
args.package_dir = args.package_dir.resolve()
122122

cibuildwheel/bashlex_eval.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import subprocess
2-
from typing import Callable, Dict, List, NamedTuple, Optional, Sequence
2+
from dataclasses import dataclass
3+
from typing import Callable, Dict, List, Optional, Sequence
34

45
import bashlex
56

@@ -13,7 +14,8 @@ def local_environment_executor(command: List[str], env: Dict[str, str]) -> str:
1314
).stdout
1415

1516

16-
class NodeExecutionContext(NamedTuple):
17+
@dataclass(frozen=True)
18+
class NodeExecutionContext:
1719
environment: Dict[str, str]
1820
input: str
1921
executor: EnvironmentExecutor

cibuildwheel/linux.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import subprocess
22
import sys
33
import textwrap
4+
from dataclasses import dataclass
45
from pathlib import Path, PurePath, PurePosixPath
5-
from typing import Iterator, List, NamedTuple, Set, Tuple
6+
from typing import Iterator, List, Set, Tuple
67

78
from .architecture import Architecture
89
from .docker_container import DockerContainer
@@ -20,7 +21,8 @@
2021
)
2122

2223

23-
class PythonConfiguration(NamedTuple):
24+
@dataclass(frozen=True)
25+
class PythonConfiguration:
2426
version: str
2527
identifier: str
2628
path_str: str
@@ -30,7 +32,8 @@ def path(self) -> PurePosixPath:
3032
return PurePosixPath(self.path_str)
3133

3234

33-
class BuildStep(NamedTuple):
35+
@dataclass(frozen=True)
36+
class BuildStep:
3437
platform_configs: List[PythonConfiguration]
3538
platform_tag: str
3639
docker_image: str

cibuildwheel/macos.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
import shutil
66
import subprocess
77
import sys
8+
from dataclasses import dataclass
89
from pathlib import Path
9-
from typing import Dict, List, NamedTuple, Sequence, Set, Tuple, cast
10+
from typing import Dict, List, Sequence, Set, Tuple, cast
1011

1112
from filelock import FileLock
1213

@@ -55,7 +56,8 @@ def get_macos_sdks() -> List[str]:
5556
return [m.group(1) for m in re.finditer(r"-sdk (macosx\S+)", output)]
5657

5758

58-
class PythonConfiguration(NamedTuple):
59+
@dataclass(frozen=True)
60+
class PythonConfiguration:
5961
version: str
6062
identifier: str
6163
url: str

cibuildwheel/options.py

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,9 @@
44
import traceback
55
from configparser import ConfigParser
66
from contextlib import contextmanager
7+
from dataclasses import asdict, dataclass
78
from pathlib import Path
8-
from typing import (
9-
Any,
10-
Dict,
11-
Generator,
12-
List,
13-
Mapping,
14-
NamedTuple,
15-
Optional,
16-
Set,
17-
Tuple,
18-
Union,
19-
)
9+
from typing import Any, Dict, Generator, List, Mapping, Optional, Set, Tuple, Union
2010

2111
if sys.version_info >= (3, 11):
2212
import tomllib
@@ -45,6 +35,7 @@
4535
)
4636

4737

38+
@dataclass
4839
class CommandLineArguments:
4940
platform: Literal["auto", "linux", "macos", "windows"]
5041
archs: Optional[str]
@@ -56,15 +47,17 @@ class CommandLineArguments:
5647
prerelease_pythons: bool
5748

5849

59-
class GlobalOptions(NamedTuple):
50+
@dataclass(frozen=True)
51+
class GlobalOptions:
6052
package_dir: Path
6153
output_dir: Path
6254
build_selector: BuildSelector
6355
test_selector: TestSelector
6456
architectures: Set[Architecture]
6557

6658

67-
class BuildOptions(NamedTuple):
59+
@dataclass(frozen=True)
60+
class BuildOptions:
6861
globals: GlobalOptions
6962
environment: ParsedEnvironment
7063
before_all: str
@@ -104,7 +97,8 @@ def architectures(self) -> Set[Architecture]:
10497
Setting = Union[Dict[str, str], List[str], str, int]
10598

10699

107-
class Override(NamedTuple):
100+
@dataclass(frozen=True)
101+
class Override:
108102
select_pattern: str
109103
options: Dict[str, Setting]
110104

@@ -548,20 +542,20 @@ def check_for_deprecated_options(self) -> None:
548542
def summary(self, identifiers: List[str]) -> str:
549543
lines = [
550544
f"{option_name}: {option_value!r}"
551-
for option_name, option_value in sorted(self.globals._asdict().items())
545+
for option_name, option_value in sorted(asdict(self.globals).items())
552546
]
553547

554548
build_option_defaults = self.build_options(identifier=None)
555549

556-
for option_name, default_value in sorted(build_option_defaults._asdict().items()):
550+
for option_name, default_value in sorted(asdict(build_option_defaults).items()):
557551
if option_name == "globals":
558552
continue
559553

560554
lines.append(f"{option_name}: {default_value!r}")
561555

562556
# if any identifiers have an overridden value, print that too
563557
for identifier in identifiers:
564-
option_value = self.build_options(identifier=identifier)._asdict()[option_name]
558+
option_value = getattr(self.build_options(identifier=identifier), option_name)
565559
if option_value != default_value:
566560
lines.append(f" {identifier}: {option_value!r}")
567561

0 commit comments

Comments
 (0)
0