Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .github/workflows/python-pypi-publish-on-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
call-test-lint:
if: startsWith(github.event.release.tag_name, 'python/v')
if: startsWith(github.event.release.tag_name, 'python/v1.')
uses: ./.github/workflows/python-test-lint.yml
permissions:
contents: read
Expand All @@ -18,7 +18,7 @@ jobs:

build:
name: Build distribution
if: startsWith(github.event.release.tag_name, 'python/v')
if: startsWith(github.event.release.tag_name, 'python/v1.')
permissions:
contents: read
needs:
Expand Down
167 changes: 167 additions & 0 deletions .github/workflows/python-wasm-pypi-publish-on-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
name: "Python WASM: Publish Package"

on:
release:
types:
- published
workflow_dispatch:
inputs:
version:
description: "Version to build (e.g. 2.0.0-rc.1). Skips deploy."
required: true
type: string

jobs:
call-ts-check:
if: github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, 'python-wasm/v')
uses: ./.github/workflows/typescript-ts-check.yml
permissions:
contents: read
with:
ref: ${{ github.event.release.target_commitish || github.sha }}

call-ts-test:
Comment on lines +15 to +23
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to run these?

if: github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, 'python-wasm/v')
uses: ./.github/workflows/typescript-ts-test.yml
permissions:
contents: read
with:
ref: ${{ github.event.release.target_commitish || github.sha }}

call-py-check:
if: github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, 'python-wasm/v')
uses: ./.github/workflows/wasm-py-check.yml
permissions:
contents: read
with:
ref: ${{ github.event.release.target_commitish || github.sha }}

build-wasm:
name: Build WASM component
if: github.event_name == 'workflow_dispatch' || startsWith(github.event.release.tag_name, 'python-wasm/v')
needs:
- call-ts-check
- call-ts-test
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- uses: actions/checkout@v6
with:
persist-credentials: false

- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: '22'
package-manager-cache: false

- name: Install dependencies
run: npm ci

- name: Build TypeScript SDK
run: npm run build -w strands-ts

- name: Build WASM component
run: npm run build -w strands-wasm

- name: Upload WASM artifact
uses: actions/upload-artifact@v7
with:
name: strands-agent-wasm
path: strands-wasm/dist/strands-agent.wasm

build-wheel:
name: Build Python wheel
needs:
- build-wasm
- call-py-check
runs-on: ubuntu-latest
permissions:
contents: read
defaults:
run:
working-directory: strands-py-wasm

steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install hatch

- name: Copy root LICENSE and NOTICE
run: |
cp ../LICENSE.APACHE LICENSE.APACHE
cp ../NOTICE .

- name: Download WASM artifact
uses: actions/download-artifact@v8
with:
name: strands-agent-wasm
path: strands-wasm/dist/

- name: Extract version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ inputs.version }}"
else
VERSION=${GITHUB_REF#refs/tags/python-wasm/v}
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Extracted version: $VERSION"

- name: Validate version
run: |
if [[ ${{ steps.version.outputs.version }} =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ ]]; then
echo "Valid version format"
exit 0
else
echo "Invalid version format"
exit 1
fi

- name: Stamp version
run: sed -i 's/^version = .*/version = "${{ steps.version.outputs.version }}"/' pyproject.toml

- name: Build
run: hatch build

- name: Store the distribution packages
uses: actions/upload-artifact@v7
with:
name: python-wasm-package-distributions
path: strands-py-wasm/dist/

deploy:
name: Upload release to PyPI
if: github.event_name != 'workflow_dispatch'
needs:
- build-wheel
runs-on: ubuntu-latest

environment:
name: pypi-wasm
url: https://pypi.org/p/strands-agents-wasm
permissions:
id-token: write

steps:
- name: Download all the dists
uses: actions/download-artifact@v8
with:
name: python-wasm-package-distributions
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
11 changes: 3 additions & 8 deletions strands-py-wasm/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ build-backend = "hatchling.build"


[project]
name = "strands-agents"
version = "2.0.0a1"
name = "strands-agents-wasm"
version = "0.0.1"
description = "A model-driven approach to building AI agents in just a few lines of code"
requires-python = ">=3.10"
license = "Apache-2.0"
Expand All @@ -28,8 +28,7 @@ classifiers = [
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = [
# Imports as `wasmtime`. Pinned to pgrayy/wasm-deps git URL until upstream PRs land.
"pgrayy-wasmtime @ git+https://github.com/pgrayy/wasm-deps.git@4b5dc41512109ebafe4c4f1edd592c739872c640#subdirectory=wasmtime-py",
"pgrayy-wasmtime>=46.0.7,<48.0.0",
"botocore>=1.29.0,<2.0.0",
]

Expand All @@ -44,10 +43,6 @@ Homepage = "https://github.com/strands-agents/sdk-python"
Documentation = "https://strandsagents.com"


[tool.hatch.metadata]
# pgrayy-wasmtime is pinned via a git URL until upstream PRs land.
allow-direct-references = true

[tool.hatch.build.targets.wheel]
packages = ["src/strands"]

Expand Down
Loading