Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish precompiled wheels in Github release and add wheel index #365

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
175 commits
Select commit Hold shift + click to select a range
3d133ad
publish precompiled wheels
Aug 16, 2024
2258d4c
Update publish.yml
Aug 16, 2024
512d1b9
Update publish.yml
Aug 16, 2024
1539715
Update publish.yml
Aug 16, 2024
4ad0798
Update publish.yml
Aug 16, 2024
2007c3d
Update publish.yml
Aug 16, 2024
37c2541
Update publish.yml
Aug 16, 2024
f850459
Update publish.yml
Aug 16, 2024
046146e
Update publish.yml
Aug 16, 2024
91a66e2
Update publish.yml
Aug 16, 2024
f3dcd9e
Update publish.yml
Aug 16, 2024
a2cb89c
Update publish.yml
Aug 16, 2024
a7ae2cf
Update publish.yml
Aug 16, 2024
265a78e
Update publish.yml
Aug 16, 2024
c7a2b4b
Update publish.yml
Aug 16, 2024
8d42820
Update publish.yml
Aug 16, 2024
4f97fbd
Update publish.yml
Aug 16, 2024
236af2c
Update publish.yml
Aug 16, 2024
7ff4ea3
test on linux
Aug 16, 2024
041556f
Update building.yml
Aug 16, 2024
5c537b1
Update publish.yml
Aug 16, 2024
1ffe180
try to fix
Aug 16, 2024
ba76541
trying TORCH_CUDA_ARCH_LIST=7.5
Aug 16, 2024
444fc93
try to fix
Aug 17, 2024
d8d91a7
try fixing
Aug 17, 2024
a3db8b6
move export TORCH_CUDA_ARCH_LIST=8.2
Aug 17, 2024
d186c49
try fix
Aug 17, 2024
09c03cd
using export TORCH_CUDA_ARCH_LIST="8.0;8.6"
Aug 17, 2024
db71225
Update publish.yml
Aug 17, 2024
e3b8b81
using TORCH_CUDA_ARCH_LIST="8.0"
Aug 17, 2024
2a01f4d
TORCH_CUDA_ARCH_LIST="7.5"
Aug 17, 2024
ea3b1a1
Update publish.yml
Aug 17, 2024
72e7721
Update publish.yml
Aug 17, 2024
c5c2207
Update publish.yml
Aug 17, 2024
6fdd5e3
Update publish.yml
Aug 17, 2024
5dff781
Update publish.yml
Aug 17, 2024
f60c27f
Update publish.yml
Aug 17, 2024
db3753f
Update publish.yml
Aug 17, 2024
1d5af27
TORCH_CUDA_ARCH_LIST="6.2;7.2;7.5;8.7;8.9;9.0"
Aug 17, 2024
d416742
Update publish.yml
Aug 17, 2024
ee68bd1
Update publish.yml
Aug 17, 2024
03edc1e
Update building.yml
Aug 17, 2024
651c37b
TORCH_CUDA_ARCH_LIST="6.2"
Aug 17, 2024
755ade3
export TORCH_CUDA_ARCH_LIST="7.2;7.5"
Aug 17, 2024
e589d03
Update publish.yml
Aug 18, 2024
b4d5d31
Update publish.yml
Aug 18, 2024
8813791
Update building.yml
Aug 18, 2024
3281c6b
Update publish.yml
Aug 18, 2024
393980f
Update publish.yml
Aug 18, 2024
c8d992e
Update building.yml
Aug 18, 2024
4654fa8
Update publish.yml
Aug 19, 2024
af36e58
Update publish.yml
martinResearch Aug 22, 2024
b096bde
Update publish.yml
martinResearch Aug 22, 2024
e1f1cc5
Update publish.yml
martinResearch Aug 22, 2024
b2b38af
Update publish.yml
martinResearch Aug 22, 2024
ba1b9a0
trying to set TORCH_CUDA_ARCH_LIST in the setup.py file
Aug 22, 2024
e6fe7d0
Update setup.py
Aug 22, 2024
fec8707
test
Aug 22, 2024
5298a45
simplify
Aug 22, 2024
2c00ff7
use ORCH_CUDA_ARCH_LIST="7.0;7.5;8.0;8.6;9.0" with cu118
Aug 22, 2024
ae0157b
trying wheel build with cuda 11.7
Aug 22, 2024
36e4c84
trying TORCH_CUDA_ARCH_LIST="7.0;7.5;8.0;8.6;9.0" with cuda 11.7
Aug 22, 2024
9974cd0
trying export TORCH_CUDA_ARCH_LIST="7.0;7.5;8.0;8.6;9.0" with cuda 11.6
Aug 22, 2024
7acfe00
trying export TORCH_CUDA_ARCH_LIST="7.0;7.5;8.0;8.6;9.0" with cuda 11.5
Aug 22, 2024
db65519
trying export TORCH_CUDA_ARCH_LIST="7.0;7.5;8.0;8.6;9.0" with cuda 11.3
Aug 22, 2024
f98defd
test TORCH_CUDA_ARCH_LIST="7.0;7.5;8.0;8.6" with cuda 11.3
Aug 22, 2024
2289c5e
testing TORCH_CUDA_ARCH_LIST="7.0;7.5;8.0;8.6" with cuda 11.5
Aug 22, 2024
882d84b
testing TORCH_CUDA_ARCH_LIST="7.0;7.5;8.0;8.6" with cuda 11.6
Aug 22, 2024
4fd13af
testing TORCH_CUDA_ARCH_LIST="7.0;7.5;8.0;8.6" with cuda 11.3
Aug 22, 2024
59e2862
testing TORCH_CUDA_ARCH_LIST="7.0;7.5;8.0;8.6" with cuda 11.7
Aug 22, 2024
269ee37
trying python 3.9 and 3.11
martinResearch Aug 22, 2024
fc9687d
Update publish.yml
martinResearch Aug 22, 2024
8734b4e
Update publish.yml
martinResearch Aug 22, 2024
42b9f52
trying python 3.8
martinResearch Aug 22, 2024
15c7870
trying python 3.7
martinResearch Aug 22, 2024
f10c66a
fix python3.7
martinResearch Aug 22, 2024
59a8d47
test python 3.11
martinResearch Aug 22, 2024
a57ea6c
Update publish.yml
martinResearch Aug 22, 2024
96bc5f9
Update publish.yml
martinResearch Aug 22, 2024
f7c39dd
testing python 3.7
martinResearch Aug 22, 2024
d6ad825
Update publish.yml
martinResearch Aug 22, 2024
0da97ca
Update publish.yml
martinResearch Aug 22, 2024
3964115
Update publish.yml
martinResearch Aug 22, 2024
ddd6417
Update publish.yml
martinResearch Aug 22, 2024
e87843e
test cu113
martinResearch Aug 22, 2024
22faed6
test cu115
martinResearch Aug 22, 2024
b5a2d91
test cu116
martinResearch Aug 22, 2024
c1bb170
test cu117
martinResearch Aug 22, 2024
507f25e
test cu118
martinResearch Aug 22, 2024
8801c5d
Update publish.yml
martinResearch Aug 22, 2024
7ea832f
Update publish.yml
martinResearch Aug 22, 2024
ce866d1
Update publish.yml
martinResearch Aug 22, 2024
d91af09
Update publish.yml
martinResearch Aug 22, 2024
bfa13ce
create 2 pipelines
Aug 22, 2024
15dc711
change pipeline names
Aug 22, 2024
e761101
Update publish_source_and_no_cuda_wheel.yml
Aug 22, 2024
0dd71b6
Update publish_precompiled_wheels.yml
Aug 22, 2024
6550b3e
Update publish_source_and_no_cuda_wheel.yml
Aug 22, 2024
8767eac
trying to upload in github release
Aug 22, 2024
a41f885
Update publish_precompiled_wheels.yml
Aug 22, 2024
f971f68
Update publish_precompiled_wheels.yml
Aug 22, 2024
0144a33
Update publish_precompiled_wheels.yml
Aug 22, 2024
7606924
Update publish_precompiled_wheels.yml
Aug 22, 2024
d8363f8
test BUILD_NO_CUDA=1
Aug 22, 2024
3f56477
test BUILD_NO_CUDA=1
Aug 22, 2024
f2d4f2c
Update publish_precompiled_wheels.yml
Aug 22, 2024
e90e3ff
Update publish_precompiled_wheels.yml
Aug 22, 2024
6c6b017
Update publish_precompiled_wheels.yml
Aug 22, 2024
82b4a55
Update publish_precompiled_wheels.yml
Aug 23, 2024
5b19930
trying to uploade the wheels to release
Aug 23, 2024
da9540e
Update publish_precompiled_wheels.yml
Aug 23, 2024
624ff43
Update publish_precompiled_wheels.yml
Aug 23, 2024
99830d8
Update publish_precompiled_wheels.yml
Aug 23, 2024
db93c4b
Update publish_precompiled_wheels.yml
Aug 23, 2024
eaa9b5c
Update publish_precompiled_wheels.yml
Aug 23, 2024
744a6bb
Update publish_precompiled_wheels.yml
Aug 23, 2024
3effb48
Update publish_precompiled_wheels.yml
Aug 23, 2024
6b6f367
back to single file
Aug 23, 2024
fbecdb5
Update publish.yml
Aug 23, 2024
3c39fa6
Update publish.yml
Aug 23, 2024
c9f87cf
Create wheels_index.html
Aug 23, 2024
dcd3204
Update wheels_index.html
Aug 23, 2024
67d5b97
deal with +
Aug 23, 2024
dcb1c0a
Update publish.yml
Aug 23, 2024
d798e40
Update publish.yml
Aug 23, 2024
ee6a0e6
Update publish.yml
Aug 23, 2024
d08da8b
adding links to packages
Aug 23, 2024
b6ef983
document installation using a precompiled wheel
Aug 23, 2024
31eebcb
Update packages.html
Aug 23, 2024
c1bbced
Create wheels_index.html
Aug 23, 2024
a20ba9e
Update wheels_index.html
Aug 23, 2024
508f558
trying using %2B in urls
Aug 23, 2024
a5dd753
moving index
Aug 23, 2024
3d9196e
trying to make it work with index url
Aug 23, 2024
c8be58c
Merge branch 'nerfstudio-project:main' into publish_precompiled_wheels
martinResearch Aug 23, 2024
1e09ff8
add ptXcuX subpages
Aug 23, 2024
4a691ed
Merge branch 'publish_precompiled_wheels' of https://github.com/marti…
Aug 23, 2024
57e94ee
Update INSTALL_WIN.md
Aug 23, 2024
3a13a96
Merge branch 'main' into publish_precompiled_wheels
Aug 26, 2024
dbc13ce
trying to reuse the build workflow
Aug 26, 2024
ec694a9
try publish on manual release
Aug 26, 2024
58ba0ad
Update publish.yml
Aug 26, 2024
e425ab6
Update publish.yml
Aug 26, 2024
331bcea
trying reusable workflow
Aug 26, 2024
eb1dc61
trying to make it work
Aug 26, 2024
1020c7b
try reusable workflow
Aug 26, 2024
1e9ef3f
Update publish.yml
Aug 26, 2024
836367f
Update publish.yml
Aug 26, 2024
6bcc4c5
testing with few wheels
Aug 26, 2024
18031ab
Update building.yml
Aug 26, 2024
101fb32
Update building.yml
Aug 26, 2024
1ce0231
Update building.yml
Aug 26, 2024
8cee0a8
Update publish.yml
Aug 26, 2024
bf5d79d
Update building.yml
Aug 26, 2024
27ab7be
Merge branch 'main' into publish_precompiled_wheels
Aug 26, 2024
5117c84
add script and github steps to generate the simple index pages
Sep 20, 2024
d8d03f0
remove the html pages from the PR
Sep 20, 2024
6723f91
Merge remote-tracking branch 'original/main' into publish_precompiled…
Sep 20, 2024
53e2539
remove wheels for python 3.8 and 3.9 from the releases
Sep 21, 2024
78b097d
ruff format
Sep 21, 2024
9a80923
Update publish.yml
Sep 21, 2024
df7de2e
fixing typos
Sep 21, 2024
e2bcff4
Update generate_simple_index_pages.py
martinResearch Sep 26, 2024
9446369
wheels -> whl
Sep 26, 2024
09e0454
test
Sep 26, 2024
4817516
test
Sep 26, 2024
819605a
fix
Sep 26, 2024
8469c0b
some updates
Sep 26, 2024
5e4e883
fix
Sep 26, 2024
1c72ddb
ninja-build
Sep 26, 2024
bc2950c
revert
Sep 26, 2024
62076f9
fix
Sep 27, 2024
fce307e
artifact v3
Sep 27, 2024
f5eabf9
all version with python3.10
Sep 27, 2024
f55f2e3
wheels -> whl
Sep 27, 2024
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
47 changes: 36 additions & 11 deletions .github/workflows/building.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,46 @@
name: Building Wheels
name: Build Wheels

on: [workflow_dispatch]

on: [workflow_call, workflow_dispatch]
jobs:

wheel:
build_sdist:
name: Build source distribution and no binary wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Strip unsupported tags in README
run: |
sed -i '/<!-- pypi-strip -->/,/<!-- \/pypi-strip -->/d' README.md
- name: Build sdist
run: BUILD_NO_CUDA=1 pipx run build --sdist
- name: Build wheel with no binaries
run: BUILD_NO_CUDA=1 python setup.py bdist_wheel --dist-dir=dist
- uses: actions/upload-artifact@v3
with:
name: pypi_packages
path: dist/*.tar.gz


build_wheels:
runs-on: ${{ matrix.os }}
environment: production

strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-2019]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.10']
torch-version: ['2.0.0', '2.1.0', '2.2.0', '2.3.0', '2.4.0']
cuda-version: ['cu118', 'cu121', 'cu124']
# python-version: ['3.8']
# torch-version: ['2.0.0']
# cuda-version: ['cu118']

exclude:
- python-version: 3.12
torch-version: 2.0.0
- python-version: 3.12
torch-version: 2.1.0

- torch-version: 2.0.0
cuda-version: 'cu113'
- torch-version: 2.0.0
Expand Down Expand Up @@ -58,21 +78,19 @@ jobs:
- torch-version: 2.4.0
cuda-version: 'cu116'
- torch-version: 2.4.0
cuda-version: 'cu117'

cuda-version: 'cu117'
- os: windows-2019
torch-version: 2.0.0
cuda-version: 'cu121'


steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down Expand Up @@ -146,3 +164,10 @@ jobs:
python -c "import gsplat; print('gsplat:', gsplat.__version__)"
cd ..
shell: bash # `ls -lah` does not exist in windows powershell

# v4 does not allow writing into the same folder, so stick with v3
# https://github.com/actions/upload-artifact/issues/478
- uses: actions/upload-artifact@v3
with:
name: compiled_wheels_python${{ matrix.python-version }}
path: dist/*.whl
2 changes: 1 addition & 1 deletion .github/workflows/core_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
submodules: 'recursive'

- name: Set up Python 3.8.12
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.8.12"
- name: Install dependencies
Expand Down
152 changes: 152 additions & 0 deletions .github/workflows/generate_simple_index_pages.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
import requests
import os
import argparse
from jinja2 import Template
import re

# Automatically get the repository name in the format "owner/repo" from the GitHub workflow environment
GITHUB_REPO = os.getenv("GITHUB_REPOSITORY")


def list_python_wheels():
# GitHub API URL for releases
releases_url = f"https://api.github.com/repos/{GITHUB_REPO}/releases"

response = requests.get(releases_url)

if response.status_code != 200:
raise Exception(
f"Failed to fetch releases: {response.status_code} {response.text}"
)

releases = response.json()

wheel_files = []

# Iterate through releases and assets
for release in releases:
assets = release.get("assets", [])
for asset in assets:
filename = asset["name"]
if filename.endswith(".whl"):
pattern = r"^(?P<name>[\w\d_.]+)-(?P<version>[\d.]+)(?P<local>\+[\w\d.]+)?-(?P<python_tag>[\w]+)-(?P<abi_tag>[\w]+)-(?P<platform_tag>[\w]+)\.whl"

match = re.match(pattern, filename)

if match:
local_version = match.group("local")
if local_version:
local_version = local_version.lstrip(
"+"
) # Return the local version without the '+' sign
else:
local_version = None
else:
raise ValueError(f"Invalid wheel filename: {filename}")
wheel_files.append(
{
"release_name": release["name"],
"wheel_name": asset["name"],
"download_url": asset["browser_download_url"],
"package_name": match.group("name"),
"local_version": local_version,
}
)

return wheel_files


def generate_simple_index_htmls(wheels, outdir):
# Jinja2 template as a string
template_versions_str = """
<!DOCTYPE html>
<html>
<head><title>Python wheels links for {{ repo_name }}</title></head>
<body>
<h1>Python wheels for {{ repo_name }}</h1>

{% for wheel in wheels %}
<a href="{{ wheel.download_url }}">{{ wheel.wheel_name }}</a><br/>
{% endfor %}

</body>
</html>
"""

template_packages_str = """
<html>
<body>
{% for package_name in package_names %}
<a href="{{package_name}}/">{{package_name}}</a><br/>
{% endfor %}
</body>
</html>
"""

# Create a Jinja2 Template object from the string
template_versions = Template(template_versions_str)
template_packages = Template(template_packages_str)

# group the wheels by package name
packages = {}
for wheel in wheels:
package_name = wheel["package_name"]
if package_name not in packages:
packages[package_name] = []
packages[package_name].append(wheel)

# Render the HTML the list the package names
html_content = template_packages.render(
package_names=[str(k) for k in packages.keys()]
)
os.makedirs(outdir, exist_ok=True)
with open(os.path.join(outdir, "index.html"), "w") as file:
file.write(html_content)

# for each package, render the HTML to list the wheels
for package_name, wheels in packages.items():
html_page = template_versions.render(repo_name=GITHUB_REPO, wheels=wheels)
os.makedirs(os.path.join(outdir, package_name), exist_ok=True)
with open(os.path.join(outdir, package_name, "index.html"), "w") as file:
file.write(html_page)


def generate_all_pages():
wheels = list_python_wheels()
if wheels:
print("Python Wheels found in releases:")
for wheel in wheels:
print(
f"Release: {wheel['release_name']}, Wheel: {wheel['wheel_name']}, URL: {wheel['download_url']}"
)
else:
print("No Python wheels found in the releases.")

# Generate Simple Index HTML pages the wheel with all local versions
generate_simple_index_htmls(wheels, outdir=args.outdir)

# group wheels per local version
wheels_per_local_version = {}
for wheel in wheels:
local_version = wheel["local_version"]
if local_version is not None and local_version not in wheels_per_local_version:
wheels_per_local_version[local_version] = []
wheels_per_local_version[local_version].append(wheel)

# create a subdirectory for each local version
for local_version, wheels in wheels_per_local_version.items():
os.makedirs(os.path.join(args.outdir, local_version), exist_ok=True)
generate_simple_index_htmls(
wheels, outdir=os.path.join(args.outdir, local_version)
)


if __name__ == "__main__":
argparser = argparse.ArgumentParser(
description="Generate Python Wheels Index Pages"
)
argparser.add_argument(
"--outdir", help="Output directory for the index pages", default="."
)
args = argparser.parse_args()
generate_all_pages()
42 changes: 42 additions & 0 deletions .github/workflows/generate_simple_index_pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This workflows will upload a Python Package using twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Update wheels index pages

# trigger manually on github interface
on:
workflow_dispatch:
push:
branches: [generate_wheels_simple_index_pages]

jobs:
deploy:
runs-on: ubuntu-latest
environment: production

steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install requests jinja2
# call the script to generate the simple index pages
- name: Generate Simple Index Pages
run: python .github/workflows/generate_simple_index_pages.py --outdir ./whl
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./whl # Directory where the simple index pages are located
destination_dir: whl # The 'wh' folder in the GitHub Pages root
Loading
Loading