This repository has been archived by the owner on Sep 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
script.html
101 lines (89 loc) · 3.08 KB
/
script.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Configurable interpreters</title>
<meta name="theme-color" content="#0b0c0c">
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="static/gd.css">
</head>
<body>
<py-config>
{
"interpreter": "micropython",
"files": {
"arrr.py": "/arrr.py"
}
}
</py-config>
<a href="#main-content" class="hide">Skip to main content</a>
<a name="top"></a>
<header>
<nav role="navigation">
<a href="/" style="text-decoration: none!important;";>
<img alt="Anaconda" src="static/logo.svg" width="54" height="54" style="display:inline;">
<img alt="Anaconda" src="static/anaconda.svg" height="54" style="display: inline; height: 42px;">
</a>
<ul>
<li><a href="/">Home</a></li>
<li><a href="https://github.com/pyscript/upys">Download</a></li>
</ul>
</nav>
</header>
<main id="main-content">
<h2>Configuration</h2>
<p>Given this HTML/JSON fragment:</p>
<pre><code><py-config>
{
"interpreter": "micropython",
"files": {
"arrr.py": "/arrr.py"
}
}
</py-config>
</code></pre>
<p>We're able to configure various things:</p>
<ul>
<li>The Python interpreter to use underneath the PyScript platform (currently
MicroPython and Pyodide are supported).</li>
<li>Files to be copied onto the interpreter's virtual filesystem. The
<code>files</code> object contains key (filename) and value (the URL
containing the content of the file) pairs defining what should be copied
over.</li>
</ul>
<p>If you "view source" for this page, you'll see we ensure the
<a href="https://arrr.readthedocs.io/en/latest/">Arrr</a> Python module is
copied over to the filesystem. Just import it, as usual, to make use of
it in your code:</p>
<pre><code><py-script>import arrr
text = "Hello there, from MicroPython running in the browser!"
pirate_text = arrr.translate(text)
print(pirate_text)
</py-script></code></pre>
<py-script>import arrr
text = "Hello there! It's MicroPython. Running in the browser!"
pirate_text = arrr.translate(text)
print(pirate_text)
</py-script>
<p>Once again, "view-source" and see for yourself?</p>
<a href="/"><button>Previous: Home</button></a>
<a href="repl.html"><button>Next: The REPL</button></a>
</main>
<footer>
<main>
<section>
<ul>
<li><a href="/">Home</a></li>
<li><a href="https://github.com/pyscript/upys">Download</a></li>
</ul>
<article>
<p>Made with ❤️ by folks at <a href="https://anaconda.com" rel="noopener">Anaconda Inc</a>.<br>
💡Inspired by the great work at <a href="https://micropython.org/" rel="noopener">MicroPython</a>.<br><br>
</article>
</section>
</main>
</footer>
</body>
<script src="pyscript.js" type="module"></script>
</html>