From 47fb443a5361bbd92e4a82fe528f7e49c10924e3 Mon Sep 17 00:00:00 2001 From: "ark-hand[bot]" <315378070+ark-hand[bot]@users.noreply.github.com> Date: Wed, 19 Aug 2026 16:33:36 +0800 Subject: [PATCH] chore: sync from ark-apis 59c90de5ac Auto-generated SDK sync from ark-apis at 59c90de5ac837a87443bd463e4500f6ef6eceda6. Generated files are overwritten by the sync pipeline and should not be edited by hand. Sync-Source-Commit: a4af56f33cb5a17e0cb8a5c667f8bf5cd6d00d2f Ark-APIs-Commit: 59c90de5ac837a87443bd463e4500f6ef6eceda6 Release-Version: 0.2.0 --- .github/workflows/release.yml | 94 ++++++++++++++++++++++++++++ VERSION | 2 +- pyproject.toml | 2 +- src/arkruntime/types/images/usage.py | 4 +- uv.lock | 2 +- 5 files changed, 99 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..9635d8e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,94 @@ +name: Python Release + +# Publishes the arkruntime package to PyPI (pypi.org/project/arkruntime, +# maintained by the volcengine account). Tags are created exclusively by +# ark-hand after a sync PR lands on main, so a pushed v* tag is always a +# reviewed release snapshot whose tree matches the internal source tree. +# +# The workflow_dispatch input allows re-publishing (or first-publishing) +# an existing tag — e.g. when the PYPI_API_TOKEN secret was missing when +# the tag was originally pushed. The workflow definition runs from the +# ref the dispatch targets, while the build checks out the named tag. +on: + push: + tags: + - "v*" + workflow_dispatch: + inputs: + tag: + description: "Release tag to publish (must already exist, e.g. v0.2.0)" + required: true + type: string + +permissions: + contents: read + +# Never cancel an in-flight publish; a second dispatch for the same tag +# should queue behind it instead of racing the upload. +concurrency: + group: python-release-${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }} + cancel-in-progress: false + +jobs: + release: + name: Build and publish to PyPI + runs-on: ubuntu-latest + timeout-minutes: 15 + + steps: + - name: Resolve release tag + id: tag + env: + DISPATCH_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || '' }} + run: | + tag="${DISPATCH_TAG:-${GITHUB_REF_NAME}}" + case "${tag}" in + v[0-9]*.[0-9]*.0) ;; + *) + echo "::error::${tag} is not a release tag (expected vMAJOR.MINOR.0)" + exit 1 + ;; + esac + echo "name=${tag}" >> "$GITHUB_OUTPUT" + + - name: Check out repository + uses: actions/checkout@v4 + with: + ref: ${{ steps.tag.outputs.name }} + + - name: Verify pyproject version matches tag + env: + RELEASE_TAG: ${{ steps.tag.outputs.name }} + run: | + version="${RELEASE_TAG#v}" + if ! grep -Eq "^version = \"${version}\"$" pyproject.toml; then + echo "::error::pyproject.toml version does not match tag ${RELEASE_TAG}" + grep -n '^version' pyproject.toml || true + exit 1 + fi + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install uv + run: python -m pip install --disable-pip-version-check --quiet uv + + - name: Build sdist and wheel + run: uv build + + - name: Check PyPI token + env: + PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} + run: | + if [ -z "${PYPI_API_TOKEN}" ]; then + echo "::error::secret PYPI_API_TOKEN is not configured on this repository" + exit 1 + fi + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} + attestations: false diff --git a/VERSION b/VERSION index 6e8bf73..0ea3a94 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.0 +0.2.0 diff --git a/pyproject.toml b/pyproject.toml index 4a8bedb..4231281 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "arkruntime" -version = "0.1.0" +version = "0.2.0" description = "Ark runtime SDK for Python" readme = "README.md" requires-python = ">=3.8" diff --git a/src/arkruntime/types/images/usage.py b/src/arkruntime/types/images/usage.py index 0d1cad0..9ae6a62 100644 --- a/src/arkruntime/types/images/usage.py +++ b/src/arkruntime/types/images/usage.py @@ -14,9 +14,9 @@ class Usage(BaseModel): - input_images: int + input_images: Optional[int] = None """ - Number of reference images supplied by the client. + Number of reference images supplied by the client. May be absent in responses from older services. """ generated_images: int """ diff --git a/uv.lock b/uv.lock index 2d1d8da..cb674d3 100644 --- a/uv.lock +++ b/uv.lock @@ -73,7 +73,7 @@ wheels = [ [[package]] name = "arkruntime" -version = "0.1.0" +version = "0.2.0" source = { editable = "." } dependencies = [ { name = "anyio", version = "4.5.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.9'" },