-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
📦 Move packaging to PEP 517 in-tree backend
This essentially allows the cythonization opt-out be controlled by the `pure-python` PEP 517 config setting that can be passed to the corresponding build frontends via their respective CLIs.
- Loading branch information
Showing
14 changed files
with
1,054 additions
and
144 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
--- | ||
|
||
name: Build wheel | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
dists-artifact-name: | ||
description: Workflow artifact name containing dists | ||
required: true | ||
type: string | ||
cython-tracing: | ||
description: Whether to build Cython modules with line tracing | ||
default: '0' | ||
required: false | ||
type: string | ||
os: | ||
description: VM OS to use, without version suffix | ||
default: ubuntu | ||
required: false | ||
type: string | ||
qemu: | ||
description: Emulated QEMU architecture | ||
default: '' | ||
required: false | ||
type: string | ||
source-tarball-name: | ||
description: Sdist filename wildcard | ||
required: true | ||
type: string | ||
|
||
env: | ||
FORCE_COLOR: "1" # Make tools pretty. | ||
PIP_DISABLE_PIP_VERSION_CHECK: "1" | ||
PIP_NO_PYTHON_VERSION_WARNING: "1" | ||
|
||
jobs: | ||
|
||
build-wheel: | ||
name: Build wheels on ${{ inputs.os }} ${{ inputs.qemu }} | ||
runs-on: ${{ inputs.os }}-latest | ||
# Ref: https://github.com/python-jsonschema/check-jsonschema/issues/354 | ||
timeout-minutes: 60 # FIXME: ${{ inputs.qemu && '60' || '20' }} | ||
steps: | ||
- name: Retrieve the project source from an sdist inside the GHA artifact | ||
uses: re-actors/checkout-python-sdist@release/v1 | ||
with: | ||
source-tarball-name: ${{ inputs.source-tarball-name }} | ||
workflow-artifact-name: ${{ inputs.dists-artifact-name }} | ||
|
||
- name: Set up QEMU | ||
if: inputs.qemu | ||
uses: docker/setup-qemu-action@v3 | ||
with: | ||
platforms: all | ||
id: qemu | ||
- name: Prepare emulation | ||
if: inputs.qemu | ||
run: | | ||
# Build emulated architectures only if QEMU is set, | ||
# use default "auto" otherwise | ||
echo "CIBW_ARCHS_LINUX=${{ inputs.qemu }}" >> "${GITHUB_ENV}" | ||
shell: bash | ||
|
||
- name: Build wheels | ||
uses: pypa/[email protected] | ||
env: | ||
CIBW_ARCHS_MACOS: x86_64 arm64 universal2 | ||
CIBW_CONFIG_SETTINGS: >- # Cython line tracing for coverage collection | ||
pure-python=false | ||
with-cython-tracing=${{ inputs.cython-tracing }} | ||
- name: Upload built artifacts for testing and publishing | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ inputs.dists-artifact-name }} | ||
path: ./wheelhouse/*.whl | ||
|
||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
include pyproject.toml | ||
include pytest.ini | ||
include pytest.ci.ini | ||
include LICENSE | ||
include CHANGES.rst | ||
include README.rst | ||
include CONTRIBUTORS.txt | ||
graft frozenlist | ||
graft packaging | ||
graft docs | ||
graft requirements | ||
graft tests | ||
include frozenlist/*.c | ||
global-exclude *.pyc | ||
global-exclude *.pyd | ||
global-exclude *.so | ||
global-exclude *.lib | ||
global-exclude *.dll | ||
global-exclude *.a | ||
global-exclude *.obj | ||
exclude frozenlist/*.c | ||
exclude frozenlist/*.html | ||
prune docs/_build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# `pep517_backend` in-tree build backend | ||
|
||
The `pep517_backend.hooks` importable exposes callables declared by PEP 517 | ||
and PEP 660 and is integrated into `pyproject.toml`'s | ||
`[build-system].build-backend` through `[build-system].backend-path`. | ||
|
||
# Design considerations | ||
|
||
`__init__.py` is to remain empty, leaving `hooks.py` the only entrypoint | ||
exposing the callables. The logic is contained in private modules. This is | ||
to prevent import-time side effects. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""PEP 517 build backend for optionally pre-building Cython.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import sys | ||
|
||
from . import cli | ||
|
||
if __name__ == "__main__": | ||
sys.exit(cli.run_main_program(argv=sys.argv)) |
Oops, something went wrong.