Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite409f5c

Browse files
authored
Merge pull requestpyscript#30 from anaconda/pys-22/support-pip-in-pyenv
[PYS-22] support pip in pyenv
2 parentsb5f8ce6 +792db8c commite409f5c

File tree

5 files changed

+9
-14
lines changed

5 files changed

+9
-14
lines changed

‎pyscriptjs/examples/panel.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,12 @@
1313
<py-env>
1414
- bokeh
1515
- numpy
16+
- panel
1617
</py-env>
1718
<h1>Panel Example</h1>
1819
<divid="myplot"></div>
1920
<py-script>
2021
import asyncio
21-
import micropip
22-
23-
await micropip.install(['panel'])
24-
2522
import panel as pn
2623

2724
slider = pn.widgets.FloatSlider(start=0, end=10, name='Amplitude')

‎pyscriptjs/examples/panel_deckgl.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
- bokeh
4747
- numpy
4848
- pandas
49+
- panel==0.13.1a1
4950
</py-env>
5051

5152
<divclass="container-fluid d-flex flex-column vh-100 overflow-hidden"id="container">
@@ -74,13 +75,10 @@
7475
</div>
7576
<py-script>
7677
import asyncio
77-
import micropip
7878

7979
from io import StringIO
8080
from js import fetch
8181

82-
await micropip.install(['panel==0.13.1a1'])
83-
8482
import panel as pn
8583
import param
8684
import pandas as pd

‎pyscriptjs/examples/panel_kmeans.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
- numpy
4848
- pandas
4949
- scikit-learn
50+
- panel
51+
- altair
5052
</py-env>
5153

5254
<divclass="container-fluid d-flex flex-column vh-100 overflow-hidden"id="container">
@@ -78,13 +80,10 @@
7880
</div>
7981
<py-script>
8082
import asyncio
81-
import micropip
8283

8384
from io import StringIO
8485
from js import fetch
8586

86-
await micropip.install(['panel', 'altair'])
87-
8887
import altair as alt
8988
import panel as pn
9089
import pandas as pd

‎pyscriptjs/examples/panel_stream.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
- bokeh
4444
- numpy
4545
- pandas
46+
- panel
4647
</py-env>
4748

4849
<divclass="container-fluid d-flex flex-column vh-100 overflow-hidden"id="container">
@@ -69,9 +70,6 @@
6970
</div>
7071
<py-script>
7172
import asyncio
72-
import micropip
73-
74-
await micropip.install(['panel'])
7573

7674
import panel as pn
7775
import numpy as np

‎pyscriptjs/src/interpreter.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ let pyodide;
77

88
letadditional_definitions=`
99
from js import document, setInterval, console
10+
import micropip
1011
import asyncio
1112
import io, base64, sys
1213
@@ -178,7 +179,9 @@ let loadInterpreter = async function(): Promise<any> {
178179
}
179180

180181
letloadPackage=asyncfunction(package_name:string[]|string,runtime:any):Promise<any>{
181-
awaitruntime.loadPackage(package_name);
182+
letmicropip=pyodide.globals.get('micropip');
183+
awaitmicropip.install(package_name)
184+
micropip.destroy()
182185
}
183186

184187
letloadFromFile=asyncfunction(s:string,runtime:any):Promise<any>{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp