diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml index 70640f767..794024adc 100644 --- a/.github/workflows/test-integration.yml +++ b/.github/workflows/test-integration.yml @@ -615,6 +615,43 @@ jobs: ./uv pip install packaging python -c 'import packaging' + integration-test-pyodide-windows: + name: "pyodide on windows" + timeout-minutes: 10 + runs-on: windows-latest + # Github Actions Windows runner uses D drive as pwd. + # Pyodide CLI has an issue running cross-drive, + # So ensure that cache and Pyodide paths are on D drive as well. + env: + UV_CACHE_DIR: D:\uv-cache + PYODIDE_XBUILDENV_PATH: D:\pyodide-xbuildenv + steps: + - name: "Download binary" + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + with: + name: uv-windows-x86_64-${{ inputs.sha }} + + - name: "Create a native virtual environment" + run: | + .\uv.exe venv venv-native -p 3.13 + .\uv.exe pip install -p venv-native\Scripts\python.exe pyodide-build==0.31.1 pip + + - name: "Install Pyodide interpreter" + run: | + & .\venv-native\Scripts\Activate.ps1 + pyodide xbuildenv install 0.29.2 + $env:PYODIDE_PYTHON = pyodide config get interpreter + $env:PYODIDE_INDEX = pyodide config get package_index + echo "PYODIDE_PYTHON=$env:PYODIDE_PYTHON" >> $env:GITHUB_ENV + echo "PYODIDE_INDEX=$env:PYODIDE_INDEX" >> $env:GITHUB_ENV + + - name: "Create Pyodide virtual environment" + run: | + .\uv.exe venv -p $env:PYODIDE_PYTHON venv-pyodide + & .\venv-pyodide\Scripts\Activate.ps1 + .\uv.exe pip install --extra-index-url=$env:PYODIDE_INDEX --no-build numpy + python -c 'import numpy' + integration-test-github-actions: name: "github actions" timeout-minutes: 10 diff --git a/Cargo.lock b/Cargo.lock index 8cfde08db..dc1d59831 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7182,6 +7182,7 @@ dependencies = [ "tracing", "uv-console", "uv-fs", + "uv-platform-tags", "uv-preview", "uv-pypi-types", "uv-python", diff --git a/crates/uv-platform/src/os.rs b/crates/uv-platform/src/os.rs index b064d1f50..cb993d0c1 100644 --- a/crates/uv-platform/src/os.rs +++ b/crates/uv-platform/src/os.rs @@ -30,12 +30,9 @@ impl Os { /// Whether this OS can run the other OS. pub fn supports(&self, other: Self) -> bool { - // Emscripten cannot run on Windows, but all other OSes can run Emscripten. + // Emscripten can run on any OS if other.is_emscripten() { - return !self.is_windows(); - } - if self.is_windows() && other.is_emscripten() { - return false; + return true; } // Otherwise, we require an exact match diff --git a/crates/uv-virtualenv/Cargo.toml b/crates/uv-virtualenv/Cargo.toml index 885ffa9e9..af6f1bd8f 100644 --- a/crates/uv-virtualenv/Cargo.toml +++ b/crates/uv-virtualenv/Cargo.toml @@ -20,6 +20,7 @@ workspace = true [dependencies] uv-console = { workspace = true } uv-fs = { workspace = true } +uv-platform-tags = { workspace = true } uv-preview = { workspace = true } uv-pypi-types = { workspace = true } uv-python = { workspace = true } diff --git a/crates/uv-virtualenv/src/virtualenv.rs b/crates/uv-virtualenv/src/virtualenv.rs index c5f457f8f..a83979916 100644 --- a/crates/uv-virtualenv/src/virtualenv.rs +++ b/crates/uv-virtualenv/src/virtualenv.rs @@ -12,6 +12,7 @@ use owo_colors::OwoColorize; use tracing::{debug, trace}; use uv_fs::{CWD, Simplified, cachedir}; +use uv_platform_tags::Os; use uv_preview::Preview; use uv_pypi_types::Scheme; use uv_python::managed::{PythonMinorVersionLink, create_link_to_executable}; @@ -314,6 +315,12 @@ pub(crate) fn create( create_link_to_executable(targetwt.as_path(), &executable_target) .map_err(Error::Python)?; } + } else if matches!(interpreter.platform().os(), Os::Pyodide { .. }) { + // For Pyodide, link only `python.exe`. + // This should not be copied as `python.exe` is a wrapper that launches Pyodide. + let target = scripts.join(WindowsExecutable::Python.exe(interpreter)); + create_link_to_executable(target.as_path(), &executable_target) + .map_err(Error::Python)?; } else { // Always copy `python.exe`. copy_launcher_windows(