Skip to content

Commit 1815db1

Browse files
authored
add truss transfer (#1317)
* add truss transfer * add formatting changes * running readme * updated CI and add readme * update readme, update version * do not print download url * update readme * move the ci * add ci task for truss-transfer * add example bptr manifest.json * add truss-transfer-test.yml * update ci * add permissions * add tmp folder * improve token of usage * renamed ci, fix token * add real bptr resolution * update wheel creation * set workdir * another ci fix with huggingface diff * add workdir * add wheel * add package manager * fix: sdist * update package manager * update ci * upload sdist case? * env: CROSS_OPENSSL_DIR: /usr * add truss transfer * release later * re-add cI as is * set up workdir correctly * back on par with huggingface * find interpreter * fix windows symlinking * cargo fmt * update libs * add openssl vendored * clean up cargo.toml * bump py03 version * pyo3 api update * build free threaded wheels too * update sdist path * no windows free-threaded wheels * update example name * upload readme
1 parent 8aadbbf commit 1815db1

10 files changed

+2473
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,238 @@
1+
# This file is autogenerated by maturin v1.8.1
2+
# To update, run
3+
#
4+
# maturin generate-ci github
5+
#
6+
name: truss-transfer-build-maturin
7+
8+
on:
9+
push:
10+
branches:
11+
- main
12+
- master
13+
paths:
14+
- 'truss-transfer/**'
15+
tags:
16+
- '*' # Still runs on all tags regardless of directory changes
17+
pull_request:
18+
paths:
19+
- 'truss-transfer/**'
20+
workflow_dispatch:
21+
22+
permissions:
23+
contents: read
24+
25+
jobs:
26+
linux:
27+
runs-on: ${{ matrix.platform.runner }}
28+
strategy:
29+
matrix:
30+
platform:
31+
- runner: ubuntu-22.04
32+
target: x86_64
33+
- runner: ubuntu-22.04
34+
target: x86
35+
- runner: ubuntu-22.04
36+
target: aarch64
37+
- runner: ubuntu-22.04
38+
target: armv7
39+
# - runner: ubuntu-22.04
40+
# target: s390x
41+
- runner: ubuntu-22.04
42+
target: ppc64le
43+
steps:
44+
- uses: actions/checkout@v4
45+
- uses: actions/setup-python@v5
46+
with:
47+
python-version: 3.x
48+
- name: Build wheels
49+
uses: PyO3/maturin-action@v1
50+
with:
51+
working-directory: truss-transfer
52+
target: ${{ matrix.platform.target }}
53+
args: --release --out dist --find-interpreter
54+
sccache: 'true'
55+
manylinux: auto
56+
before-script-linux: |
57+
if command -v apt-get &> /dev/null; then
58+
apt-get update && apt-get install libssl-dev libatomic-ops-dev -y
59+
elif command -v yum &> /dev/null; then
60+
yum install openssl-devel devtoolset-10-libatomic-devel perl-IPC-Cmd -y
61+
else
62+
echo "Neither apt-get nor yum is installed. Please install a package manager."
63+
exit 1
64+
fi
65+
- name: Build free-threaded wheels
66+
uses: PyO3/maturin-action@v1
67+
with:
68+
working-directory: truss-transfer
69+
target: ${{ matrix.platform.target }}
70+
args: --release --out dist -i python3.13t
71+
sccache: 'true'
72+
manylinux: auto
73+
before-script-linux: |
74+
if command -v apt-get &> /dev/null; then
75+
apt-get update && apt-get install libssl-dev libatomic-ops-dev -y
76+
elif command -v yum &> /dev/null; then
77+
yum install openssl-devel devtoolset-10-libatomic-devel perl-IPC-Cmd -y
78+
else
79+
echo "Neither apt-get nor yum is installed. Please install a package manager."
80+
exit 1
81+
fi
82+
- name: Upload wheels
83+
uses: actions/upload-artifact@v4
84+
with:
85+
name: wheels-linux-${{ matrix.platform.target }}
86+
path: truss-transfer/dist
87+
88+
musllinux:
89+
runs-on: ${{ matrix.platform.runner }}
90+
strategy:
91+
matrix:
92+
platform:
93+
- runner: ubuntu-22.04
94+
target: x86_64
95+
- runner: ubuntu-22.04
96+
target: x86
97+
- runner: ubuntu-22.04
98+
target: aarch64
99+
- runner: ubuntu-22.04
100+
target: armv7
101+
steps:
102+
- uses: actions/checkout@v4
103+
- uses: actions/setup-python@v5
104+
with:
105+
python-version: 3.x
106+
- name: Build wheels
107+
uses: PyO3/maturin-action@v1
108+
with:
109+
working-directory: truss-transfer
110+
target: ${{ matrix.platform.target }}
111+
args: --release --out dist --find-interpreter
112+
sccache: 'true'
113+
manylinux: musllinux_1_2
114+
- name: Build free-threaded wheels
115+
uses: PyO3/maturin-action@v1
116+
with:
117+
working-directory: truss-transfer
118+
target: ${{ matrix.platform.target }}
119+
args: --release --out dist -i python3.13t
120+
sccache: 'true'
121+
manylinux: musllinux_1_2
122+
- name: Upload wheels
123+
uses: actions/upload-artifact@v4
124+
with:
125+
name: wheels-musllinux-${{ matrix.platform.target }}
126+
path: truss-transfer/dist
127+
128+
windows:
129+
runs-on: ${{ matrix.platform.runner }}
130+
strategy:
131+
matrix:
132+
platform:
133+
- runner: windows-latest
134+
target: x64
135+
- runner: windows-latest
136+
target: x86
137+
steps:
138+
- uses: actions/checkout@v4
139+
- uses: actions/setup-python@v5
140+
with:
141+
python-version: 3.x
142+
architecture: ${{ matrix.platform.target }}
143+
- name: Build wheels
144+
uses: PyO3/maturin-action@v1
145+
with:
146+
working-directory: truss-transfer
147+
target: ${{ matrix.platform.target }}
148+
args: --release --out dist --find-interpreter
149+
sccache: 'true'
150+
# - name: Build free-threaded wheels
151+
# uses: PyO3/maturin-action@v1
152+
# with:
153+
# target: ${{ matrix.platform.target }}
154+
# args: --release --out dist -i python3.13t
155+
# sccache: 'true'
156+
# working-directory: truss-transfer
157+
- name: Upload wheels
158+
uses: actions/upload-artifact@v4
159+
with:
160+
name: wheels-windows-${{ matrix.platform.target }}
161+
path: truss-transfer/dist
162+
163+
macos:
164+
runs-on: ${{ matrix.platform.runner }}
165+
strategy:
166+
matrix:
167+
platform:
168+
- runner: macos-13
169+
target: x86_64
170+
- runner: macos-14
171+
target: aarch64
172+
steps:
173+
- uses: actions/checkout@v4
174+
- uses: actions/setup-python@v5
175+
with:
176+
python-version: 3.x
177+
- name: Build wheels
178+
uses: PyO3/maturin-action@v1
179+
with:
180+
working-directory: truss-transfer
181+
target: ${{ matrix.platform.target }}
182+
args: --release --out dist --find-interpreter
183+
sccache: 'true'
184+
- name: Build free-threaded wheels
185+
uses: PyO3/maturin-action@v1
186+
with:
187+
working-directory: truss-transfer
188+
target: ${{ matrix.platform.target }}
189+
args: --release --out dist -i python3.13t
190+
sccache: 'true'
191+
- name: Upload wheels
192+
uses: actions/upload-artifact@v4
193+
with:
194+
name: wheels-macos-${{ matrix.platform.target }}
195+
path: truss-transfer/dist
196+
197+
sdist:
198+
runs-on: ubuntu-latest
199+
steps:
200+
- uses: actions/checkout@v4
201+
- name: Build sdist
202+
uses: PyO3/maturin-action@v1
203+
with:
204+
working-directory: truss-transfer
205+
command: sdist
206+
args: --out dist
207+
- name: Upload sdist
208+
uses: actions/upload-artifact@v4
209+
with:
210+
name: wheels-sdist
211+
path: truss-transfer/dist
212+
213+
release:
214+
name: Release
215+
runs-on: ubuntu-latest
216+
if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}
217+
needs: [linux, musllinux, windows, macos, sdist]
218+
permissions:
219+
# Use to sign the release artifacts
220+
id-token: write
221+
# Used to upload release artifacts
222+
contents: write
223+
# Used to generate artifact attestation
224+
attestations: write
225+
steps:
226+
- uses: actions/download-artifact@v4
227+
- name: Generate artifact attestation
228+
uses: actions/attest-build-provenance@v1
229+
with:
230+
subject-path: 'wheels-*/*'
231+
- name: Publish to PyPI
232+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
233+
uses: PyO3/maturin-action@v1
234+
env:
235+
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
236+
with:
237+
command: upload
238+
args: --non-interactive --skip-existing wheels-*/*
+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Test truss-transfer
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
pull_request:
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
defaults:
14+
run:
15+
working-directory: truss-transfer # Keeps default for run commands
16+
17+
jobs:
18+
test-truss-transfer:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v4
22+
- uses: actions/setup-python@v5
23+
with:
24+
python-version: '3.10'
25+
- name: Create venv
26+
run: python3 -m venv .venv
27+
- name: Build wheels
28+
uses: PyO3/maturin-action@v1
29+
with:
30+
working-directory: truss-transfer
31+
command: develop
32+
sccache: 'true'
33+
- name: Try import truss-transfer-maturin-publish
34+
run: |
35+
source .venv/bin/activate
36+
python -c "import truss_transfer; print(truss_transfer.__version__)"
37+
- name: Download github file & test real bptr resolution
38+
run: |
39+
sudo mkdir -p /bptr
40+
sudo chown $(whoami):$(whoami) /bptr
41+
cp ./exampe-bptr-manifest.json /bptr/exampe-bptr-manifest
42+
43+
source .venv/bin/activate
44+
python -c "import truss_transfer; truss_transfer.lazy_data_resolve('./tmp_no_cache/test', 4)"
45+
export BASETEN_FS_ENABLED=True
46+
python -c "import truss_transfer; truss_transfer.lazy_data_resolve('./tmp_fs_enabled/test', 32)"

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,5 @@ yarn.lock
7777
**/.chains_generated/**
7878

7979
.hypothesis
80+
81+
truss-transfer/target/

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "truss"
3-
version = "0.9.59.rc0"
3+
version = "0.9.59.rc0-013"
44
description = "A seamless bridge from model development to model delivery"
55
license = "MIT"
66
readme = "README.md"

0 commit comments

Comments
 (0)