Skip to content

Commit bf419ad

Browse files
author
Ayush Jha
authored
Merge pull request #704 from ayys/run-on-m1-with-python-3.11
Support for python 3.11
2 parents 1f2f0a5 + f4b595e commit bf419ad

File tree

11 files changed

+160
-115
lines changed

11 files changed

+160
-115
lines changed

.github/workflows/release.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111

1212
strategy:
1313
matrix:
14-
python: ["3.7", "3.8", "3.9", "3.10"]
14+
python: ["3.7", "3.8", "3.9", "3.10", "3.11"]
1515
target:
1616
- id: 'linux-amd64'
17-
os: 'ubuntu-18.04'
17+
os: 'ubuntu-latest'
1818
target-name: 'x86_64-unknown-linux-gnu'
1919
rust-toolchain: 'stable'
2020
llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz'
@@ -138,7 +138,7 @@ jobs:
138138
export PATH="$HOME/.pyenv/versions/$(cat .python-version)/bin:$PATH"
139139
if test -d .env/bin/; then source .env/bin/activate; else source .env/Scripts/activate; fi
140140
maturin list-python
141-
PYTHON_INTERPRETER=$(maturin list-python | grep -o "CPython $(cat .python-version | grep -o -E '^[^\.]+\.[^\.]+').* at .*" | cut -d' ' -f 4 | tr '\\' '/')
141+
PYTHON_INTERPRETER=$(maturin list-python 2>&1 | grep -o "CPython $(cat .python-version | grep -o -E '^[^\.]+\.[^\.]+').* at .*" | cut -d' ' -f 4 | tr '\\' '/')
142142
echo "Selected interpreter: ${PYTHON_INTERPRETER}"
143143
just build-all "${{ matrix.target.target-name }}"
144144
@@ -157,7 +157,7 @@ jobs:
157157
export PATH="$HOME/.pyenv/versions/$(cat .python-version)/bin:$PATH"
158158
if test -d .env/bin/; then source .env/bin/activate; else source .env/Scripts/activate; fi
159159
maturin list-python
160-
PYTHON_INTERPRETER=$(maturin list-python | grep -o "CPython $(cat .python-version | grep -o -E '^[^\.]+\.[^\.]+').* at .*" | cut -d' ' -f 4 | tr '\\' '/')
160+
PYTHON_INTERPRETER=$(maturin list-python 2>&1 | grep -o "CPython $(cat .python-version | grep -o -E '^[^\.]+\.[^\.]+').* at .*" | cut -d' ' -f 4 | tr '\\' '/')
161161
echo "Selected interpreter: ${PYTHON_INTERPRETER}"
162162
just build-all-wheels "${PYTHON_INTERPRETER}" "${{ matrix.target.target-name }}"
163163
just build-any-wheel
@@ -178,7 +178,7 @@ jobs:
178178
release:
179179
name: Release
180180

181-
runs-on: ubuntu-18.04
181+
runs-on: ubuntu-latest
182182

183183
needs: [build]
184184

@@ -206,13 +206,13 @@ jobs:
206206
- name: Set current Python version
207207
shell: bash
208208
run: |
209-
echo "3.9" > .python-version
209+
echo "3.11" > .python-version
210210
211211
- name: Set up Python ${{ matrix.python }} (amd64)
212212
if: matrix.target.id != 'linux-aarch64'
213213
uses: actions/setup-python@v1
214214
with:
215-
python-version: 3.9
215+
python-version: 3.11
216216

217217
- name: Set up Python ${{ matrix.python }} (aarch64)
218218
if: matrix.target.id == 'linux-aarch64'
@@ -222,7 +222,7 @@ jobs:
222222
export PATH="$HOME/.pyenv/bin:$PATH"
223223
eval "$(pyenv init -)"
224224
eval "$(pyenv virtualenv-init -)"
225-
pyenv install --list | grep '^ 3.9' | tail -n 1 | tr -d '[:space:]' > .python-version
225+
pyenv install --list | grep '^ 3.11' | tail -n 1 | tr -d '[:space:]' > .python-version
226226
pyenv install --skip-existing "$(cat .python-version)"
227227
228228
# Caching is disabled because it interferes with artifact creation

.github/workflows/test.yml

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,21 @@ on:
1111
branches:
1212
- '**'
1313

14+
# Allow one concurrent deployment
15+
concurrency:
16+
group: ${{ github.ref }}-test
17+
cancel-in-progress: true
18+
1419
jobs:
1520
test:
1621
name: Build and Test
1722

1823
strategy:
1924
matrix:
20-
python: ["3.7", "3.8", "3.9", "3.10"]
25+
python: ["3.7", "3.8", "3.9", "3.10", "3.11"]
2126
target:
2227
- id: 'linux-amd64'
23-
os: 'ubuntu-18.04'
28+
os: 'ubuntu-latest'
2429
target-name: 'x86_64-unknown-linux-gnu'
2530
rust-toolchain: 'stable'
2631
llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz'
@@ -43,7 +48,7 @@ jobs:
4348
rust-toolchain: 'stable'
4449
# llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/11.x/windows-amd64.tar.gz'
4550
llvm_choco_version: 13.0.0
46-
fail-fast: true
51+
fail-fast: false
4752

4853
runs-on: ${{ matrix.target.os }}
4954

@@ -67,7 +72,9 @@ jobs:
6772
target: ${{ matrix.target.target-name }}
6873

6974
# Caching is disabled because it interferes with artifact creation
70-
#- uses: Swatinem/rust-cache@v1
75+
# - uses: Swatinem/rust-cache@v2
76+
# with:
77+
# shared-key: "rust-cache"
7178

7279
- name: Set current Python version
7380
shell: bash
@@ -76,9 +83,10 @@ jobs:
7683
7784
- name: Set up Python ${{ matrix.python }} (amd64)
7885
if: matrix.target.id != 'linux-aarch64'
79-
uses: actions/setup-python@v1
86+
uses: actions/setup-python@v4
8087
with:
8188
python-version: ${{ matrix.python }}
89+
architecture: x64
8290

8391
- name: Set up Python ${{ matrix.python }} (aarch64)
8492
if: matrix.target.id == 'linux-aarch64'
@@ -91,6 +99,21 @@ jobs:
9199
pyenv install --list | grep '^ ${{ matrix.python }}' | tail -n 1 | tr -d '[:space:]' > .python-version
92100
pyenv install --skip-existing "$(cat .python-version)"
93101
102+
- name: Validate python version
103+
run: |
104+
$pythonVersionFull = (python --version)
105+
$pythonVersion = $pythonVersionFull -replace '\.(\d+)$',''
106+
if ("Python ${{ matrix.python }}" -ne "$pythonVersion"){
107+
Write-Host "The current version is $pythonVersion; expected version is ${{ matrix.python }}"
108+
exit 1
109+
}
110+
$pythonVersion
111+
shell: pwsh
112+
- name: Print python version (verbose)
113+
run: |
114+
python -VV
115+
shell: pwsh
116+
94117
- name: Install LLVM (Choco - Windows)
95118
if: matrix.target.llvm_choco_version
96119
shell: bash
@@ -99,10 +122,7 @@ jobs:
99122
cd 'C:\Program Files\LLVM\'
100123
LLVM_DIR=$(pwd)
101124
echo "LLVM_SYS_120_PREFIX=${LLVM_DIR}" >> $GITHUB_ENV
102-
- name: Install LLVM (macOS Apple Silicon)
103-
if: matrix.target.os == 'macos-latest' && !matrix.target.llvm_url
104-
run: |
105-
brew install llvm
125+
106126
- name: Install LLVM
107127
if: matrix.target.llvm_url
108128
shell: bash
@@ -143,14 +163,15 @@ jobs:
143163
export PATH="$HOME/.pyenv/versions/$(cat .python-version)/bin:$PATH"
144164
just prelude
145165
166+
146167
- name: Compile the library
147168
shell: bash
148169
run: |
149170
export PATH="$HOME/.cargo/bin:$PATH"
150171
export PATH="$HOME/.pyenv/versions/$(cat .python-version)/bin:$PATH"
151172
if test -d .env/bin/; then source .env/bin/activate; else source .env/Scripts/activate; fi
152173
maturin list-python
153-
PYTHON_INTERPRETER=$(maturin list-python | grep -o "CPython $(cat .python-version | grep -o -E '^[^\.]+\.[^\.]+').* at .*" | cut -d' ' -f 4 | tr '\\' '/')
174+
PYTHON_INTERPRETER=$(maturin list-python 2>&1 | grep -o "CPython $(cat .python-version | grep -o -E '^[^\.]+\.[^\.]+').* at .*" | cut -d' ' -f 4 | tr '\\' '/')
154175
echo "Selected interpreter: ${PYTHON_INTERPRETER}"
155176
just build-all "${{ matrix.target.target-name }}"
156177
@@ -169,7 +190,7 @@ jobs:
169190
export PATH="$HOME/.pyenv/versions/$(cat .python-version)/bin:$PATH"
170191
if test -d .env/bin/; then source .env/bin/activate; else source .env/Scripts/activate; fi
171192
maturin list-python
172-
PYTHON_INTERPRETER=$(maturin list-python | grep -o "CPython $(cat .python-version | grep -o -E '^[^\.]+\.[^\.]+').* at .*" | cut -d' ' -f 4 | tr '\\' '/')
193+
PYTHON_INTERPRETER=$(maturin list-python 2>&1 | grep -o "CPython $(cat .python-version | grep -o -E '^[^\.]+\.[^\.]+').* at .*" | cut -d' ' -f 4 | tr '\\' '/')
173194
echo "Selected interpreter: ${PYTHON_INTERPRETER}"
174195
just build-all-wheels "${PYTHON_INTERPRETER}" "${{ matrix.target.target-name }}"
175196
just build-any-wheel
@@ -190,7 +211,7 @@ jobs:
190211
prerelease:
191212
name: Pre-Release
192213

193-
runs-on: ubuntu-18.04
214+
runs-on: ubuntu-latest
194215
if: startsWith(github.ref, 'refs/heads/prepare-')
195216

196217
needs: [test]
@@ -212,13 +233,13 @@ jobs:
212233
- name: Set current Python version
213234
shell: bash
214235
run: |
215-
echo "3.9" > .python-version
236+
echo "3.11" > .python-version
216237
217238
- name: Set up Python ${{ matrix.python }} (amd64)
218239
if: matrix.target.id != 'linux-aarch64'
219-
uses: actions/setup-python@v1
240+
uses: actions/setup-python@v4
220241
with:
221-
python-version: 3.9
242+
python-version: 3.11
222243

223244
- name: Set up Python ${{ matrix.python }} (aarch64)
224245
if: matrix.target.id == 'linux-aarch64'
@@ -228,7 +249,7 @@ jobs:
228249
export PATH="$HOME/.pyenv/bin:$PATH"
229250
eval "$(pyenv init -)"
230251
eval "$(pyenv virtualenv-init -)"
231-
pyenv install --list | grep '^ 3.9' | tail -n 1 | tr -d '[:space:]' > .python-version
252+
pyenv install --list | grep '^ 3.11' | tail -n 1 | tr -d '[:space:]' > .python-version
232253
pyenv install --skip-existing "$(cat .python-version)"
233254
234255
# Caching is disabled because it interferes with artifact creation

justfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ prelude:
66
pip3 install virtualenv
77
virtualenv .env
88
if test -d .env/bin/; then source .env/bin/activate; else source .env/Scripts/activate; fi
9-
pip3 install maturin==0.12.20 pytest pytest-benchmark twine pdoc
9+
pip3 install maturin==0.14.17 pytest pytest-benchmark twine pdoc
1010

1111
which maturin
1212
maturin --version
@@ -65,7 +65,7 @@ build package='api' rust_target=`rustc -vV | awk '/^host/ { print $2 }'`:
6565

6666
cd packages/{{package}}/
6767

68-
maturin develop --binding-crate pyo3 --release --strip --cargo-extra-args="${build_args}"
68+
maturin develop --binding-crate pyo3 --release --strip
6969

7070
# Build all the wheels.
7171
build-all-wheels python_version rust_target:
@@ -108,7 +108,7 @@ build-wheel package python_version rust_target:
108108

109109
cd packages/{{package}}
110110

111-
maturin build --bindings pyo3 --release --target "{{ rust_target }}" --strip --cargo-extra-args="${build_args}" --interpreter "{{python_version}}"
111+
maturin build --bindings pyo3 --release --target "{{ rust_target }}" --strip --interpreter "{{python_version}}"
112112

113113
# Create a distribution of wasmer that can be installed anywhere (it will fail on import)
114114
build-any-wheel:

packages/api/Cargo.toml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,3 @@ cfg-if = "1.0"
2727

2828
[build-dependencies]
2929
pyo3-build-config = "0.15"
30-
31-
[package.metadata.maturin]
32-
classifier = [
33-
"Programming Language :: Python",
34-
"Programming Language :: Python :: 3",
35-
"Programming Language :: Python :: 3.7",
36-
"Programming Language :: Python :: 3.8",
37-
"Programming Language :: Python :: 3.9",
38-
"Programming Language :: Python :: 3.10",
39-
"Programming Language :: Python :: Implementation :: CPython",
40-
"Programming Language :: Rust",
41-
"Topic :: Software Development",
42-
"Topic :: Software Development :: Compilers",
43-
"Topic :: Software Development :: Interpreters",
44-
"License :: OSI Approved :: MIT License",
45-
"Operating System :: OS Independent",
46-
]
47-
48-
[package.metadata.maturin.project-url]
49-
"Source Code" = "https://github.com/wasmerio/wasmer-python/"
50-
"Bug Tracker" = "https://github.com/wasmerio/wasmer-python/issues"
51-
"Documentation" = "https://github.com/wasmerio/wasmer-python/"

packages/api/pyproject.toml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[package]
2+
edition = "2018"
3+
4+
[build-system]
5+
requires = ["maturin>=0.14,<0.15"]
6+
build-backend = "maturin"
7+
8+
[tool.maturin.metadata]
9+
category = ["Programming Language :: Python",
10+
"Programming Language :: Python :: 3",
11+
"Programming Language :: Python :: 3.7",
12+
"Programming Language :: Python :: 3.8",
13+
"Programming Language :: Python :: 3.9",
14+
"Programming Language :: Python :: 3.10",
15+
"Programming Language :: Python :: 3.11",
16+
"Programming Language :: Python :: Implementation :: CPython",
17+
"Programming Language :: Rust",
18+
"Topic :: Software Development",
19+
"Topic :: Software Development :: Compilers",
20+
"Topic :: Software Development :: Interpreters",
21+
"License :: OSI Approved :: MIT License",
22+
"Operating System :: OS Independent"]
23+
24+
25+
[tool.maturin.project-url]
26+
"Source Code" = "https://github.com/wasmerio/wasmer-python/"
27+
"Bug Tracker" = "https://github.com/wasmerio/wasmer-python/issues"
28+
"Documentation" = "https://github.com/wasmerio/wasmer-python/"

packages/compiler-cranelift/Cargo.toml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,3 @@ crate-type = ["cdylib"]
1818
wasmer-engines = { path = "../engines/" }
1919
wasmer-compiler-cranelift = "2.1.1"
2020
pyo3 = { version = "0.14", features = ["extension-module"] }
21-
22-
[package.metadata.maturin]
23-
classifier = [
24-
"Programming Language :: Python",
25-
"Programming Language :: Python :: 3",
26-
"Programming Language :: Python :: 3.7",
27-
"Programming Language :: Python :: 3.8",
28-
"Programming Language :: Python :: 3.9",
29-
"Programming Language :: Python :: 3.10",
30-
"Programming Language :: Python :: Implementation :: CPython",
31-
"Programming Language :: Rust",
32-
"Topic :: Software Development",
33-
"Topic :: Software Development :: Compilers",
34-
"Topic :: Software Development :: Interpreters",
35-
"License :: OSI Approved :: MIT License",
36-
"Operating System :: OS Independent",
37-
]
38-
39-
[package.metadata.maturin.project-url]
40-
"Source Code" = "https://github.com/wasmerio/wasmer-python/"
41-
"Bug Tracker" = "https://github.com/wasmerio/wasmer-python/issues"
42-
"Documentation" = "https://github.com/wasmerio/wasmer-python/"
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[package]
2+
edition = "2018"
3+
4+
[build-system]
5+
requires = ["maturin>=0.14,<0.15"]
6+
build-backend = "maturin"
7+
8+
[tool.maturin.metadata]
9+
category = ["Programming Language :: Python",
10+
"Programming Language :: Python :: 3",
11+
"Programming Language :: Python :: 3.7",
12+
"Programming Language :: Python :: 3.8",
13+
"Programming Language :: Python :: 3.9",
14+
"Programming Language :: Python :: 3.10",
15+
"Programming Language :: Python :: 3.11",
16+
"Programming Language :: Python :: Implementation :: CPython",
17+
"Programming Language :: Rust",
18+
"Topic :: Software Development",
19+
"Topic :: Software Development :: Compilers",
20+
"Topic :: Software Development :: Interpreters",
21+
"License :: OSI Approved :: MIT License",
22+
"Operating System :: OS Independent"]
23+
24+
25+
[tool.maturin.project-url]
26+
"Source Code" = "https://github.com/wasmerio/wasmer-python/"
27+
"Bug Tracker" = "https://github.com/wasmerio/wasmer-python/issues"
28+
"Documentation" = "https://github.com/wasmerio/wasmer-python/"

packages/compiler-llvm/Cargo.toml

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,3 @@ crate-type = ["cdylib"]
1818
wasmer-engines = { path = "../engines/" }
1919
wasmer-compiler-llvm = "2.1.1"
2020
pyo3 = { version = "0.14", features = ["extension-module"] }
21-
22-
[package.metadata.maturin]
23-
classifier = [
24-
"Programming Language :: Python",
25-
"Programming Language :: Python :: 3",
26-
"Programming Language :: Python :: 3.7",
27-
"Programming Language :: Python :: 3.8",
28-
"Programming Language :: Python :: 3.9",
29-
"Programming Language :: Python :: 3.10",
30-
"Programming Language :: Python :: Implementation :: CPython",
31-
"Programming Language :: Rust",
32-
"Topic :: Software Development",
33-
"Topic :: Software Development :: Compilers",
34-
"Topic :: Software Development :: Interpreters",
35-
"License :: OSI Approved :: MIT License",
36-
"Operating System :: OS Independent",
37-
]
38-
39-
[package.metadata.maturin.project-url]
40-
"Source Code" = "https://github.com/wasmerio/wasmer-python/"
41-
"Bug Tracker" = "https://github.com/wasmerio/wasmer-python/issues"
42-
"Documentation" = "https://github.com/wasmerio/wasmer-python/"

0 commit comments

Comments
 (0)