Skip to content
Merged
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
78 changes: 78 additions & 0 deletions .github/workflows/typedpython-pypi.yml
Original file line number Diff line number Diff line change
@@ -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<version>`, 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/*
5 changes: 5 additions & 0 deletions docs/INTENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions python-multiplatform-ksp/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down