Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: 2

jobs:
osx-python3.6:
osx-python3.9:
macos:
xcode: 12.5.1
environment:
Expand All @@ -17,9 +17,9 @@ jobs:
command: venv/bin/python ./bin/run_tests.py
no_output_timeout: 30m

linux-python3.6:
linux-python3.9:
docker:
- image: circleci/python:3.6
- image: circleci/python:3.9
environment:
PYTHON: python3
# Temporarily restrict the tests that are run on CircleCI to prevent
Expand All @@ -41,5 +41,5 @@ workflows:
version: 2
all-tests:
jobs:
- osx-python3.6
- linux-python3.6
- osx-python3.9
- linux-python3.9
20 changes: 6 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,8 @@ repos:
rev: v2.37.1
hooks:
- id: pyupgrade
name: PyUpgrade 3.6+
args: ["--py36-plus"]
exclude: ^bin/
- id: pyupgrade
name: PyUpgrade 3.7+ on bin
exclude: ^(cibuildwheel|unit_test|test)/
args: ["--py37-plus"]
exclude: ^cibuildwheel/resources/.*py$

# Autoremoves unused imports
- repo: https://github.com/hadialqattan/pycln
Expand All @@ -37,6 +32,8 @@ repos:
rev: 5.10.1
hooks:
- id: isort
args: ["-a", "from __future__ import annotations"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You added this before I could suggest it. :D

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooo 👀

exclude: ^cibuildwheel/resources/.*py$

- repo: https://github.com/psf/black
rev: 22.6.0
Expand All @@ -52,9 +49,9 @@ repos:
rev: v0.961
hooks:
- id: mypy
name: mypy 3.6 on cibuildwheel/
exclude: ^(bin|cibuildwheel/resources|docs)/.*py$
args: ["--python-version=3.6"]
name: mypy 3.7 on cibuildwheel/
exclude: ^cibuildwheel/resources/.*py$
args: ["--python-version=3.7"]
additional_dependencies: &mypy-dependencies
- nox
- packaging>=21.0
Expand All @@ -70,11 +67,6 @@ repos:
- types-requests
- bracex
- dataclasses
- id: mypy
name: mypy 3.7+ on bin/
files: ^((bin|docs)/.*py)$
args: ["--python-version=3.7"]
additional_dependencies: *mypy-dependencies
- id: mypy
name: mypy 3.10
args: ["--python-version=3.10"]
Expand Down
22 changes: 11 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ branches:

jobs:
include:
- name: Linux | x86_64 + i686 | Python 3.6
python: 3.6
- name: Linux | x86_64 + i686 | Python 3.7
python: 3.7
services: docker
env: PYTHON=python

- name: Linux | arm64 | Python 3.6
python: 3.6
- name: Linux | arm64 | Python 3.7
python: 3.7
services: docker
arch: arm64-graviton2
group: edge
virt: vm
env: PYTHON=python

- name: Linux | ppc64le | Python 3.6
python: 3.6
- name: Linux | ppc64le | Python 3.7
python: 3.7
services: docker
arch: ppc64le
allow_failure: True
Expand All @@ -32,18 +32,18 @@ jobs:
# c.f. https://travis-ci.community/t/running-out-of-disk-space-quota-when-using-docker-on-ppc64le/11634
- PYTEST_ADDOPTS='-k "not test_manylinuxXXXX_only"'

- name: Windows | x86_64 | Python 3.6
- name: Windows | x86_64 | Python 3.7
os: windows
language: shell
before_install:
- choco upgrade python3 -y --version 3.6.8 --limit-output
- choco upgrade python3 -y --version 3.7.9 --limit-output
# Update root certificates to fix SSL error; see http://www.chawn.com/RootCerts.htm
- powershell "md C:\temp\certs; CertUtil -generateSSTFromWU C:\temp\certs\RootStore.sst; Get-ChildItem -Path C:\\temp\certs\Rootstore.sst | Import-Certificate -CertStoreLocation Cert:\\LocalMachine\\Root\\ | out-null"
env:
- PYTHON=C:\\Python36\\python
- PYTHON=C:\\Python37\\python

- name: Linux | s390x | Python 3.6
python: 3.6
- name: Linux | s390x | Python 3.7
python: 3.7
services: docker
arch: s390x
env: PYTHON=python
Expand Down
12 changes: 6 additions & 6 deletions CI.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
This is a summary of the Python versions and platforms covered by the different CI platforms:

| | 3.6 | 3.7 | 3.8 |
|----------|------------------------------|-----------------------------|------------------|
| Linux | Travis CI / CircleCI | AppVeyor¹ / GitHub Actions | Azure Pipelines |
| macOS | CircleCI | AppVeyor¹ / GitHub Actions | Azure Pipelines |
| Windows | Travis CI / Azure Pipelines | AppVeyor¹ / GitHub Actions | Azure Pipelines |
| | 3.7 | 3.8 | 3.9 | 3.10 |
|----------|-----------------------|---------------------------|----------|----------------|
| Linux | AppVeyor¹ / Travis CI | Azure Pipelines / GitLab | CircleCI | GitHub Actions |
| macOS | AppVeyor¹ / Travis CI | Azure Pipelines | CircleCI | GitHub Actions |
| Windows | AppVeyor¹ / Travis CI | Azure Pipelines | | GitHub Actions |

> ¹ AppVeyor only runs the "basic" test to reduce load.

Non-x86 architectures are covered on Travis CI using Python 3.6.
Non-x86 architectures are covered on Travis CI using Python 3.7.
11 changes: 0 additions & 11 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,6 @@ jobs:
python -m pip install -e ".[dev]" pytest-azurepipelines
python ./bin/run_tests.py

- job: windows_36
pool: {vmImage: 'windows-2019'}
timeoutInMinutes: 180
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.6'
- bash: |
python -m pip install -e ".[dev]" pytest-azurepipelines
python ./bin/run_tests.py

- job: windows_38
pool: {vmImage: 'windows-2019'}
timeoutInMinutes: 180
Expand Down
2 changes: 2 additions & 0 deletions bin/run_tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env python3

from __future__ import annotations

import argparse
import os
import subprocess
Expand Down
3 changes: 2 additions & 1 deletion bin/update_dependencies.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python3
# This file supports 3.6+

from __future__ import annotations

import os
import shutil
Expand Down
2 changes: 2 additions & 0 deletions bin/update_readme_changelog.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env python3

from __future__ import annotations

import re
import sys
from pathlib import Path
Expand Down
2 changes: 2 additions & 0 deletions cibuildwheel/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from __future__ import annotations

__version__ = "2.8.1"
21 changes: 11 additions & 10 deletions cibuildwheel/__main__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import argparse
import os
import shutil
Expand All @@ -7,7 +9,6 @@
import textwrap
from pathlib import Path
from tempfile import mkdtemp
from typing import List, Set, Union

import cibuildwheel
import cibuildwheel.linux
Expand Down Expand Up @@ -257,7 +258,7 @@ def build_in_directory(args: CommandLineArguments) -> None:
log.warning(f"Can't delete temporary folder '{str(tmp_path)}'")


def print_preamble(platform: str, options: Options, identifiers: List[str]) -> None:
def print_preamble(platform: str, options: Options, identifiers: list[str]) -> None:
print(
textwrap.dedent(
"""
Expand Down Expand Up @@ -287,13 +288,13 @@ def print_preamble(platform: str, options: Options, identifiers: List[str]) -> N


def get_build_identifiers(
platform: PlatformName, build_selector: BuildSelector, architectures: Set[Architecture]
) -> List[str]:
python_configurations: Union[
List[cibuildwheel.linux.PythonConfiguration],
List[cibuildwheel.windows.PythonConfiguration],
List[cibuildwheel.macos.PythonConfiguration],
]
platform: PlatformName, build_selector: BuildSelector, architectures: set[Architecture]
) -> list[str]:
python_configurations: (
list[cibuildwheel.linux.PythonConfiguration]
| list[cibuildwheel.windows.PythonConfiguration]
| list[cibuildwheel.macos.PythonConfiguration]
)

if platform == "linux":
python_configurations = cibuildwheel.linux.get_python_configurations(
Expand All @@ -313,7 +314,7 @@ def get_build_identifiers(
return [config.identifier for config in python_configurations]


def detect_warnings(*, options: Options, identifiers: List[str]) -> List[str]:
def detect_warnings(*, options: Options, identifiers: list[str]) -> list[str]:
warnings = []

# warn about deprecated {python} and {pip}
Expand Down
15 changes: 8 additions & 7 deletions cibuildwheel/architecture.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from __future__ import annotations

import functools
import platform as platform_module
import re
from enum import Enum
from typing import Set

from .typing import Final, Literal, PlatformName, assert_never

Expand Down Expand Up @@ -32,11 +33,11 @@ class Architecture(Enum):
ARM64 = "ARM64"

# Allow this to be sorted
def __lt__(self, other: "Architecture") -> bool:
def __lt__(self, other: Architecture) -> bool:
return self.value < other.value

@staticmethod
def parse_config(config: str, platform: PlatformName) -> "Set[Architecture]":
def parse_config(config: str, platform: PlatformName) -> set[Architecture]:
result = set()
for arch_str in re.split(r"[\s,]+", config):
if arch_str == "auto":
Expand All @@ -54,7 +55,7 @@ def parse_config(config: str, platform: PlatformName) -> "Set[Architecture]":
return result

@staticmethod
def auto_archs(platform: PlatformName) -> "Set[Architecture]":
def auto_archs(platform: PlatformName) -> set[Architecture]:
native_architecture = Architecture(platform_module.machine())
result = {native_architecture}

Expand All @@ -72,7 +73,7 @@ def auto_archs(platform: PlatformName) -> "Set[Architecture]":
return result

@staticmethod
def all_archs(platform: PlatformName) -> "Set[Architecture]":
def all_archs(platform: PlatformName) -> set[Architecture]:
all_archs_map = {
"linux": {
Architecture.x86_64,
Expand All @@ -87,7 +88,7 @@ def all_archs(platform: PlatformName) -> "Set[Architecture]":
return all_archs_map[platform]

@staticmethod
def bitness_archs(platform: PlatformName, bitness: Literal["64", "32"]) -> "Set[Architecture]":
def bitness_archs(platform: PlatformName, bitness: Literal["64", "32"]) -> set[Architecture]:
archs_32 = {Architecture.i686, Architecture.x86}
auto_archs = Architecture.auto_archs(platform)

Expand All @@ -101,7 +102,7 @@ def bitness_archs(platform: PlatformName, bitness: Literal["64", "32"]) -> "Set[

def allowed_architectures_check(
platform: PlatformName,
architectures: Set[Architecture],
architectures: set[Architecture],
) -> None:

allowed_architectures = Architecture.all_archs(platform)
Expand Down
16 changes: 8 additions & 8 deletions cibuildwheel/bashlex_eval.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
from __future__ import annotations

import subprocess
from dataclasses import dataclass
from typing import Callable, Dict, List, Optional, Sequence
from typing import Callable, Dict, List, Sequence

import bashlex

# a function that takes a command and the environment, and returns the result
EnvironmentExecutor = Callable[[List[str], Dict[str, str]], str]


def local_environment_executor(command: List[str], env: Dict[str, str]) -> str:
return subprocess.run(
command, env=env, universal_newlines=True, stdout=subprocess.PIPE, check=True
).stdout
def local_environment_executor(command: list[str], env: dict[str, str]) -> str:
return subprocess.run(command, env=env, text=True, stdout=subprocess.PIPE, check=True).stdout


@dataclass(frozen=True)
class NodeExecutionContext:
environment: Dict[str, str]
environment: dict[str, str]
input: str
executor: EnvironmentExecutor


def evaluate(
value: str, environment: Dict[str, str], executor: Optional[EnvironmentExecutor] = None
value: str, environment: dict[str, str], executor: EnvironmentExecutor | None = None
) -> str:
if not value:
# empty string evaluates to empty string
Expand Down Expand Up @@ -103,7 +103,7 @@ def evaluate_nodes_as_compound_command(


def evaluate_nodes_as_simple_command(
nodes: List[bashlex.ast.node], context: NodeExecutionContext
nodes: list[bashlex.ast.node], context: NodeExecutionContext
) -> str:
command = [evaluate_node(part, context=context) for part in nodes]
return context.executor(command, context.environment)
Expand Down
Loading