Skip to content

Commit

Permalink
Allow old packages to default to setup.py-based build (#5076)
Browse files Browse the repository at this point in the history
It was brought up
[here](#5071 (comment))
that various workflows may still be reliant on the old way of installing
python packages (invoking setup.py directly).

While these workflows *should* enable their packages to work with
`build` eventually, they should have ample time to do so. Therefore,
this change established a default for the build command on Linux
workflows. Therefore, newer packages can start to specify `python -m
build --wheel`, without disrupting the other workflows reliant on Nova.
  • Loading branch information
joecummings authored Apr 10, 2024
1 parent 8093425 commit 751efc1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
24 changes: 18 additions & 6 deletions .github/workflows/build_wheels_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ on:
required: false
type: boolean
default: true
build-platform:
description: Platform to build wheels, choose from 'python-build-package' or 'setup-py'
required: false
type: string
default: 'setup-py'

permissions:
id-token: write
Expand Down Expand Up @@ -167,21 +172,28 @@ jobs:
cache-key: ${{ inputs.cache-key }}
repository: ${{ inputs.repository }}
script: ${{ inputs.pre-script }}
- name: Install python build dependency
- name: Build the wheel (python-build-package)
if: ${{ inputs.build-platform == 'python-build-package' }}
working-directory: ${{ inputs.repository }}
shell: bash -l {0}
run: |
set -euxo pipefail
# shellcheck disable=SC1090
source "${BUILD_ENV_FILE}"
# shellcheck disable=SC2086
export PYTORCH_VERSION="$(${CONDA_RUN} pip show torch | grep ^Version: | sed 's/Version: *//' | sed 's/+.\+//')"
${CONDA_RUN} python -m pip install build
- name: Build the wheel (bdist_wheel)
echo "Successfully installed Python build package"
${CONDA_RUN} python -m build --wheel
- name: Build the wheel (setup-py)
if: ${{ inputs.build-platform == 'setup-py' }}
working-directory: ${{ inputs.repository }}
shell: bash -l {0}
run: |
set -euxo pipefail
source "${BUILD_ENV_FILE}"
export PYTORCH_VERSION="$(${CONDA_RUN} pip show torch | grep ^Version: | sed 's/Version: *//' | sed 's/+.\+//')"
${CONDA_RUN} python -m build --wheel -n
export PYTORCH_VERSION="$(${CONDA_RUN} pip show torch | grep ^Version: | sed 's/Version: *//' | sed 's/+.\+//')"
${CONDA_RUN} python setup.py clean
echo "Successfully ran `python setup.py clean`"
${CONDA_RUN} python setup.py bdist_wheel
- name: Run Post-Script
if: ${{ inputs.post-script != '' }}
uses: ./test-infra/.github/actions/run-script-with-cache
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test_build_wheels_linux_without_cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ jobs:
build-matrix: ${{ needs.generate-matrix.outputs.matrix }}
package-name: ${{ matrix.package-name }}
trigger-event: "${{ github.event_name }}"
build-platform: 'python-build-package'

0 comments on commit 751efc1

Please sign in to comment.