@@ -409,11 +409,17 @@ The easiest way to get a debug build of CPython for WASI is to use the
409
409
``Tools/wasm/wasi.py build `` command (which should be run w/ a recent version of
410
410
Python you have installed on your machine):
411
411
412
- .. code-block :: shell
412
+ .. tab :: CPython 3.14 and newer
413
+
414
+ .. code-block :: shell
415
+
416
+ python3 Tools/wasm/wasi build --quiet -- --config-cache --with-pydebug
413
417
414
- $ python3 Tools/wasm/wasi build --quiet -- --config-cache --with-pydebug
418
+ .. tab :: CPython 3.13
415
419
416
- For Python 3.14 and earlier, use ``Tools/wasm/wasi.py `` instead.
420
+ .. code-block :: shell
421
+
422
+ python3 Tools/wasm/wasi.py build --quiet -- --config-cache --with-pydebug
417
423
418
424
That single command will configure and build both the build Python and the
419
425
WASI build in ``cross-build/build `` and ``cross-build/wasm32-wasi ``,
@@ -422,36 +428,48 @@ respectively.
422
428
You can also do each configuration and build step separately; the command above
423
429
is a convenience wrapper around the following commands:
424
430
425
- .. code-block :: shell
426
431
427
- $ python Tools/wasm/wasi configure-build-python --quiet -- --config-cache --with-pydebug
428
- $ python Tools/wasm/wasi make-build-python --quiet
429
- $ python Tools/wasm/wasi configure-host --quiet -- --config-cache
430
- $ python Tools/wasm/wasi make-host --quiet
432
+ .. tab :: CPython 3.14 and newer
433
+
434
+ .. code-block :: shell
435
+
436
+ $ python Tools/wasm/wasi configure-build-python --quiet -- --config-cache --with-pydebug
437
+ $ python Tools/wasm/wasi make-build-python --quiet
438
+ $ python Tools/wasm/wasi configure-host --quiet -- --config-cache
439
+ $ python Tools/wasm/wasi make-host --quiet
440
+
441
+ .. tab :: CPython 3.13
442
+
443
+ .. code-block :: shell
444
+
445
+ $ python Tools/wasm/wasi.py configure-build-python --quiet -- --config-cache --with-pydebug
446
+ $ python Tools/wasm/wasi.py make-build-python --quiet
447
+ $ python Tools/wasm/wasi.py configure-host --quiet -- --config-cache
448
+ $ python Tools/wasm/wasi.py make-host --quiet
431
449
432
450
.. note ::
433
451
434
452
The ``configure-host `` command infers the use of ``--with-pydebug `` from the
435
453
build Python.
436
454
437
- Running the separate commands after ``wasi.py build `` is useful if you, for example, only want to
438
- run the ``make-host `` step after making code changes.
455
+ Running the separate commands after ``wasi build `` is useful if you, for example,
456
+ only want to run the ``make-host `` step after making code changes.
439
457
440
458
Once everything is complete, there will be a
441
- ``cross-build/wasm32-wasi /python.sh `` helper file which you can use to run the
459
+ ``cross-build/wasm32-wasip1 /python.sh `` helper file which you can use to run the
442
460
``python.wasm `` file (see the output from the ``configure-host `` subcommand):
443
461
444
462
.. code-block :: shell
445
463
446
- $ cross-build/wasm32-wasi /python.sh --version
464
+ cross-build/wasm32-wasip1 /python.sh --version
447
465
448
466
You can also use ``Makefile `` targets and they will work as expected thanks to
449
467
the ``HOSTRUNNER `` environment variable having been set to a similar value as
450
468
used in ``python.sh ``:
451
469
452
470
.. code-block :: shell
453
471
454
- $ make -C cross-build/wasm32-wasi test
472
+ make -C cross-build/wasm32-wasip1 test
455
473
456
474
.. note ::
457
475
@@ -1228,13 +1246,18 @@ are available from the
1228
1246
To run the container and launch a Bash shell, run one of the following commands
1229
1247
in a clone of the CPython repository.
1230
1248
1231
- .. code-block :: bash
1249
+ .. tab :: Podman
1232
1250
1233
- docker run -it --rm --volume $PWD :/workspace --workdir /workspace ghcr.io/python/devcontainer:latest
1251
+ .. code-block :: bash
1234
1252
1235
- .. code-block :: bash
1253
+ podman run -it --rm --volume $PWD :/workspace:Z --workdir /workspace ghcr.io/python/devcontainer:latest
1254
+
1255
+ .. tab :: Docker
1256
+
1257
+ .. code-block :: bash
1258
+
1259
+ docker run -it --rm --volume $PWD :/workspace --workdir /workspace ghcr.io/python/devcontainer:latest
1236
1260
1237
- podman run -it --rm --volume $PWD :/workspace:Z --workdir /workspace ghcr.io/python/devcontainer:latest
1238
1261
1239
1262
Note that the container has read/write access to the working directory.
1240
1263
You may want to use a separate clone of CPython, or run ``make clean ``
@@ -1249,11 +1272,17 @@ If you prefer, you can build the container image yourself. In a clone of the
1249
1272
`cpython-devcontainers repo `_,
1250
1273
build the container and name it ``cpython-dev ``:
1251
1274
1252
- .. code-block :: bash
1275
+ .. tab :: Podman
1276
+
1277
+ .. code-block :: shell
1278
+
1279
+ podman build devcontainer/ --tag cpython-dev
1253
1280
1254
- docker build devcontainer/ --tag cpython-dev
1281
+ .. tab :: Docker
1255
1282
1256
- (Substitute ``podman `` for ``docker `` if you use Podman.)
1283
+ .. code-block :: shell
1284
+
1285
+ docker build devcontainer/ --tag cpython-dev
1257
1286
1258
1287
The same command will update any existing ``cpython-dev `` container.
1259
1288
Run it again from time to time -- especially if the container stops
@@ -1262,13 +1291,18 @@ working for you.
1262
1291
To run the container and launch a Bash shell, run one of the following commands
1263
1292
in a clone of the CPython repository.
1264
1293
1265
- .. code-block :: bash
1294
+ .. tab :: Podman
1295
+
1296
+ .. code-block :: shell
1297
+
1298
+ podman run -it --rm --volume $PWD :/workspace:Z --workdir /workspace cpython-dev bash
1299
+
1300
+ .. tab :: Docker
1266
1301
1267
- docker run -it --rm --volume $PWD :/workspace --workdir /workspace cpython-dev
1302
+ .. code-block :: shell
1268
1303
1269
- .. code-block :: bash
1304
+ docker run -it --rm --volume $PWD :/workspace --workdir /workspace cpython-dev bash
1270
1305
1271
- podman run -it --rm --volume $PWD :/workspace:Z --workdir /workspace cpython-dev
1272
1306
1273
1307
The same caveats outlined above when running from a container image from GHCR
1274
1308
also apply here.
0 commit comments