Skip to content

Commit d301f37

Browse files
Reapply "Fix building source distributions (#6381)" (#4040)
2 parents d4699e1 + 89166bc commit d301f37

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1810
-1842
lines changed

.github/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,10 @@ which must be in the same directory as `intel-xpu-backend-for-triton`:
135135
(probably because, in our build, users don't invoke cmake directly, but
136136
instead use setup.py). Teach vscode how to compile Triton as follows.
137137

138-
- Do a local build. Run command `pip install -e python`
138+
- Do a local build. Run command `pip install -e .`
139139
- Get the full path to the `compile_commands.json` file produced by the build:
140-
`find python/build -name 'compile_commands.json' | xargs readlink -f`.
141-
You might get a full path similar to `/Users/{username}/triton/python/build/cmake.macosx-11.1-arm64-cpython-3.12/compile_commands.json`
140+
`find build -name 'compile_commands.json' | xargs readlink -f`.
141+
You might get a full path similar to `/Users/{username}/triton/build/cmake.macosx-11.1-arm64-cpython-3.12/compile_commands.json`
142142
- In vscode, install the
143143
[C/C++
144144
extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools),

.github/WINDOWS.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ pip install -U wheel pybind11 cython cmake
163163
Build and install Triton:
164164

165165
```
166-
cd python
167166
pip install -v '.[build,tests,tutorials]'
168167
cd ..
169168
```

.github/actions/setup-triton/action.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ runs:
8181
shell: bash
8282
run: |
8383
mkdir -p ~/.triton
84-
TRITON_CACHE_KEY="$(sha256sum python/setup.py | cut -d\ -f1)"
84+
TRITON_CACHE_KEY="$(sha256sum setup.py | cut -d\ -f1)"
8585
echo "TRITON_CACHE_KEY=$TRITON_CACHE_KEY" | tee -a $GITHUB_ENV
8686
8787
- name: Load Triton cache
@@ -97,8 +97,7 @@ runs:
9797
- name: Build Triton
9898
shell: bash
9999
run: |
100-
cd python
101-
pip install -r requirements.txt
100+
pip install -r python/requirements.txt
102101
${{ inputs.command }}
103102
104103
- name: Save Triton cache

.github/workflows/auto-update-translator-cid.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
CACHE_NUMBER: 1
4545
with:
4646
path: $HOME/.cache/pip
47-
key: pip-3.9-${{ hashFiles('python/pyproject.toml', 'python/setup.py') }}-${{ env.CACHE_NUMBER }}
47+
key: pip-3.9-${{ hashFiles('pyproject.toml', 'setup.py') }}-${{ env.CACHE_NUMBER }}
4848

4949
- name: Install Python 3.9
5050
if: ${{ env.TARGET_PRID == null }}

.github/workflows/build-test-reusable.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ jobs:
103103
CACHE_NUMBER: 1
104104
with:
105105
path: $HOME/.cache/pip
106-
key: pip-${{ inputs.python_version }}-${{ hashFiles('python/pyproject.toml', 'python/setup.py') }}-${{ env.CACHE_NUMBER }}
106+
key: pip-${{ inputs.python_version }}-${{ hashFiles('pyproject.toml', 'setup.py') }}-${{ env.CACHE_NUMBER }}
107107

108108
- name: Install Python (using actions/setup-python) ${{ inputs.python_version }}
109109
if: ${{ !inputs.use_pyenv_python }}
@@ -260,7 +260,7 @@ jobs:
260260
CACHE_NUMBER: 1
261261
with:
262262
path: $HOME/.cache/pip
263-
key: pip-${{ inputs.python_version }}-${{ hashFiles('python/pyproject.toml', 'python/setup.py') }}-${{ env.CACHE_NUMBER }}
263+
key: pip-${{ inputs.python_version }}-${{ hashFiles('pyproject.toml', 'setup.py') }}-${{ env.CACHE_NUMBER }}
264264

265265
- name: Download test reports
266266
uses: actions/download-artifact@v4

.github/workflows/build-test-windows.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ jobs:
9090
.venv\Scripts\activate.ps1
9191
Invoke-BatchFile "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
9292
cd ${{ env.NEW_WORKSPACE }}
93-
cd python
9493
pip install -U wheel pybind11 cython cmake
9594
pip install -v '.[build,tests,tutorials]'
9695

.github/workflows/build-windows.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ jobs:
5757
.venv\Scripts\activate.ps1
5858
Invoke-BatchFile "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
5959
cd ${{ env.NEW_WORKSPACE }}
60-
cd python
6160
pip install -U wheel pybind11 cython cmake
6261
pip install -v '.[build]'
6362

.github/workflows/create_release.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,30 +43,31 @@ jobs:
4343
tag_or_branch="${tag_or_branch#refs/heads/}"
4444
# replace directory separators with _ in branch name
4545
tag_or_branch="${tag_or_branch//\//_}"
46+
if [[ ${tag_or_branch} == v* ]]; then
47+
# strip trailing v from tag name
48+
tag_or_branch="${tag_or_branch#v}"
49+
# important: version must be fixed in setup.py
50+
sed -i -e "s:^TRITON_VERSION = .*:TRITON_VERSION = '${tag_or_branch}':" setup.py || exit 1
51+
fi
4652
echo "RELEASE_NAME=triton-$tag_or_branch" >> "$GITHUB_ENV"
47-
echo "RELEASE_FILE=triton-$tag_or_branch.tar.gz" >> "$GITHUB_ENV"
4853
- name: Create source distribution
4954
run: |
50-
# Create new folder with specified name so extracting the archive yields that
51-
rm -rf "/tmp/$RELEASE_NAME"
52-
cp -r "$PWD" "/tmp/$RELEASE_NAME"
53-
mv "/tmp/$RELEASE_NAME" .
54-
# Cleanup
55-
find "$RELEASE_NAME" -name '.git*' -exec rm -rv {} \; || true
56-
# Create archive
57-
tar -czf "$RELEASE_FILE" "$RELEASE_NAME"
58-
echo "Created source archive $RELEASE_FILE with content: $(ls -a "$RELEASE_NAME")"
55+
pip install build || exit 1
56+
python -m build -s || exit 1
57+
cd dist || exit 1
58+
release_file=( *.tar.gz )
59+
echo "RELEASE_FILE=${release_file}" >> "$GITHUB_ENV"
5960
- name: Upload source distribution for release
6061
if: ${{ github.event_name == 'release' }}
6162
uses: softprops/action-gh-release@v2
6263
with:
63-
files: ${{env.RELEASE_FILE}}
64+
files: dist/${{env.RELEASE_FILE}}
6465
- name: Upload source distribution to GHA artifacts for release tags
6566
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && contains(github.ref, 'rc') }}
6667
uses: actions/[email protected]
6768
with:
6869
name: ${{ env.RELEASE_FILE }}
69-
path: ${{ env.RELEASE_FILE }}
70+
path: dist/${{ env.RELEASE_FILE }}
7071
- name: Set output
7172
id: release_name
7273
run: echo "name=release_name::${{ env.RELEASE_NAME }}.tar.gz" >> "${GITHUB_OUTPUT}"

.github/workflows/e2e-reusable.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ jobs:
127127
id: triton-cache
128128
uses: ./.github/actions/load
129129
with:
130-
path: python/dist
130+
path: dist
131131
key: ${{ steps.triton-key.outputs.key }}
132132

133133
- name: Build Triton wheels
@@ -138,7 +138,7 @@ jobs:
138138

139139
- name: Install Triton
140140
run: |
141-
pip install python/dist/*.whl
141+
pip install dist/*.whl
142142
143143
- name: Save Triton wheels to a cache
144144
if: ${{ steps.triton-cache.outputs.status == 'miss' }}

.github/workflows/inductor-tests-windows.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ jobs:
122122
.venv\Scripts\activate.ps1
123123
Invoke-BatchFile "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
124124
cd ${{ env.NEW_WORKSPACE }}
125-
cd python
126125
pip install -U wheel pybind11 cython cmake
127126
pip install -v '.[build,tests,tutorials]'
128127

0 commit comments

Comments
 (0)