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="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
|
||||
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
||||
<py-env>
|
||||
- altair
|
||||
- pandas
|
||||
- vega_datasets
|
||||
</py-env>
|
||||
<py-config>
|
||||
packages = [
|
||||
"altair",
|
||||
"pandas",
|
||||
"vega_datasets"
|
||||
]
|
||||
</py-config>
|
||||
</head>
|
||||
<body>
|
||||
<div id="altair" style="width: 100%; height: 100%"></div>
|
||||
|
||||
@@ -6,10 +6,11 @@
|
||||
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
|
||||
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
||||
</head>
|
||||
<py-env>
|
||||
- paths:
|
||||
- ./antigravity.py
|
||||
</py-env>
|
||||
<py-config>
|
||||
paths = [
|
||||
"./antigravity.py"
|
||||
]
|
||||
</py-config>
|
||||
<body>
|
||||
<b>Based on xkcd: antigravity https://xkcd.com/353/.</b>
|
||||
<py-script>
|
||||
|
||||
@@ -17,10 +17,12 @@
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<py-env>
|
||||
- bokeh
|
||||
- numpy
|
||||
</py-env>
|
||||
<py-config>
|
||||
packages = [
|
||||
"bokeh",
|
||||
"numpy"
|
||||
]
|
||||
</py-config>
|
||||
<h1>Bokeh Example</h1>
|
||||
<div id="myplot"></div>
|
||||
|
||||
|
||||
@@ -17,10 +17,12 @@
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<py-env>
|
||||
- bokeh
|
||||
- numpy
|
||||
</py-env>
|
||||
<py-config>
|
||||
packages = [
|
||||
"bokeh",
|
||||
"numpy"
|
||||
]
|
||||
</py-config>
|
||||
<h1>Bokeh Example</h1>
|
||||
<div id="myplot"></div>
|
||||
|
||||
|
||||
@@ -5,10 +5,12 @@
|
||||
<link rel="icon" type="image/x-icon" href="./favicon.png">
|
||||
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
|
||||
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
||||
<py-env>
|
||||
- folium
|
||||
- pandas
|
||||
</py-env>
|
||||
<py-config>
|
||||
packages = [
|
||||
"folium",
|
||||
"pandas"
|
||||
]
|
||||
</py-config>
|
||||
</head>
|
||||
<body>
|
||||
<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="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
|
||||
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
||||
<py-env>
|
||||
- matplotlib
|
||||
</py-env>
|
||||
<py-config>
|
||||
packages = [
|
||||
"matplotlib"
|
||||
]
|
||||
</py-config>
|
||||
</head>
|
||||
<body>
|
||||
<div id="mpl"></div>
|
||||
|
||||
@@ -7,11 +7,13 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<py-env>
|
||||
- numpy
|
||||
- networkx
|
||||
- matplotlib
|
||||
</py-env>
|
||||
<py-config>
|
||||
packages = [
|
||||
"numpy",
|
||||
"networkx",
|
||||
"matplotlib"
|
||||
]
|
||||
</py-config>
|
||||
<py-script>
|
||||
import numpy as np
|
||||
import networkx as nx
|
||||
|
||||
@@ -9,11 +9,13 @@
|
||||
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
|
||||
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
||||
|
||||
<py-env>
|
||||
- micrograd
|
||||
- numpy
|
||||
- matplotlib
|
||||
</py-env>
|
||||
<py-config>
|
||||
packages = [
|
||||
"micrograd",
|
||||
"numpy",
|
||||
"matplotlib"
|
||||
]
|
||||
</py-config>
|
||||
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
|
||||
</head>
|
||||
|
||||
@@ -78,13 +78,18 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<py-env>
|
||||
- numpy
|
||||
- sympy
|
||||
- paths:
|
||||
- ./palettes.py
|
||||
- ./fractals.py
|
||||
</py-env>
|
||||
<py-config type="json">
|
||||
{
|
||||
"packages": [
|
||||
"numpy",
|
||||
"sympy"
|
||||
],
|
||||
"paths": [
|
||||
"./palettes.py",
|
||||
"./fractals.py"
|
||||
]
|
||||
}
|
||||
</py-config>
|
||||
|
||||
<py-script>
|
||||
from pyodide.ffi import to_js, create_proxy
|
||||
|
||||
@@ -10,11 +10,13 @@
|
||||
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
|
||||
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
||||
</head>
|
||||
<py-env>
|
||||
- bokeh
|
||||
- numpy
|
||||
- panel==0.13.1
|
||||
</py-env>
|
||||
<py-config>
|
||||
packages = [
|
||||
"bokeh",
|
||||
"numpy",
|
||||
"panel==0.13.1"
|
||||
]
|
||||
</py-config>
|
||||
<body>
|
||||
<h1>Panel Example</h1>
|
||||
<div id="simple_app"></div>
|
||||
|
||||
@@ -42,12 +42,14 @@
|
||||
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
||||
</head>
|
||||
|
||||
<py-env>
|
||||
- bokeh
|
||||
- numpy
|
||||
- pandas
|
||||
- panel==0.13.1
|
||||
</py-env>
|
||||
<py-config>
|
||||
packages = [
|
||||
"bokeh",
|
||||
"numpy",
|
||||
"pandas",
|
||||
"panel==0.13.1"
|
||||
]
|
||||
</py-config>
|
||||
|
||||
<body>
|
||||
<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>
|
||||
</head>
|
||||
|
||||
<py-env>
|
||||
- altair
|
||||
- numpy
|
||||
- pandas
|
||||
- scikit-learn
|
||||
- panel==0.13.1
|
||||
</py-env>
|
||||
<py-config>
|
||||
packages = [
|
||||
"altair",
|
||||
"numpy",
|
||||
"pandas",
|
||||
"scikit-learn",
|
||||
"panel==0.13.1"
|
||||
]
|
||||
</py-config>
|
||||
|
||||
<body>
|
||||
<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>
|
||||
</head>
|
||||
|
||||
<py-env>
|
||||
- bokeh
|
||||
- numpy
|
||||
- pandas
|
||||
- panel==0.13.1
|
||||
</py-env>
|
||||
<py-config>
|
||||
packages = [
|
||||
"bokeh",
|
||||
"numpy",
|
||||
"pandas",
|
||||
"panel==0.13.1"
|
||||
]
|
||||
</py-config>
|
||||
|
||||
<body>
|
||||
<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>
|
||||
</head>
|
||||
|
||||
<py-env>
|
||||
- paths:
|
||||
- ./antigravity.py
|
||||
</py-env>
|
||||
<py-config>
|
||||
paths = [
|
||||
"./antigravity.py"
|
||||
]
|
||||
</py-config>
|
||||
|
||||
<body>
|
||||
<h1><b>pyscript REPL</b></h1>
|
||||
|
||||
@@ -13,13 +13,16 @@
|
||||
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
||||
</head>
|
||||
|
||||
<py-env>
|
||||
- bokeh
|
||||
- numpy
|
||||
- paths:
|
||||
- ./utils.py
|
||||
- ./antigravity.py
|
||||
</py-env>
|
||||
<py-config>
|
||||
packages = [
|
||||
"bokeh",
|
||||
"numpy"
|
||||
]
|
||||
paths = [
|
||||
"./utils.py",
|
||||
"./antigravity.py"
|
||||
]
|
||||
</py-config>
|
||||
|
||||
<body>
|
||||
<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" />
|
||||
|
||||
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
||||
<py-env>
|
||||
- paths:
|
||||
- ./utils.py
|
||||
</py-env>
|
||||
<py-config>
|
||||
paths = [
|
||||
"./utils.py"
|
||||
]
|
||||
</py-config>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -9,10 +9,11 @@
|
||||
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
|
||||
|
||||
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
||||
<py-env>
|
||||
- paths:
|
||||
- ./utils.py
|
||||
</py-env>
|
||||
<py-config>
|
||||
paths = [
|
||||
"./utils.py"
|
||||
]
|
||||
</py-config>
|
||||
<py-register-widget src="./pylist.py" name="py-list" klass="PyList"></py-register-widget>
|
||||
|
||||
<py-script>
|
||||
|
||||
@@ -10,10 +10,11 @@
|
||||
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
|
||||
|
||||
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
|
||||
<py-env>
|
||||
- paths:
|
||||
- ./utils.py
|
||||
</py-env>
|
||||
<py-config>
|
||||
paths = [
|
||||
"./utils.py"
|
||||
]
|
||||
</py-config>
|
||||
</head>
|
||||
|
||||
<body class="container">
|
||||
@@ -28,7 +29,7 @@
|
||||
</div>
|
||||
<div>
|
||||
<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
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -34,12 +34,14 @@
|
||||
crossorigin="anonymous">
|
||||
</script>
|
||||
</body>
|
||||
<py-env>
|
||||
- './static/wheels/travertino-0.1.3-py3-none-any.whl'
|
||||
- './static/wheels/toga_core-0.3.0.dev33-py3-none-any.whl'
|
||||
- './static/wheels/toga_web-0.3.0.dev33-py3-none-any.whl'
|
||||
- './static/wheels/freedom-0.0.1-py3-none-any.whl'
|
||||
</py-env>
|
||||
<py-config>
|
||||
packages = [
|
||||
"./static/wheels/travertino-0.1.3-py3-none-any.whl",
|
||||
"./static/wheels/toga_core-0.3.0.dev33-py3-none-any.whl",
|
||||
"./static/wheels/toga_web-0.3.0.dev33-py3-none-any.whl",
|
||||
"./static/wheels/freedom-0.0.1-py3-none-any.whl"
|
||||
]
|
||||
</py-config>
|
||||
<py-script>
|
||||
from toga_web.dom import handle as dom_handle
|
||||
|
||||
|
||||
Reference in New Issue
Block a user