Unverified 提交 29183c72 authored 作者: Thomas Wiecki's avatar Thomas Wiecki 提交者: GitHub

Add building of pyodide universal wheels (#918)

* Add building of pyodide universal wheels * precommit * Fix precommit. Readd comment. * Fix precommit2 * Minor improvement to ext_modules conditional definition * Bump Python version so that tomllib is included This way versioneer can read pyproject.toml * Add wheel package to build dependencies * Update .github/workflows/pypi.yml * Revert unnecessary * ruff --------- Co-authored-by: 's avatarBen Mares <services-git-throwaway1@tensorial.com>
上级 7fffec61
......@@ -57,6 +57,31 @@ jobs:
name: wheels-${{ matrix.platform }}
path: ./wheelhouse/*.whl
build_universal_wheel:
name: Build universal wheel for Pyodide
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: pip install numpy versioneer wheel
- name: Build universal wheel
run: |
PYODIDE=1 python setup.py bdist_wheel --universal
- uses: actions/upload-artifact@v4
with:
name: universal_wheel
path: dist/*.whl
check_dist:
name: Check dist
needs: [make_sdist,build_wheels]
......@@ -103,6 +128,11 @@ jobs:
path: dist
merge-multiple: true
- uses: actions/download-artifact@v4
with:
name: universal_wheel
path: dist
- uses: pypa/gh-action-pypi-publish@v1.9.0
with:
user: __token__
......
#!/usr/bin/env python
import os
import numpy
import versioneer
from setuptools import Extension, setup
......@@ -11,17 +13,26 @@ dist.parse_config_files()
NAME: str = dist.get_name() # type: ignore
# Check if building for Pyodide
is_pyodide = os.getenv("PYODIDE", "0") == "1"
if is_pyodide:
# For pyodide we build a universal wheel that must be pure-python
# so we must omit the cython-version of scan.
ext_modules = []
else:
ext_modules = [
Extension(
name="pytensor.scan.scan_perform",
sources=["pytensor/scan/scan_perform.pyx"],
include_dirs=[numpy.get_include()],
),
]
if __name__ == "__main__":
setup(
name=NAME,
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
ext_modules=[
Extension(
name="pytensor.scan.scan_perform",
sources=["pytensor/scan/scan_perform.pyx"],
include_dirs=[numpy.get_include()],
),
],
ext_modules=ext_modules,
)
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论