Skip to content

Experiment: spy wheel - #748

Draft
paugier wants to merge 25 commits into
spylang:mainfrom
paugier:exp-spy-wheel
Draft

paugier wants to merge 25 commits into
spylang:mainfrom
paugier:exp-spy-wheel

Conversation

@paugier

@paugier paugier commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

This is an experimental branch depending on #745 and #747. I create this draft PR to better study the changes and see the CI results.

With these changes, we can now build an usable wheel, for example with uv build --wheel. The wheel is universal and only contains the source files (Python, C and SPy) and

$ ls spylang-0.1.0-py3-none-any/spy/libspy/prebuilt/wasi/debug-testlib/
libspy.a  libspy.wasm

i.e. what is necessary for SPy interpreter. Other variants of libspy are built when needed and cached. The cache is located in the user home:

$ ls ~/.cache/spy/libspy/*
/home/users/augier3pi/.cache/spy/libspy/emscripten:
debug-28dc0446c23d01e0  debug-testlib-d1c20142461d6b2b  release-cf2821394bc0ed10

/home/users/augier3pi/.cache/spy/libspy/native:
debug-c0abb60fd0dc5dbb  release-80469d9596ee8100

/home/users/augier3pi/.cache/spy/libspy/native-static:
debug-5dade11080ac2ae8  release-6d5ed5e99bfcb634

/home/users/augier3pi/.cache/spy/libspy/wasi:
debug-0f9912bf5657c6b8  debug-testlib-4647250eef35dfec  release-c346bf682faf229f

Changes for SPy development

  • All libspy builds are done via spy/libspy/builder.py, which uses Ninja (and not make).

  • uv sync or pip install -e . builds all the standard variants into the cache through a hatchling hook (hatch_build.py), which uses spy/libspy/builder.py.

  • uv sync always rebuild all libspy build variants. make -C spy/libspy is now just a thin wrapper around python -m spy.libspy.builder.

  • The developer does not need to care about rebuild of libspy. A libspy build variant is rebuilt when needed (when the developer calls a spy command or pytest).

  • There is a mechanism to remove the old unnecessary builds from the cache so the cache does not grow infinitely.

  • There is a new command spy cache clear to clear the cache.

Changes for SPy users (people that want to try SPy locally)

  • Once a wheel is updated on PyPI, uv tool install spylang --prerelease allow would install SPy without any compilation.
  • The libspy build mechanism works for the wheel exactly the same way as for spy installed from the repo so spy build hello.spy, spy build --target wasi hello.spy or spy build --static hello.spy should work.

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Documentation Preview
Preview documentation for PR #748.
Last Updated: 2026-10-22 14:20 UTC

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant