wasi-python 0.1.0a3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wasi_python/__init__.py +91 -0
- wasi_python/__main__.py +5 -0
- wasi_python/artifacts/LICENSES/bzip2.txt +44 -0
- wasi_python/artifacts/LICENSES/cpython.txt +1573 -0
- wasi_python/artifacts/LICENSES/llvm-runtimes.txt +1252 -0
- wasi_python/artifacts/LICENSES/numpy.txt +934 -0
- wasi_python/artifacts/LICENSES/pandas.txt +1097 -0
- wasi_python/artifacts/LICENSES/python-dateutil.txt +56 -0
- wasi_python/artifacts/LICENSES/six.txt +20 -0
- wasi_python/artifacts/LICENSES/sqlite.txt +34 -0
- wasi_python/artifacts/LICENSES/tzdata.txt +221 -0
- wasi_python/artifacts/LICENSES/wasi-libc.txt +688 -0
- wasi_python/artifacts/LICENSES/xz.txt +85 -0
- wasi_python/artifacts/LICENSES/zlib.txt +24 -0
- wasi_python/artifacts/MANIFEST +94 -0
- wasi_python/artifacts/SHA256SUMS +16 -0
- wasi_python/artifacts/python-snapshot.wasm +4 -0
- wasi_python/artifacts/python-stdlib.zip +0 -0
- wasi_python/artifacts/python.wasm +0 -0
- wasi_python/cli.py +225 -0
- wasi_python/runner.py +2527 -0
- wasi_python-0.1.0a3.dist-info/METADATA +743 -0
- wasi_python-0.1.0a3.dist-info/RECORD +26 -0
- wasi_python-0.1.0a3.dist-info/WHEEL +4 -0
- wasi_python-0.1.0a3.dist-info/entry_points.txt +2 -0
- wasi_python-0.1.0a3.dist-info/licenses/LICENSE +190 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
==== xz COPYING ====
|
|
2
|
+
|
|
3
|
+
XZ Utils Licensing
|
|
4
|
+
==================
|
|
5
|
+
|
|
6
|
+
Different licenses apply to different files in this package. Here
|
|
7
|
+
is a summary of which licenses apply to which parts of this package:
|
|
8
|
+
|
|
9
|
+
- liblzma is under the BSD Zero Clause License (0BSD).
|
|
10
|
+
|
|
11
|
+
- The command line tools xz, xzdec, lzmadec, and lzmainfo are
|
|
12
|
+
under 0BSD except that, on systems that don't have a usable
|
|
13
|
+
getopt_long, GNU getopt_long is compiled and linked in from the
|
|
14
|
+
'lib' directory. The getopt_long code is under GNU LGPLv2.1+.
|
|
15
|
+
|
|
16
|
+
- The scripts to grep, diff, and view compressed files have been
|
|
17
|
+
adapted from GNU gzip. These scripts (xzgrep, xzdiff, xzless,
|
|
18
|
+
and xzmore) are under GNU GPLv2+. The man pages of the scripts
|
|
19
|
+
are under 0BSD; they aren't based on the man pages of GNU gzip.
|
|
20
|
+
|
|
21
|
+
- Most of the XZ Utils specific documentation that is in
|
|
22
|
+
plain text files (like README, INSTALL, PACKAGERS, NEWS,
|
|
23
|
+
and ChangeLog) are under 0BSD unless stated otherwise in
|
|
24
|
+
the file itself. The files xz-file-format.txt and
|
|
25
|
+
lzma-file-format.xt are in the public domain but may
|
|
26
|
+
be distributed under the terms of 0BSD too.
|
|
27
|
+
|
|
28
|
+
- Translated messages and man pages are under 0BSD except that
|
|
29
|
+
some old translations are in the public domain.
|
|
30
|
+
|
|
31
|
+
- Test files and test code in the 'tests' directory, and
|
|
32
|
+
debugging utilities in the 'debug' directory are under
|
|
33
|
+
the BSD Zero Clause License (0BSD).
|
|
34
|
+
|
|
35
|
+
- The GNU Autotools based build system contains files that are
|
|
36
|
+
under GNU GPLv2+, GNU GPLv3+, and a few permissive licenses.
|
|
37
|
+
These files don't affect the licensing of the binaries being
|
|
38
|
+
built.
|
|
39
|
+
|
|
40
|
+
- The 'extra' directory contains files that are under various
|
|
41
|
+
free software licenses. These aren't built or installed as
|
|
42
|
+
part of XZ Utils.
|
|
43
|
+
|
|
44
|
+
The following command may be helpful in finding per-file license
|
|
45
|
+
information. It works on xz.git and on a clean file tree extracted
|
|
46
|
+
from a release tarball.
|
|
47
|
+
|
|
48
|
+
sh build-aux/license-check.sh -v
|
|
49
|
+
|
|
50
|
+
For the files under the BSD Zero Clause License (0BSD), if
|
|
51
|
+
a copyright notice is needed, the following is sufficient:
|
|
52
|
+
|
|
53
|
+
Copyright (C) The XZ Utils authors and contributors
|
|
54
|
+
|
|
55
|
+
If you copy significant amounts of 0BSD-licensed code from XZ Utils
|
|
56
|
+
into your project, acknowledging this somewhere in your software is
|
|
57
|
+
polite (especially if it is proprietary, non-free software), but
|
|
58
|
+
it is not legally required by the license terms. Here is an example
|
|
59
|
+
of a good notice to put into "about box" or into documentation:
|
|
60
|
+
|
|
61
|
+
This software includes code from XZ Utils <https://tukaani.org/xz/>.
|
|
62
|
+
|
|
63
|
+
The following license texts are included in the following files:
|
|
64
|
+
- COPYING.0BSD: BSD Zero Clause License
|
|
65
|
+
- COPYING.LGPLv2.1: GNU Lesser General Public License version 2.1
|
|
66
|
+
- COPYING.GPLv2: GNU General Public License version 2
|
|
67
|
+
- COPYING.GPLv3: GNU General Public License version 3
|
|
68
|
+
|
|
69
|
+
If you have questions, don't hesitate to ask for more information.
|
|
70
|
+
The contact information is in the README file.
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
==== xz COPYING.0BSD ====
|
|
74
|
+
Permission to use, copy, modify, and/or distribute this
|
|
75
|
+
software for any purpose with or without fee is hereby granted.
|
|
76
|
+
|
|
77
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
|
78
|
+
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
|
79
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
|
|
80
|
+
THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
|
|
81
|
+
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
82
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
|
83
|
+
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
84
|
+
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
85
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
==== zlib LICENSE ====
|
|
2
|
+
Copyright notice:
|
|
3
|
+
|
|
4
|
+
(C) 1995-2022 Jean-loup Gailly and Mark Adler
|
|
5
|
+
|
|
6
|
+
This software is provided 'as-is', without any express or implied
|
|
7
|
+
warranty. In no event will the authors be held liable for any damages
|
|
8
|
+
arising from the use of this software.
|
|
9
|
+
|
|
10
|
+
Permission is granted to anyone to use this software for any purpose,
|
|
11
|
+
including commercial applications, and to alter it and redistribute it
|
|
12
|
+
freely, subject to the following restrictions:
|
|
13
|
+
|
|
14
|
+
1. The origin of this software must not be misrepresented; you must not
|
|
15
|
+
claim that you wrote the original software. If you use this software
|
|
16
|
+
in a product, an acknowledgment in the product documentation would be
|
|
17
|
+
appreciated but is not required.
|
|
18
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
|
19
|
+
misrepresented as being the original software.
|
|
20
|
+
3. This notice may not be removed or altered from any source distribution.
|
|
21
|
+
|
|
22
|
+
Jean-loup Gailly Mark Adler
|
|
23
|
+
jloup@gzip.org madler@alumni.caltech.edu
|
|
24
|
+
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
python 3.15.0
|
|
2
|
+
package numpy 2.5.2
|
|
3
|
+
package pandas 3.0.6
|
|
4
|
+
package zlib 1.3.1
|
|
5
|
+
package bzip2 1.0.8
|
|
6
|
+
package xz 5.8.4
|
|
7
|
+
package sqlite-autoconf 3540100
|
|
8
|
+
package python-dateutil 2.9.0.post0
|
|
9
|
+
package tzdata 2026.5
|
|
10
|
+
package six 1.17.0
|
|
11
|
+
pin d482d171c406ae88c5b19cad3b6a1c4c5209f886ab74bc44c2c865c23f52d860 numpy-2.5.2.tar.gz
|
|
12
|
+
pin 66b07ef7315a31bfe1089cd3d71a7de781c9dca986762d0b4fe7c0ef17465d10 pandas-3.0.6.tar.gz
|
|
13
|
+
pin d7708ba1cc2da171db2c8273d8602f3e0684935dc7cab40148cdcca1da83c0f8 wasmtime-v49.0.3-aarch64-macos.tar.xz
|
|
14
|
+
pin 85c997a2665ead91673b5bb88b7d0df3fc8900df3bfa244f720d478187bbdc78 wasi-sdk-33.0-arm64-macos.tar.gz
|
|
15
|
+
pin 9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23 zlib-1.3.1.tar.gz
|
|
16
|
+
pin ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269 bzip2-1.0.8.tar.gz
|
|
17
|
+
pin 0014c7886930454fe8bd4228665b51af55eeae560ea135c9c4cd33f55b2591d9 xz-5.8.4.tar.gz
|
|
18
|
+
pin 926ef8d3eab93fbf6e06011901273eec076b25594a4e1cdadd50c987f4f6d64e sqlite-autoconf-3540100.tar.gz
|
|
19
|
+
pin 930bc7542cbd9f57009e182fd014eba48cf1a0180a7b9006d2d32d8f168d8b02 meson-1.12.1-py3-none-any.whl
|
|
20
|
+
pin fd82e26c0706ad4ab88e5fdd26f3fab0a987a90f810160f6c322e752c6af298b ninja-1.13.2-py3-none-macosx_10_9_universal2.whl
|
|
21
|
+
pin 0f1a137bb5d6811e96a79bb0486798aeae9b9c6efc24b389659cebb0ee396cb9 versioneer-0.29-py3-none-any.whl
|
|
22
|
+
pin a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427 python_dateutil-2.9.0.post0-py2.py3-none-any.whl
|
|
23
|
+
pin b683bd1b6659ddcd810ff02ad09ba821d4bf1065072805063eb35c49617905ac tzdata-2026.5-py2.py3-none-any.whl
|
|
24
|
+
pin 4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274 six-1.17.0-py2.py3-none-any.whl
|
|
25
|
+
pin ba4bed1ba346b916890b76d9e320451420aa69f6408997d33c66482eeae3d575 Python-3.15.0.tar.xz
|
|
26
|
+
pin 3fb079450ee57075a790b94634206759501166e0a99de459cdad095f6c158d39 cpython-3.15.0+20261009-aarch64-apple-darwin-install_only.tar.gz
|
|
27
|
+
pin 596e8df019372a2cd417805015022d42cb8ee4e1803ccdc11ed00e451625fb66 cython-3.3.0-cp315-cp315-macosx_11_0_arm64.whl
|
|
28
|
+
pin 2711a8b5a5cdfef0e639f96c1aca12ae23d7d64a02d0507f1bdf14d2b27bbc3a wasi-libc-161b3195-LICENSE
|
|
29
|
+
pin a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2 wasi-libc-161b3195-LICENSE-APACHE
|
|
30
|
+
pin 268872b9816f90fd8e85db5a28d33f8150ebb8dd016653fb39ef1f94f2686bc5 wasi-libc-161b3195-LICENSE-APACHE-LLVM
|
|
31
|
+
pin 23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3 wasi-libc-161b3195-LICENSE-MIT
|
|
32
|
+
pin f9bc4423732350eb0b3f7ed7e91d530298476f8fec0c6c427a1c04ade22655af wasi-libc-161b3195-musl-COPYRIGHT
|
|
33
|
+
pin c8b789cf5a746611e6300a0cc7750dbf92b61912a709d04e639245f7290656d0 wasi-libc-161b3195-cloudlibc-LICENSE
|
|
34
|
+
pin 539dd7aed86e8a4f12cbdd0e6c50c189c7d74847e4fecc64ce2c6ee3a01da38b llvm-4434dabb-libcxx-LICENSE.TXT
|
|
35
|
+
pin e2b35be49f7284a45b7baca8fc7b3ab7440e7902392b2528a457816b5bb2a15c llvm-4434dabb-libcxxabi-LICENSE.TXT
|
|
36
|
+
pin b5efebcaca80879234098e52d1725e6d9eb8fb96a19fce625d39184b705f7b6d llvm-4434dabb-libunwind-LICENSE.TXT
|
|
37
|
+
pin 1a8f1058753f1ba890de984e48f0242a3a5c29a6a8f2ed9fd813f36985387e8d llvm-4434dabb-compiler-rt-LICENSE.TXT
|
|
38
|
+
pin 4f98ee738c7abb45c81a94d1461fc53cc569d1cd01498951c8184d841a027844 wasi-sdk-33.0-arm64-linux.tar.gz
|
|
39
|
+
pin 0ba8b5bfaeb2adf3f29bab5841d76cf5318ab8e1642ea195f88baba1abd47bce wasi-sdk-33.0-x86_64-linux.tar.gz
|
|
40
|
+
pin 880fcb026da88ad7fc1713d572b0d03d139758b7da96cd3cb8c9cbf847a521df wasmtime-v49.0.3-aarch64-linux.tar.xz
|
|
41
|
+
pin 4001225413f208345b980525f31c4080e1873808b38d0ddc7918497340667fbb wasmtime-v49.0.3-x86_64-linux.tar.xz
|
|
42
|
+
pin f02953d2c56c7eaa2fa3a21f2680a823b8748959c571ac149cd76b0fd1a1c33c cpython-3.15.0+20261009-aarch64-unknown-linux-gnu-install_only.tar.gz
|
|
43
|
+
pin 95ba085863806dacf0fd7119c590154bbcd3351099e55c0808a9c61603e320a8 cpython-3.15.0+20261009-x86_64-unknown-linux-gnu-install_only.tar.gz
|
|
44
|
+
pin 4a36c34d1950845b8ac148653b07cdc62421a4b0d9abfcc849e69f1c4ff9919d cython-3.3.0-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
|
|
45
|
+
pin b447f6906e0555f05dc4742ef1f99091b1e5d9aa9f16616e772fbf9ff6271616 cython-3.3.0-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
|
|
46
|
+
pin d775a5e43e9088f507a6250d57fcf5678eb31268c545feb5064ffeee33735622 ninja-1.13.2-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
|
|
47
|
+
pin 65a24341b5ac09fcadcc37082660be40a94174e51a937fabf6e2cae26225fa2c ninja-1.13.2-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
|
|
48
|
+
pin 063bc1b56582b9923e08ac9b89e58789618d851763f01530b3ff20b9e5df0ca3 wasi-sysroot-33.0+m.tar.gz
|
|
49
|
+
pin d3302760b78c8c50f2875650833b3584479131eab9ec2e6c72f7dfec26288be3 libclang_rt-33.0+m.tar.gz
|
|
50
|
+
recipe 629979c49d35a028c2f602a9fba2cdf176e7d311d28fd1461f13ad2823ca3f83 recipes/ctypes_stub.py
|
|
51
|
+
recipe 33a5f2a5d791576ce634d6dcf598eb536b32e760c9a97ab2473577e465ce020d recipes/hostmodule.c
|
|
52
|
+
recipe 4b7a7497c764a6372012c6a5bfc82c7c073e6aa5208d43fc06c18c4f31c6385d recipes/mmap_stub.py
|
|
53
|
+
recipe a09dcc2047104637269114c8db006f8a77c47c8c37eb04aa53df1641fd572c76 recipes/npy_random_legacy_rename.h
|
|
54
|
+
recipe a1bf6cfb722685047dabc65a5c97bc1e677327c1c7db0e64372cf336bbd9d586 recipes/npy_rename.h
|
|
55
|
+
recipe 7ff8e2a0e4d4676a8cb416813723d368214d0aa22ec394fd8f83af11d1f90e92 recipes/numpy_host_shim.py
|
|
56
|
+
recipe 2de3f6b1b8ea4e65cd8dce3e01806873fe6f5b9a91554c70589fe949ed237ec6 recipes/pandas_rename.h
|
|
57
|
+
recipe b2815dc3e9d8d98907a8661fc2773b200a63dcfc995cfd730b60a5a324d3ed7c recipes/patches/README.md
|
|
58
|
+
recipe 521d4114b006f72539553875f7415a52cf02cee602a3590ce540eee336cc9e4b recipes/patches/numpy-2.5.2/0001-npy-files-without-dup.patch
|
|
59
|
+
recipe 6be8ae16e0f3cdec86ad934e6979cd52b6527b4d95aa5855ff20bbe4b9606051 recipes/reactor_bootstrap.py
|
|
60
|
+
recipe 6770b320db7db676c079575ee0724c27836ef7bb1a6c577a35663e71173e5d1e recipes/reactor_main.c
|
|
61
|
+
recipe d40e13d48fb934f556708dfa7d9a83b71f7b914d38b670365ab6fe45a0311c6e recipes/wasi-numpy.cross
|
|
62
|
+
recipe bb9a11024e0a36db65a7755f6c4391be7a4658b832f225e22eb5826d4732f53c recipes/wasi-pandas.cross
|
|
63
|
+
recipe 72913fb1c34fbd9f8e14ca9e6f897125c769f140e852b28cb510affb85d7f631 scripts/00_download.sh
|
|
64
|
+
recipe 13d7ed8ab1981d2fce499d18022f027155a8e90c16b4940196523e83827a704c scripts/assemble_artifacts.py
|
|
65
|
+
recipe 9faff8aeaf3c2bace423000b22917cb31e1f0394632370bd9bc179e08dbb6ded scripts/build.sh
|
|
66
|
+
recipe 4a9401947ae21b7fd04c8e2cff819c8e197fcbe41608e052f6917fdd91b01f2b scripts/compare_snapshots.py
|
|
67
|
+
recipe ce997c958dbbcdb27375e8d1954def10896c3ea4a3f1eafd679e5304188365a0 scripts/freeze_bootstrap.py
|
|
68
|
+
recipe 393d181521286624c18a5a3e0d34ba20b65fead252cff062b892a3db9b87b72d scripts/gen_inittab.py
|
|
69
|
+
recipe c2f05b0f8a87e1fc64cb58d2e3ee47a1ff8f89ed1038f578aff5cff6f0b44b0d scripts/line.conf
|
|
70
|
+
recipe 4ebf36619999d8556e4354b1b393ee605afc16c00539e4ce9ab1687de769961c scripts/line.py
|
|
71
|
+
recipe ce83ec2d25eaa61b82ae6605f463dfc776026715e3efb4f059a866e4c1e1a311 scripts/line.sh
|
|
72
|
+
recipe 0afa3e01f0099d6cc645a57cf0f5188b9386a5c53d9cda0ba34d38735ccba121 scripts/litter.py
|
|
73
|
+
recipe 2b1b9ce00dfb2a6b0ef584d9511e543d06a44c14c784b876696cc59735fcb444 scripts/make_stdlib_zip.py
|
|
74
|
+
recipe 3bb69502bb1ad1fab3a054000ae8546ce4eeec53dbcdbbfea2261bfb648377b6 scripts/python-wasi-cross
|
|
75
|
+
recipe ed096b47b43528a6fa4f5add6c8791e590113fc21aa1b7b86d4598ff5c5ef726 scripts/steps/10_tools.sh
|
|
76
|
+
recipe 51f2ed07b657ee84fbb8090f345742c0e777a093e03ce558d1b8f632d5a80fa4 scripts/steps/20_cpython.sh
|
|
77
|
+
recipe 9a741ce7355114b5d3524957c5fcb7f924d71eb63f961a001930b683ddb53cad scripts/steps/30_zlib.sh
|
|
78
|
+
recipe 064cbc6d55db4df05e03db233f318f0a2d0c1aa064f38cf4b6454e14a24ec657 scripts/steps/35_stdlib_libs.sh
|
|
79
|
+
recipe cf8df1c462f90296fc4af823991c44e673c50a94e752e9945ecd2bc38c7a209d scripts/steps/40_numpy.sh
|
|
80
|
+
recipe c91c8ec8f495ec5f67b35079fdb435251f0ea6314a707e8ccc7439af6504315b scripts/steps/50_pandas.sh
|
|
81
|
+
recipe 7fd9bac71ad3d52b1c8692f2cab49cb476267884dae9c8b842ca4d3f244c8a74 scripts/steps/60_link.sh
|
|
82
|
+
recipe b3fe4cac8f3ae362283a10ebc2c02e58aaf811cfc8676af2b3e9d91b2a47ffb3 scripts/steps/70_zip.sh
|
|
83
|
+
recipe 4d6b3b3d058949aed2c43711f7e5db8caf7d6314b66ab3153130fbb3abe2a359 scripts/steps/80_snapshot.sh
|
|
84
|
+
recipe 493c01160ec150a0a2ae8d06368cb8e709bace799a8f5100ef8d83f2bc5fa426 scripts/steps/90_artifacts.sh
|
|
85
|
+
recipe 1fd6bdbe3e4e5f77114c481de91f6f9d38df709bb2de2e3669606cee6872a6d2 scripts/steps/apply_patches.sh
|
|
86
|
+
recipe 6f80642c60dd708c1f2c7c16a22a650c4e255d4837711a32993439cca21a25e1 scripts/steps/common.sh
|
|
87
|
+
recipe feab37ba36f97163463037ce8acabc190862dffada2e869e81ce67f618ec549a scripts/steps/remove.sh
|
|
88
|
+
recipe e7b0bfd817f0a8991c9442b06c8a296b5b78195b58566134a3f2b043a80596b3 scripts/wasi-cc
|
|
89
|
+
recipe 33981b8b17792d6df5c67a5f5822d562bbe2af21178916a6852c6fdbf21c8139 scripts/wasi-cxx
|
|
90
|
+
x-pins every-supported-build-host
|
|
91
|
+
x-wizer wasmtime wizer -W exceptions=y,unknown-imports-trap=y -S cli=y,inherit-stdin=n,inherit-stdout=n,inherit-stderr=n -C cache=n --init-func wizer.initialize --dir <root with usr/local/lib/python315.zip>::/ -o python-snapshot.wasm python.wasm
|
|
92
|
+
x-source-date-epoch 1767225600
|
|
93
|
+
x-preimport encodings, io, os, sys, json, csv, re, _colorize, numpy, pandas
|
|
94
|
+
x-snapshot-zip 1add57e442f3d56596e1b4c09bc3201b79797143360b7a06c87f25dc80060739
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
28753c7121ccf73cc69a44ee55ba52d891d3bf1718940d2e3cffa661d225a455 LICENSES/bzip2.txt
|
|
2
|
+
e140d8fab8152ead9954dea90595498bf4a86adf2bc69c8f91a5b6dbb7c38150 LICENSES/cpython.txt
|
|
3
|
+
796ac49177d19da4f828081607414aad9b2953b3e811a9e6e13714866d475745 LICENSES/llvm-runtimes.txt
|
|
4
|
+
7bd98a031ed230538a1e6457822483bfdc7c0216f9438441b6917366a7f97de8 LICENSES/numpy.txt
|
|
5
|
+
d38f9537c4397ecb97d1b3dc7feaf9bed381780639d126909b120113c9566ab9 LICENSES/pandas.txt
|
|
6
|
+
54c1d04571a9c1a99925fe49ed3092f4c74c8b1b6593e7a8c9633728cc8ecfe2 LICENSES/python-dateutil.txt
|
|
7
|
+
09ad15735d79a7d10caf307dfba8a8fe8ec52aa5fdea4db1e664d0528ee32cb1 LICENSES/six.txt
|
|
8
|
+
681f05f7e60baee5e748a22c0e3dfa1fce3fcf16c69078998928bfb3978c70f9 LICENSES/sqlite.txt
|
|
9
|
+
a28814acc65c4af15aa37fb4b300c035fac36e77ab16967f18b4797dafd29c45 LICENSES/tzdata.txt
|
|
10
|
+
cf87ce0c8612aa619b7058b5699acb9a4c3ccd88c82228d3db6b7ea3b0fee427 LICENSES/wasi-libc.txt
|
|
11
|
+
93947eef5170a4e17a3dfed772f23f4fa366beff24358f41764cf60698a053e3 LICENSES/xz.txt
|
|
12
|
+
b629f68f9e92e40953433541cc1e8e20be1c6421770f67486f7db98e270801e5 LICENSES/zlib.txt
|
|
13
|
+
a680b3e065ba1f385a7de13446e7cad033629481e1eee32727135650d20d44a7 MANIFEST
|
|
14
|
+
c7302cfd191ac3b96c3dd713fd16b89d3f07adb32ede80a15ba6d97908a0ac26 python-snapshot.wasm
|
|
15
|
+
1add57e442f3d56596e1b4c09bc3201b79797143360b7a06c87f25dc80060739 python-stdlib.zip
|
|
16
|
+
4befe9de64edc783996ab006e6179b704a73a520b67431135df103db9db9625d python.wasm
|
|
Binary file
|
|
Binary file
|
wasi_python/cli.py
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
"""`wasi-python run`: run one program through `wasi_python.run` and print its result as one line
|
|
2
|
+
of JSON (spec 019). It adds no power `run` does not have: each option is one of `run`'s
|
|
3
|
+
arguments, and without an option the argument is `run`'s default.
|
|
4
|
+
|
|
5
|
+
wasi-python run -- -c "print(1)"
|
|
6
|
+
{"exit_code": 0, "fuel_used": null, "stderr": "", "stdout": "1\\n", "trapped": null,
|
|
7
|
+
"truncated": []} (one line)
|
|
8
|
+
|
|
9
|
+
Exit codes say whether there is a result, not how the program ended: 0, the call returned (the
|
|
10
|
+
JSON says how the program ended); 1, `run` raised (one JSON object with `error` and `kind`);
|
|
11
|
+
2, a usage error (argparse's message on standard error); 130, interrupted by Ctrl-C.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import argparse
|
|
17
|
+
import base64
|
|
18
|
+
import json
|
|
19
|
+
import os
|
|
20
|
+
import sys
|
|
21
|
+
import threading
|
|
22
|
+
from typing import Any
|
|
23
|
+
|
|
24
|
+
USAGE = "wasi-python run [OPTIONS] [--] ARG..."
|
|
25
|
+
VALUED = {
|
|
26
|
+
"--env",
|
|
27
|
+
"--stdin",
|
|
28
|
+
"--deadline-s",
|
|
29
|
+
"--memory-bytes",
|
|
30
|
+
"--output-bytes",
|
|
31
|
+
"--fuel",
|
|
32
|
+
"--grant",
|
|
33
|
+
"--grant-writable",
|
|
34
|
+
"--root",
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class _Once(argparse.Action):
|
|
39
|
+
"""An option that may be given once: a second `--root` is a usage error, never last-wins."""
|
|
40
|
+
|
|
41
|
+
def __call__(self, parser, namespace, values, option_string=None): # type: ignore[override]
|
|
42
|
+
if hasattr(namespace, self.dest):
|
|
43
|
+
parser.error(f"argument {option_string}: given twice")
|
|
44
|
+
setattr(namespace, self.dest, values)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def _limit(kind: type) -> Any:
|
|
48
|
+
"""`none` for no limit, else a value of `kind`; anything else is a usage error."""
|
|
49
|
+
|
|
50
|
+
def parse(text: str) -> Any:
|
|
51
|
+
if text == "none":
|
|
52
|
+
return None
|
|
53
|
+
try:
|
|
54
|
+
return kind(text)
|
|
55
|
+
except ValueError:
|
|
56
|
+
raise argparse.ArgumentTypeError(f"not {kind.__name__} or none: {text!r}") from None
|
|
57
|
+
|
|
58
|
+
return parse
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _parser() -> argparse.ArgumentParser:
|
|
62
|
+
p = argparse.ArgumentParser(
|
|
63
|
+
prog="wasi-python run",
|
|
64
|
+
usage=USAGE,
|
|
65
|
+
allow_abbrev=False,
|
|
66
|
+
description="Run one program in a fresh sandboxed CPython and print its result as JSON.",
|
|
67
|
+
)
|
|
68
|
+
p.add_argument("--env", action="append", default=[], metavar="KEY[=VALUE]")
|
|
69
|
+
p.add_argument("--stdin", metavar="PATH", help="a file, or - for this command's own input")
|
|
70
|
+
# An option not given is absent from the result, so `run` keeps its own default.
|
|
71
|
+
unset = argparse.SUPPRESS
|
|
72
|
+
p.add_argument("--deadline-s", type=_limit(float), metavar="SECONDS", default=unset)
|
|
73
|
+
p.add_argument("--memory-bytes", type=_limit(int), metavar="BYTES", default=unset)
|
|
74
|
+
p.add_argument("--output-bytes", type=_limit(int), metavar="BYTES", default=unset)
|
|
75
|
+
p.add_argument("--fuel", type=_limit(int), metavar="N", default=unset)
|
|
76
|
+
p.add_argument("--no-snapshot", action="store_true")
|
|
77
|
+
# Both grant options write to one list, each value tagged with its mode, so the order typed
|
|
78
|
+
# is the order `run` numbers them in (spec 022).
|
|
79
|
+
p.add_argument(
|
|
80
|
+
"--grant", dest="grants", action="append", default=[], type=lambda v: ("ro", v),
|
|
81
|
+
metavar="GUEST=HOST", help="a host folder the guest sees at GUEST, read-only",
|
|
82
|
+
) # fmt: skip
|
|
83
|
+
p.add_argument(
|
|
84
|
+
"--grant-writable", dest="grants", action="append", type=lambda v: ("rw", v),
|
|
85
|
+
metavar="GUEST=HOST", help="a host folder the guest sees at GUEST, writable",
|
|
86
|
+
) # fmt: skip
|
|
87
|
+
roots = p.add_mutually_exclusive_group()
|
|
88
|
+
roots.add_argument(
|
|
89
|
+
"--root", action=_Once, default=unset, metavar="HOST",
|
|
90
|
+
help="the guest's /, writable; made if missing",
|
|
91
|
+
) # fmt: skip
|
|
92
|
+
roots.add_argument(
|
|
93
|
+
"--private-root", action="store_true",
|
|
94
|
+
help="a fresh private /, writable, removed after the call",
|
|
95
|
+
) # fmt: skip
|
|
96
|
+
roots.add_argument("--no-root", action="store_true", help="no / at all, the default")
|
|
97
|
+
return p
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def _grants(items: list[tuple[str, str]], parser: argparse.ArgumentParser) -> list[Any]:
|
|
101
|
+
"""GUEST=HOST, split at the first `=`: a host path may hold `=` or `C:\\`, a guest path
|
|
102
|
+
starts with `/`. Whatever parses goes to `run()`, which judges it."""
|
|
103
|
+
from .runner import Grant
|
|
104
|
+
|
|
105
|
+
grants = []
|
|
106
|
+
for mode, value in items:
|
|
107
|
+
guest, sep, host = value.partition("=")
|
|
108
|
+
if not sep:
|
|
109
|
+
option = "--grant-writable" if mode == "rw" else "--grant"
|
|
110
|
+
parser.error(f"{option} needs GUEST=HOST")
|
|
111
|
+
grants.append(Grant(host, guest, writable=mode == "rw"))
|
|
112
|
+
return grants
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def _split(args: list[str]) -> tuple[list[str], list[str]]:
|
|
116
|
+
"""One left-to-right scan: `--` gives the rest to the guest; an argument starting with `-`
|
|
117
|
+
(not `-` itself) is this command's option, and one of `VALUED` consumes the next argument
|
|
118
|
+
unless written `--name=value`; anything else starts the guest's argv, `--` after it included."""
|
|
119
|
+
i = 0
|
|
120
|
+
while i < len(args):
|
|
121
|
+
arg = args[i]
|
|
122
|
+
if arg == "--":
|
|
123
|
+
return args[:i], args[i + 1 :]
|
|
124
|
+
if arg.startswith("-") and arg != "-":
|
|
125
|
+
i += 2 if arg in VALUED else 1
|
|
126
|
+
continue
|
|
127
|
+
return args[:i], args[i:]
|
|
128
|
+
return args, []
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def _env(items: list[str], parser: argparse.ArgumentParser) -> dict[str, str] | None:
|
|
132
|
+
"""KEY=VALUE, or KEY alone for this command's own value, which keeps a secret off the command
|
|
133
|
+
line; a repeated key keeps its last value."""
|
|
134
|
+
if not items:
|
|
135
|
+
return None
|
|
136
|
+
env: dict[str, str] = {}
|
|
137
|
+
for i, item in enumerate(items, 1):
|
|
138
|
+
key, sep, value = item.partition("=")
|
|
139
|
+
if not sep:
|
|
140
|
+
if key not in os.environ:
|
|
141
|
+
# Never echo what was typed: a value given by mistake as a name is a secret.
|
|
142
|
+
parser.error(f"--env number {i}: no such name in this command's environment")
|
|
143
|
+
value = os.environ[key]
|
|
144
|
+
env[key] = value
|
|
145
|
+
return env
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def _stream(name: str, data: bytes) -> dict[str, str]:
|
|
149
|
+
try:
|
|
150
|
+
return {name: data.decode("utf-8")}
|
|
151
|
+
except UnicodeDecodeError:
|
|
152
|
+
return {f"{name}_base64": base64.b64encode(data).decode("ascii")}
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def _write(obj: dict[str, Any]) -> None:
|
|
156
|
+
line = json.dumps(obj, sort_keys=True, ensure_ascii=True) + "\n"
|
|
157
|
+
sys.stdout.buffer.write(line.encode("ascii"))
|
|
158
|
+
sys.stdout.buffer.flush()
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def main(argv: list[str] | None = None) -> int:
|
|
162
|
+
"""The command; Ctrl-C at any point is exit 130 with nothing on standard output."""
|
|
163
|
+
try:
|
|
164
|
+
return _main(list(sys.argv[1:] if argv is None else argv))
|
|
165
|
+
except KeyboardInterrupt:
|
|
166
|
+
return 130
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def _main(args: list[str]) -> int:
|
|
170
|
+
if args[:1] in (["-h"], ["--help"]):
|
|
171
|
+
print(f"usage: {USAGE}\n\nRun `wasi-python run --help` for the options.")
|
|
172
|
+
return 0
|
|
173
|
+
if args[:1] != ["run"]:
|
|
174
|
+
print(f"usage: {USAGE}\nwasi-python: the one command is `run`", file=sys.stderr)
|
|
175
|
+
return 2
|
|
176
|
+
options, guest = _split(args[1:])
|
|
177
|
+
parser = _parser()
|
|
178
|
+
try:
|
|
179
|
+
ns = parser.parse_args(options)
|
|
180
|
+
env = _env(ns.env, parser)
|
|
181
|
+
grants = _grants(ns.grants, parser)
|
|
182
|
+
except SystemExit as e: # usage errors exit 2; --help exits 0
|
|
183
|
+
return int(e.code or 0)
|
|
184
|
+
given: dict[str, Any] = {"cancel": threading.Event()} # set by no one: lets Ctrl-C stop it
|
|
185
|
+
for name in ("deadline_s", "memory_bytes", "output_bytes", "fuel"):
|
|
186
|
+
if hasattr(ns, name):
|
|
187
|
+
given[name] = getattr(ns, name)
|
|
188
|
+
if env is not None:
|
|
189
|
+
given["env"] = env
|
|
190
|
+
if ns.no_snapshot:
|
|
191
|
+
given["snapshot"] = False
|
|
192
|
+
if grants:
|
|
193
|
+
given["grants"] = grants
|
|
194
|
+
if hasattr(ns, "root"):
|
|
195
|
+
given["root"] = ns.root
|
|
196
|
+
elif ns.private_root:
|
|
197
|
+
given["root"] = True
|
|
198
|
+
elif ns.no_root:
|
|
199
|
+
given["root"] = False
|
|
200
|
+
try:
|
|
201
|
+
if ns.stdin is not None:
|
|
202
|
+
if ns.stdin == "-":
|
|
203
|
+
if sys.stdin is None or sys.stdin.closed:
|
|
204
|
+
raise OSError("--stdin -: this command's standard input is closed")
|
|
205
|
+
given["stdin"] = sys.stdin.buffer.read()
|
|
206
|
+
else:
|
|
207
|
+
with open(ns.stdin, "rb") as f:
|
|
208
|
+
given["stdin"] = f.read()
|
|
209
|
+
from . import runner
|
|
210
|
+
|
|
211
|
+
done = runner.run(guest, **given)
|
|
212
|
+
except Exception as e:
|
|
213
|
+
_write({"error": str(e), "kind": type(e).__name__})
|
|
214
|
+
return 1
|
|
215
|
+
_write(
|
|
216
|
+
{
|
|
217
|
+
"exit_code": done.exit_code,
|
|
218
|
+
"trapped": done.trapped,
|
|
219
|
+
"fuel_used": done.fuel_used,
|
|
220
|
+
"truncated": list(done.truncated),
|
|
221
|
+
**_stream("stdout", done.stdout),
|
|
222
|
+
**_stream("stderr", done.stderr),
|
|
223
|
+
}
|
|
224
|
+
)
|
|
225
|
+
return 0
|