mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-19 18:27:29 -05:00
examples: py-env to py-config (#784)
* examples: py-env to py-config * 1 example as JSON with type * Fix todo event attribute
This commit is contained in:
@@ -5,11 +5,13 @@
|
|||||||
<link rel="icon" type="image/x-icon" href="./favicon.png">
|
<link rel="icon" type="image/x-icon" href="./favicon.png">
|
||||||
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
|
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
|
||||||
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
||||||
<py-env>
|
<py-config>
|
||||||
- altair
|
packages = [
|
||||||
- pandas
|
"altair",
|
||||||
- vega_datasets
|
"pandas",
|
||||||
</py-env>
|
"vega_datasets"
|
||||||
|
]
|
||||||
|
</py-config>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="altair" style="width: 100%; height: 100%"></div>
|
<div id="altair" style="width: 100%; height: 100%"></div>
|
||||||
|
|||||||
@@ -6,10 +6,11 @@
|
|||||||
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
|
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
|
||||||
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<py-env>
|
<py-config>
|
||||||
- paths:
|
paths = [
|
||||||
- ./antigravity.py
|
"./antigravity.py"
|
||||||
</py-env>
|
]
|
||||||
|
</py-config>
|
||||||
<body>
|
<body>
|
||||||
<b>Based on xkcd: antigravity https://xkcd.com/353/.</b>
|
<b>Based on xkcd: antigravity https://xkcd.com/353/.</b>
|
||||||
<py-script>
|
<py-script>
|
||||||
|
|||||||
@@ -17,10 +17,12 @@
|
|||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<py-env>
|
<py-config>
|
||||||
- bokeh
|
packages = [
|
||||||
- numpy
|
"bokeh",
|
||||||
</py-env>
|
"numpy"
|
||||||
|
]
|
||||||
|
</py-config>
|
||||||
<h1>Bokeh Example</h1>
|
<h1>Bokeh Example</h1>
|
||||||
<div id="myplot"></div>
|
<div id="myplot"></div>
|
||||||
|
|
||||||
|
|||||||
@@ -17,10 +17,12 @@
|
|||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<py-env>
|
<py-config>
|
||||||
- bokeh
|
packages = [
|
||||||
- numpy
|
"bokeh",
|
||||||
</py-env>
|
"numpy"
|
||||||
|
]
|
||||||
|
</py-config>
|
||||||
<h1>Bokeh Example</h1>
|
<h1>Bokeh Example</h1>
|
||||||
<div id="myplot"></div>
|
<div id="myplot"></div>
|
||||||
|
|
||||||
|
|||||||
@@ -5,10 +5,12 @@
|
|||||||
<link rel="icon" type="image/x-icon" href="./favicon.png">
|
<link rel="icon" type="image/x-icon" href="./favicon.png">
|
||||||
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
|
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
|
||||||
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
||||||
<py-env>
|
<py-config>
|
||||||
- folium
|
packages = [
|
||||||
- pandas
|
"folium",
|
||||||
</py-env>
|
"pandas"
|
||||||
|
]
|
||||||
|
</py-config>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="folium" style="width: 100%; height: 100%"></div>
|
<div id="folium" style="width: 100%; height: 100%"></div>
|
||||||
|
|||||||
@@ -5,9 +5,11 @@
|
|||||||
<link rel="icon" type="image/x-icon" href="./favicon.png">
|
<link rel="icon" type="image/x-icon" href="./favicon.png">
|
||||||
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
|
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
|
||||||
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
||||||
<py-env>
|
<py-config>
|
||||||
- matplotlib
|
packages = [
|
||||||
</py-env>
|
"matplotlib"
|
||||||
|
]
|
||||||
|
</py-config>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="mpl"></div>
|
<div id="mpl"></div>
|
||||||
|
|||||||
@@ -7,11 +7,13 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<py-env>
|
<py-config>
|
||||||
- numpy
|
packages = [
|
||||||
- networkx
|
"numpy",
|
||||||
- matplotlib
|
"networkx",
|
||||||
</py-env>
|
"matplotlib"
|
||||||
|
]
|
||||||
|
</py-config>
|
||||||
<py-script>
|
<py-script>
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import networkx as nx
|
import networkx as nx
|
||||||
|
|||||||
@@ -9,11 +9,13 @@
|
|||||||
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
|
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
|
||||||
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
||||||
|
|
||||||
<py-env>
|
<py-config>
|
||||||
- micrograd
|
packages = [
|
||||||
- numpy
|
"micrograd",
|
||||||
- matplotlib
|
"numpy",
|
||||||
</py-env>
|
"matplotlib"
|
||||||
|
]
|
||||||
|
</py-config>
|
||||||
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -78,13 +78,18 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<py-env>
|
<py-config type="json">
|
||||||
- numpy
|
{
|
||||||
- sympy
|
"packages": [
|
||||||
- paths:
|
"numpy",
|
||||||
- ./palettes.py
|
"sympy"
|
||||||
- ./fractals.py
|
],
|
||||||
</py-env>
|
"paths": [
|
||||||
|
"./palettes.py",
|
||||||
|
"./fractals.py"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
</py-config>
|
||||||
|
|
||||||
<py-script>
|
<py-script>
|
||||||
from pyodide.ffi import to_js, create_proxy
|
from pyodide.ffi import to_js, create_proxy
|
||||||
|
|||||||
@@ -10,11 +10,13 @@
|
|||||||
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
|
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
|
||||||
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<py-env>
|
<py-config>
|
||||||
- bokeh
|
packages = [
|
||||||
- numpy
|
"bokeh",
|
||||||
- panel==0.13.1
|
"numpy",
|
||||||
</py-env>
|
"panel==0.13.1"
|
||||||
|
]
|
||||||
|
</py-config>
|
||||||
<body>
|
<body>
|
||||||
<h1>Panel Example</h1>
|
<h1>Panel Example</h1>
|
||||||
<div id="simple_app"></div>
|
<div id="simple_app"></div>
|
||||||
|
|||||||
@@ -42,12 +42,14 @@
|
|||||||
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<py-env>
|
<py-config>
|
||||||
- bokeh
|
packages = [
|
||||||
- numpy
|
"bokeh",
|
||||||
- pandas
|
"numpy",
|
||||||
- panel==0.13.1
|
"pandas",
|
||||||
</py-env>
|
"panel==0.13.1"
|
||||||
|
]
|
||||||
|
</py-config>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="container-fluid d-flex flex-column vh-100 overflow-hidden" id="container">
|
<div class="container-fluid d-flex flex-column vh-100 overflow-hidden" id="container">
|
||||||
|
|||||||
@@ -43,13 +43,15 @@
|
|||||||
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<py-env>
|
<py-config>
|
||||||
- altair
|
packages = [
|
||||||
- numpy
|
"altair",
|
||||||
- pandas
|
"numpy",
|
||||||
- scikit-learn
|
"pandas",
|
||||||
- panel==0.13.1
|
"scikit-learn",
|
||||||
</py-env>
|
"panel==0.13.1"
|
||||||
|
]
|
||||||
|
</py-config>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="container-fluid d-flex flex-column vh-100 overflow-hidden" id="container">
|
<div class="container-fluid d-flex flex-column vh-100 overflow-hidden" id="container">
|
||||||
|
|||||||
@@ -34,12 +34,14 @@
|
|||||||
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<py-env>
|
<py-config>
|
||||||
- bokeh
|
packages = [
|
||||||
- numpy
|
"bokeh",
|
||||||
- pandas
|
"numpy",
|
||||||
- panel==0.13.1
|
"pandas",
|
||||||
</py-env>
|
"panel==0.13.1"
|
||||||
|
]
|
||||||
|
</py-config>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="container-fluid d-flex flex-column vh-100 overflow-hidden" id="container">
|
<div class="container-fluid d-flex flex-column vh-100 overflow-hidden" id="container">
|
||||||
|
|||||||
@@ -11,10 +11,11 @@
|
|||||||
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<py-env>
|
<py-config>
|
||||||
- paths:
|
paths = [
|
||||||
- ./antigravity.py
|
"./antigravity.py"
|
||||||
</py-env>
|
]
|
||||||
|
</py-config>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<h1><b>pyscript REPL</b></h1>
|
<h1><b>pyscript REPL</b></h1>
|
||||||
|
|||||||
@@ -13,13 +13,16 @@
|
|||||||
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<py-env>
|
<py-config>
|
||||||
- bokeh
|
packages = [
|
||||||
- numpy
|
"bokeh",
|
||||||
- paths:
|
"numpy"
|
||||||
- ./utils.py
|
]
|
||||||
- ./antigravity.py
|
paths = [
|
||||||
</py-env>
|
"./utils.py",
|
||||||
|
"./antigravity.py"
|
||||||
|
]
|
||||||
|
</py-config>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<h1 class="font-semibold text-2xl ml-5">Custom REPL</h1>
|
<h1 class="font-semibold text-2xl ml-5">Custom REPL</h1>
|
||||||
|
|||||||
@@ -10,10 +10,11 @@
|
|||||||
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
|
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
|
||||||
|
|
||||||
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
||||||
<py-env>
|
<py-config>
|
||||||
- paths:
|
paths = [
|
||||||
- ./utils.py
|
"./utils.py"
|
||||||
</py-env>
|
]
|
||||||
|
</py-config>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -9,10 +9,11 @@
|
|||||||
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
|
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
|
||||||
|
|
||||||
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
||||||
<py-env>
|
<py-config>
|
||||||
- paths:
|
paths = [
|
||||||
- ./utils.py
|
"./utils.py"
|
||||||
</py-env>
|
]
|
||||||
|
</py-config>
|
||||||
<py-register-widget src="./pylist.py" name="py-list" klass="PyList"></py-register-widget>
|
<py-register-widget src="./pylist.py" name="py-list" klass="PyList"></py-register-widget>
|
||||||
|
|
||||||
<py-script>
|
<py-script>
|
||||||
|
|||||||
@@ -10,10 +10,11 @@
|
|||||||
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
|
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
|
||||||
|
|
||||||
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
||||||
<py-env>
|
<py-config>
|
||||||
- paths:
|
paths = [
|
||||||
- ./utils.py
|
"./utils.py"
|
||||||
</py-env>
|
]
|
||||||
|
</py-config>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="container">
|
<body class="container">
|
||||||
@@ -28,7 +29,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<input id="new-task-content" class="py-input" type="text">
|
<input id="new-task-content" class="py-input" type="text">
|
||||||
<button id="new-task-btn" class="py-button" type="submit" py-onClick="add_task()">
|
<button id="new-task-btn" class="py-button" type="submit" py-click="add_task()">
|
||||||
Add task
|
Add task
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -34,12 +34,14 @@
|
|||||||
crossorigin="anonymous">
|
crossorigin="anonymous">
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
<py-env>
|
<py-config>
|
||||||
- './static/wheels/travertino-0.1.3-py3-none-any.whl'
|
packages = [
|
||||||
- './static/wheels/toga_core-0.3.0.dev33-py3-none-any.whl'
|
"./static/wheels/travertino-0.1.3-py3-none-any.whl",
|
||||||
- './static/wheels/toga_web-0.3.0.dev33-py3-none-any.whl'
|
"./static/wheels/toga_core-0.3.0.dev33-py3-none-any.whl",
|
||||||
- './static/wheels/freedom-0.0.1-py3-none-any.whl'
|
"./static/wheels/toga_web-0.3.0.dev33-py3-none-any.whl",
|
||||||
</py-env>
|
"./static/wheels/freedom-0.0.1-py3-none-any.whl"
|
||||||
|
]
|
||||||
|
</py-config>
|
||||||
<py-script>
|
<py-script>
|
||||||
from toga_web.dom import handle as dom_handle
|
from toga_web.dom import handle as dom_handle
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user