diff --git a/.github/workflows/build-python-release.reusable.yaml b/.github/workflows/build-python-release.reusable.yaml index 14c03d284..53c8127c5 100644 --- a/.github/workflows/build-python-release.reusable.yaml +++ b/.github/workflows/build-python-release.reusable.yaml @@ -2,6 +2,8 @@ name: Release language_client_python on: workflow_call: {} + push: + branches: [sam/glibc-aarch64] concurrency: # suffix is important to prevent a concurrency deadlock with the calling workflow @@ -14,28 +16,41 @@ jobs: fail-fast: false matrix: _: - - runs_on: ubuntu-latest - target: x86_64 - name: x86_64-unknown-linux-gnu - manylinux: 'auto' + - target: x86_64-unknown-linux-gnu + runs_on: ubuntu-latest - - runs_on: ubuntu-latest - target: aarch64 - name: aarch64-unknown-linux-gnu - manylinux: '2_28' + - target: aarch64-unknown-linux-gnu + runs_on: ubuntu-latest + manylinux: 2_24 + # I'm not sure if this actually works; I can't 'pip install ./local-path.whl' + # from inside a container based off quay.io/pypa/manylinux2014_aarch64 + # see https://github.com/astral-sh/uv/issues/3439#issuecomment-2110448346 + # manylinux: 2_28 + # env: + # # Workaround ring 0.17 build issue + # # see https://github.com/briansmith/ring/issues/1728 + # CFLAGS_aarch64_unknown_linux_gnu: "-D__ARM_ARCH=8" - - runs_on: macos-latest - target: x86_64 - name: x86_64-apple-darwin + - target: x86_64-unknown-linux-musl + runs_on: ubuntu-latest + # see https://github.com/astral-sh/uv/blob/9bb55c4ac0582e05d1a7a5bbd99cc7b2c82f1847/.github/workflows/build-binaries.yml#L594 + manylinux: musllinux_1_1 - - runs_on: macos-latest - target: aarch64 - name: aarch64-apple-darwin - - - runs_on: windows-latest - target: x64 - name: x86_64-pc-windows-msvc + - target: aarch64-unknown-linux-musl + runs_on: ubuntu-latest + # see https://github.com/astral-sh/uv/blob/9bb55c4ac0582e05d1a7a5bbd99cc7b2c82f1847/.github/workflows/build-binaries.yml#L594 + manylinux: musllinux_1_1 + - target: x86_64-apple-darwin + runs_on: macos-latest + + - target: aarch64-apple-darwin + runs_on: macos-latest + + - target: x86_64-pc-windows-msvc + runs_on: windows-latest + + name: ${{ matrix._.target }} runs-on: ${{ matrix._.runs_on }} steps: - uses: actions/checkout@v4 @@ -46,10 +61,13 @@ jobs: - name: Build wheels uses: PyO3/maturin-action@v1 + env: ${{ matrix._.env || fromJSON('{}') }} with: target: ${{ matrix._.target }} command: build - args: --release --out engine/language_client_python/dist --manifest-path engine/language_client_python/Cargo.toml + # building in engine/ ensures that we pick up .cargo/config.toml + working-directory: engine + args: --release --out language_client_python/dist --manifest-path language_client_python/Cargo.toml sccache: "true" manylinux: ${{ matrix._.manylinux }} before-script-linux: | @@ -57,12 +75,13 @@ jobs: yum update -y && yum install -y perl-core openssl openssl-devel pkgconfig libatomic else # If we're running on debian-based system. - apt update -y && apt-get install -y libssl-dev openssl pkg-config + # sudo apt update -y && apt-get install -y libssl-dev openssl pkg-config + : fi - name: Upload wheels uses: actions/upload-artifact@v4 with: - name: wheels-${{ matrix._.name }} + name: wheels-${{ matrix._.target }} path: engine/language_client_python/dist - if-no-files-found: error \ No newline at end of file + if-no-files-found: error diff --git a/engine/.cargo/config.toml b/engine/.cargo/config.toml index 1261fea82..0054c35c5 100644 --- a/engine/.cargo/config.toml +++ b/engine/.cargo/config.toml @@ -1,3 +1,5 @@ +# https://github.com/rust-lang/cargo/issues/8607 +[target.x86_64-unknown-linux-musl] +rustflags = ["-C", "target-feature=-crt-static"] [target.aarch64-unknown-linux-musl] -linker = "aarch64-linux-musl-gcc" rustflags = ["-C", "target-feature=-crt-static"] diff --git a/integ-tests/python/docker-tests/aarch64-unknown-linux-gnu.Dockerfile b/integ-tests/python/docker-tests/aarch64-unknown-linux-gnu.Dockerfile new file mode 100644 index 000000000..877a40add --- /dev/null +++ b/integ-tests/python/docker-tests/aarch64-unknown-linux-gnu.Dockerfile @@ -0,0 +1,8 @@ +FROM quay.io/pypa/manylinux2014_aarch64 as base +RUN yum install python3-pip -y + +ADD ../baml_py-0.53.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl ./baml_py-0.53.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl +RUN pip3 install ./baml_py-0.53.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl + +ENV RUST_LOG=trace +RUN baml-cli --help \ No newline at end of file diff --git a/integ-tests/python/docker-tests/aarch64-unknown-linux-musl.Dockerfile b/integ-tests/python/docker-tests/aarch64-unknown-linux-musl.Dockerfile new file mode 100644 index 000000000..a4465e9fb --- /dev/null +++ b/integ-tests/python/docker-tests/aarch64-unknown-linux-musl.Dockerfile @@ -0,0 +1,8 @@ +FROM ghcr.io/rust-cross/rust-musl-cross:aarch64-musl as base +RUN yum install python3-pip -y + +ADD ../baml_py-0.53.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl ./baml_py-0.53.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl +RUN pip3 install ./baml_py-0.53.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl + +ENV RUST_LOG=trace +RUN baml-cli --help \ No newline at end of file diff --git a/integ-tests/python/docker-tests/python-3_10.Dockerfile b/integ-tests/python/docker-tests/python-3_10.Dockerfile new file mode 100644 index 000000000..6db5046ee --- /dev/null +++ b/integ-tests/python/docker-tests/python-3_10.Dockerfile @@ -0,0 +1,10 @@ +ARG PYTHON_VERSION=3.10 +FROM python:${PYTHON_VERSION} as base + +RUN apt-get update + +ADD ../baml_py-0.53.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl ./baml_py-0.53.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl +RUN pip install ./baml_py-0.53.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl + +ENV RUST_LOG=trace +RUN baml-cli --help \ No newline at end of file diff --git a/integ-tests/python/poetry.lock b/integ-tests/python/poetry.lock index aa14046b0..703a465c0 100644 --- a/integ-tests/python/poetry.lock +++ b/integ-tests/python/poetry.lock @@ -60,13 +60,13 @@ files = [ [[package]] name = "exceptiongroup" -version = "1.2.1" +version = "1.2.2" description = "Backport of PEP 654 (exception groups)" optional = false python-versions = ">=3.7" files = [ - {file = "exceptiongroup-1.2.1-py3-none-any.whl", hash = "sha256:5258b9ed329c5bbdd31a309f53cbfb0b155341807f6ff7606a1e801a891b29ad"}, - {file = "exceptiongroup-1.2.1.tar.gz", hash = "sha256:a4785e48b045528f5bfe627b6ad554ff32def154f42372786903b7abcfe1aa16"}, + {file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"}, + {file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"}, ] [package.extras] @@ -359,13 +359,13 @@ typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0" [[package]] name = "pytest" -version = "8.2.2" +version = "8.3.2" description = "pytest: simple powerful testing with Python" optional = false python-versions = ">=3.8" files = [ - {file = "pytest-8.2.2-py3-none-any.whl", hash = "sha256:c434598117762e2bd304e526244f67bf66bbd7b5d6cf22138be51ff661980343"}, - {file = "pytest-8.2.2.tar.gz", hash = "sha256:de4bb8104e201939ccdc688b27a89a7be2079b22e2bd2b07f806b6ba71117977"}, + {file = "pytest-8.3.2-py3-none-any.whl", hash = "sha256:4ba08f9ae7dcf84ded419494d229b48d0903ea6407b030eaec46df5e6a73bba5"}, + {file = "pytest-8.3.2.tar.gz", hash = "sha256:c132345d12ce551242c87269de812483f5bcc87cdbb4722e48487ba194f9fdce"}, ] [package.dependencies] @@ -373,7 +373,7 @@ colorama = {version = "*", markers = "sys_platform == \"win32\""} exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} iniconfig = "*" packaging = "*" -pluggy = ">=1.5,<2.0" +pluggy = ">=1.5,<2" tomli = {version = ">=1", markers = "python_version < \"3.11\""} [package.extras] @@ -381,13 +381,13 @@ dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments [[package]] name = "pytest-asyncio" -version = "0.23.7" +version = "0.23.8" description = "Pytest support for asyncio" optional = false python-versions = ">=3.8" files = [ - {file = "pytest_asyncio-0.23.7-py3-none-any.whl", hash = "sha256:009b48127fbe44518a547bddd25611551b0e43ccdbf1e67d12479f569832c20b"}, - {file = "pytest_asyncio-0.23.7.tar.gz", hash = "sha256:5f5c72948f4c49e7db4f29f2521d4031f1c27f86e57b046126654083d4770268"}, + {file = "pytest_asyncio-0.23.8-py3-none-any.whl", hash = "sha256:50265d892689a5faefb84df80819d1ecef566eb3549cf915dfb33569359d1ce2"}, + {file = "pytest_asyncio-0.23.8.tar.gz", hash = "sha256:759b10b33a6dc61cce40a8bd5205e302978bbbcc00e279a8b61d9a6a3c82e4d3"}, ] [package.dependencies] @@ -505,4 +505,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.9" -content-hash = "f1010cbc8be8e1834417568db7e031ae5c263c67eaf867c6cd78c1848b370602" +content-hash = "79f2b38be1fa46a75276a3f457fdda0d5da7fe520a3929babfe24bc83a938151" diff --git a/tools/install b/tools/install new file mode 100755 index 000000000..3b5ce6510 --- /dev/null +++ b/tools/install @@ -0,0 +1,63 @@ +#!/usr/bin/env /bin/bash + +set -euo pipefail + +show_help() { + cat <