Skip to content
Open
Changes from 1 commit
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
9 changes: 7 additions & 2 deletions guests/python/Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ SHA256_WASI_SDK_SYSROOT := "35172f7d2799485b15a46b1d87f50a585d915ec662080f005d99

PYTHON_VERSION_FULL := PYTHON_VERSION_MAJOR + "." + PYTHON_VERSION_MINOR + "." + PYTHON_VERSION_MICRO

# Configurable URLs for Python SDK downloads (with defaults)
Copy link

Copilot AI Nov 18, 2025

Choose a reason for hiding this comment

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

The new environment variables PYTHON_SDK_BASE_URL, PYTHON_SDK_URL, and BUILD_PYTHON_SDK_URL should be documented so users know they can configure custom download locations. Consider adding a section to guests/python/README.md under the "Build" section or to CONTRIBUTING.md explaining these configuration options and their use cases (e.g., using custom mirrors, air-gapped environments).

Suggested change
# Configurable URLs for Python SDK downloads (with defaults)
# Python SDK download URL configuration
#
# The following environment variables can be set to customize the download locations for the Python WASM SDK:
# - PYTHON_SDK_BASE_URL: Base URL for Python SDK releases (default: official GitHub release)
# - PYTHON_SDK_URL: Full URL for the pre-built Python SDK zip file
# - BUILD_PYTHON_SDK_URL: Full URL for the build Python SDK zip file
#
# These variables are useful for:
# - Using custom mirrors or internal artifact repositories
# - Building in air-gapped or restricted network environments
# - Overriding the default download source for testing or reliability
#
# Example usage:
# export PYTHON_SDK_BASE_URL="https://my-mirror.local/python-wasi"
# just build-release
#

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks copilot!

PYTHON_SDK_BASE_URL := env_var_or_default("PYTHON_SDK_BASE_URL", "https://github.com/brettcannon/cpython-wasi-build/releases/download")
PYTHON_SDK_URL := env_var_or_default("PYTHON_SDK_URL", PYTHON_SDK_BASE_URL + "/v" + PYTHON_VERSION_FULL + "/python-" + PYTHON_VERSION_FULL + "-wasi_sdk-" + WASI_SDK_VERSION_MAJOR + ".zip")
BUILD_PYTHON_SDK_URL := env_var_or_default("BUILD_PYTHON_SDK_URL", PYTHON_SDK_BASE_URL + "/v" + PYTHON_VERSION_FULL + "/_build-python-" + PYTHON_VERSION_FULL + "-wasi_sdk-" + WASI_SDK_VERSION_MAJOR + ".zip")

DOWNLOADS_DIR := source_directory() / "downloads"

export PYO3_CROSS_PYTHON_VERSION := PYTHON_VERSION_MAJOR + "." + PYTHON_VERSION_MINOR
Expand Down Expand Up @@ -49,7 +54,7 @@ download-python-sdk:
--tlsv1.2 \
--location \
--output "python-sdk.zip" \
"https://github.com/brettcannon/cpython-wasi-build/releases/download/v{{PYTHON_VERSION_FULL}}/python-{{PYTHON_VERSION_FULL}}-wasi_sdk-{{WASI_SDK_VERSION_MAJOR}}.zip"
"{{PYTHON_SDK_URL}}"

curl \
--fail \
Expand All @@ -59,7 +64,7 @@ download-python-sdk:
--tlsv1.2 \
--location \
--output "build-python-sdk.zip" \
"https://github.com/brettcannon/cpython-wasi-build/releases/download/v{{PYTHON_VERSION_FULL}}/_build-python-{{PYTHON_VERSION_FULL}}-wasi_sdk-{{WASI_SDK_VERSION_MAJOR}}.zip"
"{{BUILD_PYTHON_SDK_URL}}"

echo "{{SHA256_PYTHON_SDK}} python-sdk.zip" | sha256sum -c
echo "{{SHA256_PYTHON_SDK_BUILD}} build-python-sdk.zip" | sha256sum -c
Expand Down