Skip to content

Commit fd65206

Browse files
committed
Address PR review feedback
- Restore pixi references in docs and warnings (previously removed without explanation) - Restore helpful workflow comments in pypi.yml - Move Pyodide build docs from dev_start_guide to install.rst (more appropriate location) - Add user-facing WASM/Pyodide installation instructions in install.rst
1 parent 0cc4402 commit fd65206

File tree

6 files changed

+24
-51
lines changed

6 files changed

+24
-51
lines changed

.github/workflows/pypi.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,12 @@ jobs:
144144
build_pyodide_wheel:
145145
name: Build Pyodide (WASM) wheel
146146
needs: check_changes
147+
# Run if it's a release or if relevant files changed on main
147148
if: |
148149
needs.check_changes.outputs.should_run == 'true'
149150
runs-on: ubuntu-latest
150151
permissions:
152+
# write id-token and attestations are required to attest build provenance
151153
id-token: write
152154
attestations: write
153155
steps:

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ repos:
2525
rev: v1.0.0
2626
hooks:
2727
- id: sphinx-lint
28-
args: ["."]
28+
args: ["-i", ".pixi", "."]
2929
- repo: https://github.com/astral-sh/ruff-pre-commit
3030
rev: v0.14.0
3131
hooks:

doc/dev_start_guide.rst

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -222,54 +222,6 @@ Afterward, you can go to `html/index.html` and navigate the changes in a browser
222222
**Do not commit the `html` directory. The documentation is built automatically.**
223223
For more documentation customizations such as different formats e.g., PDF, refer to the `Sphinx documentation <https://www.sphinx-doc.org/en/master/usage/builders/index.html>`_.
224224

225-
Building a WebAssembly (Pyodide) wheel
226-
--------------------------------------
227-
228-
To build a wheel targeting WebAssembly for use with `Pyodide <https://pyodide.org/>`_ (e.g. for the browser or JupyterLite), use the Pyodide build tooling. This produces a wheel in ``dist/`` with a name like ``*-cpXXX-cpXXX-pyodide_*_wasm32.whl``.
229-
230-
On Pyodide/wasm32, the **numba** dependency is omitted (via environment markers in ``pyproject.toml``), so the package can be installed with ``micropip.install(url)`` without pulling in numba.
231-
232-
**Full workflow (copy-paste)**
233-
234-
Use Python 3.11, 3.12, or 3.13 (Pyodide does not yet support 3.14). From the project root:
235-
236-
**1. One-time: install Emscripten**
237-
238-
.. code-block:: bash
239-
240-
# Clone and install the Emscripten SDK
241-
git clone https://github.com/emscripten-core/emsdk.git /path/to/emsdk
242-
cd /path/to/emsdk
243-
# Use the version required by pyodide-build (check with: pyodide config get emscripten_version)
244-
./emsdk install 3.1.45
245-
./emsdk activate 3.1.45
246-
source emsdk_env.sh
247-
248-
In every new shell where you will run ``pyodide build``, run ``source /path/to/emsdk/emsdk_env.sh`` first (or add it to your profile).
249-
250-
**2. One-time per machine: create a venv and install the Pyodide build extra**
251-
252-
.. code-block:: bash
253-
254-
python3.12 -m venv .venv-pyodide
255-
source .venv-pyodide/bin/activate # On Windows: .venv-pyodide\Scripts\activate
256-
pip install -e ".[pyodide]"
257-
258-
This installs the project in editable form and the ``pyodide-build`` tool (declared in the ``pyodide`` optional dependency).
259-
260-
**3. Each time you want to build the wasm wheel**
261-
262-
.. code-block:: bash
263-
264-
source /path/to/emsdk/emsdk_env.sh
265-
source .venv-pyodide/bin/activate
266-
cd /path/to/pytensor
267-
pyodide build
268-
269-
The wheel will appear in ``dist/``. PyPI does not yet accept emscripten/wasm32 wheels; host the file elsewhere (e.g. GitHub Releases) and install in Pyodide with ``micropip.install(url)``.
270-
271-
To see which Emscripten version your installed ``pyodide-build`` expects, run ``pyodide config get emscripten_version`` and use that in step 1 if it differs from ``3.1.45``. For more detail, see `Pyodide: building packages <https://pyodide.org/en/stable/development/building-packages-from-source.html>`_.
272-
273225
Other tools that might help
274226
===========================
275227

doc/install.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,22 @@ The current development branch of PyTensor can be installed from GitHub using `p
2626
2727
2828
To use the Numba and JAX backend you will need to install these libraries in addition to PyTensor. Please refer to `Numba's installation instructions <https://numba.readthedocs.io/en/stable/user/installing.html>`__ and `JAX's installation instructions <https://github.com/google/jax#installation>`__ respectively.
29+
30+
31+
Installing on Pyodide (WebAssembly)
32+
-----------------------------------
33+
34+
PyTensor can be used in browser-based Python environments via `Pyodide <https://pyodide.org/>`__, such as `JupyterLite <https://jupyterlite.readthedocs.io/>`__.
35+
36+
PyPI does not yet accept WebAssembly wheels, so you'll need to install from a GitHub Release:
37+
38+
.. code-block:: python
39+
40+
import micropip
41+
micropip.install("https://github.com/pymc-devs/pytensor/releases/download/vVERSION/pytensor-VERSION-py312-py312-pyodide_2024_0_wasm32.whl")
42+
43+
Replace ``VERSION`` with the desired release version (e.g., ``2.26.4``).
44+
45+
.. note::
46+
47+
The Numba backend is not available on Pyodide/wasm32. PyTensor will use other backends automatically.

doc/troubleshooting.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ or running :func:`pytensor.link.c.cmodule.default_blas_ldflags`.
196196
Here are some different way to configure BLAS:
197197

198198
0) Do nothing and use the default config.
199-
This will usually work great for installation via conda/mamba (conda-forge channel).
199+
This will usually work great for installation via conda/mamba/pixi (conda-forge channel).
200200
It will usually fail to link altogether for installation via pip.
201201

202202
1) Disable the usage of BLAS and fall back on NumPy for dot products. To do

pytensor/link/c/cmodule.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2985,7 +2985,7 @@ def default_blas_ldflags() -> str:
29852985
_logger.debug("Failed to identify blas ldflags. Will leave them empty.")
29862986
warnings.warn(
29872987
"PyTensor could not link to a BLAS installation. Operations that might benefit from BLAS will be severely degraded.\n"
2988-
"This usually happens when PyTensor is installed via pip. We recommend it be installed via conda/mamba instead.\n"
2988+
"This usually happens when PyTensor is installed via pip. We recommend it be installed via conda/mamba/pixi instead.\n"
29892989
"Alternatively, you can use an experimental backend such as Numba or JAX that perform their own BLAS optimizations, "
29902990
"by setting `pytensor.config.mode == 'NUMBA'` or passing `mode='NUMBA'` when compiling a PyTensor function.\n"
29912991
"For more options and details see https://pytensor.readthedocs.io/en/latest/troubleshooting.html#how-do-i-configure-test-my-blas-library",

0 commit comments

Comments
 (0)