From 2a75e573edcf6671501a2629ab2555297862ff95 Mon Sep 17 00:00:00 2001 From: BREW <81044362+b-re-w@users.noreply.github.com> Date: Fri, 30 Oct 2026 04:51:56 +0900 Subject: [PATCH] TypedPython: publish the package to PyPI by trusted publishing A typedpython-v* tag builds the wheel, checks that it alone compiles the release example, and publishes it. INTENT 1.4 records the maintainer's distribution decision. --- .github/workflows/typedpython-pypi.yml | 78 +++++++++++++++++++++++++ docs/INTENT.md | 5 ++ python-multiplatform-ksp/pyproject.toml | 6 ++ 3 files changed, 89 insertions(+) create mode 100644 .github/workflows/typedpython-pypi.yml diff --git a/.github/workflows/typedpython-pypi.yml b/.github/workflows/typedpython-pypi.yml new file mode 100644 index 000000000..b0f98705d --- /dev/null +++ b/.github/workflows/typedpython-pypi.yml @@ -0,0 +1,78 @@ +name: TypedPython to PyPI + +# Publishes the `typedpython` package (python-multiplatform-ksp/pyproject.toml) to PyPI. The package +# is versioned on its own, so it has its own tag: `typedpython-v`, pushed by the coordinator +# on a commit of main. PyPI trusted publishing: no token is stored; the `pypi` environment and the +# PyPI project's trusted publisher (this repository, this workflow file, environment `pypi`) must match. +# Only a wheel is published: it is pure Python (`py3-none-any`), and an sdist would carry the whole +# Kotlin module next to it. + +on: + push: + tags: + - 'typedpython-v*' + workflow_dispatch: + inputs: + tag: + description: 'Existing tag to build and publish (e.g. typedpython-v0.1.0)' + required: true + +permissions: + contents: read + +jobs: + build: + name: Build and check the wheel + runs-on: macos-latest + env: + TAG: ${{ github.event.inputs.tag || github.ref_name }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.tag || github.ref }} + + - name: Setup uv + uses: astral-sh/setup-uv@v6 + + - name: The tag names the package version + run: | + set -euo pipefail + version="$(sed -nE 's/^version = "(.*)"$/\1/p' python-multiplatform-ksp/pyproject.toml | head -1)" + test "$TAG" = "typedpython-v$version" || { echo "error: tag $TAG does not match typedpython $version" >&2; exit 1; } + + - name: Build + run: uv build --wheel --out-dir dist python-multiplatform-ksp + + - name: The wheel alone compiles the release example + run: | + set -euo pipefail + uv venv -q -p 3.15t "$RUNNER_TEMP/tpenv" + uv pip install -q --python "$RUNNER_TEMP/tpenv/bin/python" dist/typedpython-*.whl + "$RUNNER_TEMP/tpenv/bin/typedpython" demo --out "$RUNNER_TEMP/tpbuild" docs/release/desktop/typedpython/kernels.py 400000 | tee "$RUNNER_TEMP/tp.log" + grep -q '^compiled functions: .*dot' "$RUNNER_TEMP/tp.log" + grep -q '^identical output' "$RUNNER_TEMP/tp.log" + + - uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/ + + publish: + name: Publish to PyPI + needs: build + runs-on: ubuntu-latest + environment: pypi + permissions: + id-token: write + steps: + - uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + + - name: Setup uv + uses: astral-sh/setup-uv@v6 + + - name: Publish + run: uv publish --trusted-publishing always dist/* diff --git a/docs/INTENT.md b/docs/INTENT.md index cb707781c..5c45079d1 100644 --- a/docs/INTENT.md +++ b/docs/INTENT.md @@ -40,6 +40,11 @@ CPython interpreter inside a Kotlin Multiplatform application so that: is **checked** by default; **compiling** it to native code is opt-in. The compiled code still runs on the embedded CPython, as an extension module (`docs/design/typedpython.md`). + TypedPython reaches plain Python users as a **distribution**, not as a new interpreter (maintainer, + 2026-10-30: "배포판 방식을 생각했다는거야. 근데 일단 그렇게 하더라도 typedpython 패키지 형태라면 pypi + 배포를 해야겠지"). The thisisthepy CPython build ships with TypedPython in it, and the same + compiler is an ordinary `typedpython` package on PyPI (`uv add typedpython`). + 5. **High-performance kernels are written in Python too** (TypedPython tier 2). The maintainer first asked to explore it ("GPU 관련 최적화까지도 별도 언어 없이 지원할 방안을 모색해보자") and on 2026-10-04 made it a commitment ("GPU 커널 등 탐색을 약속으로 올려"), so that TypedPython can stand diff --git a/python-multiplatform-ksp/pyproject.toml b/python-multiplatform-ksp/pyproject.toml index d5fcbf41c..487554414 100644 --- a/python-multiplatform-ksp/pyproject.toml +++ b/python-multiplatform-ksp/pyproject.toml @@ -4,11 +4,17 @@ [project] name = "typedpython" version = "0.1.0" +description = "TypedPython: statically checked Python, with marked functions compiled to CPython extension modules" +license = "Apache-2.0" +authors = [{ name = "thisisthepy" }] requires-python = ">=3.13" # Pinned exactly: the gate reads Pyrefly's per-expression type report (--report-pysa), whose # format is versioned by Pyrefly, not by a public API. dependencies = ["pyrefly==1.3.2"] +[project.urls] +Homepage = "https://github.com/thisisthepy/python-multiplatform" + [project.scripts] typedpython = "typedpython.__main__:cli"