-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add nox configuration to start pyodine console #3338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
cf8c98c
to
dfbea5b
Compare
dfbea5b
to
8adac23
Compare
@sethmlarson , please try this pyodide console approach and tell me if that's what you were looking for when you wrote #3330 |
7c00780
to
8adac23
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for opening this! I put some early comments below:
noxfile.py
Outdated
@@ -200,6 +200,18 @@ def lint(session: nox.Session) -> None: | |||
mypy(session) | |||
|
|||
|
|||
@nox.session(python="3.11") | |||
def pyodineconsole(session: nox.Session) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: pyodide*
@@ -200,6 +200,18 @@ def lint(session: nox.Session) -> None: | |||
mypy(session) | |||
|
|||
|
|||
@nox.session(python="3.11") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be a specific Python version, or can we use any 3.x?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't specify a version then nox will run the same python interpreter used to run nox itself.
I mean, the alternative skip nox (which is for test automation, not for this).
I can create a python script to create virtualenv , install dependencies, etc instead. then we are not bound by the nox rules.
templates/pyodide-console.html
Outdated
@@ -0,0 +1,267 @@ | |||
<!doctype html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we find a new home for this file? Maybe under test/
for Emscripten?
Did you write this file yourself or is it from somewhere, I don't see license information.
What is the expected maintenance requirements for this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we find a new home for this file? Maybe under test/ for Emscripten?
Sure, I can do that.
Did you write this file yourself or is it from somewhere, I don't see license information.
I mentioned in the PR description
creates a index.html file in dist/, with a pyodine terminal taken
from pyodide src/templates/console.html
The LICENSE is https://github.com/pyodide/pyodide/blob/main/LICENSE. (Mozilla Public License Version 2.0)
I can add a comment on the top of the file with the original source url, not sure , should I add a "copyright" comment although the original does not have it? The closest copyright notice that I can find in their repo is "2019-2022, Pyodide contributors and Mozilla", I can add that?
What is the expected maintenance requirements for this file?
I guess we won't maintain this file. It's the same jQuery REPL that is used in https://pyodide.org/en/stable/console.html, if it stops working we can always copy the latest from pyodide src/templates/console.html. And then add the lines
await term.ready;
await term.exec("import micropip\n");
await term.exec("micropip.list()\n");
await term.exec('await micropip.install("http://localhost:8000/urllib3-2.2.0-py3-none-any.whl")')
await term.exec("micropip.list()");
await term.exec("import urllib3");
await term.exec("urllib3.__version__");
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, apologies for not reading the description closely enough
templates/pyodide-console.html
Outdated
await term.ready; | ||
await term.exec("import micropip\n"); | ||
await term.exec("micropip.list()\n"); | ||
await term.exec('await micropip.install("http://localhost:8000/urllib3-2.2.0-py3-none-any.whl")') | ||
await term.exec("micropip.list()"); | ||
await term.exec("import urllib3"); | ||
await term.exec("urllib3.__version__"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sethmlarson , this is the part that I added to the original https://github.com/pyodide/pyodide/blob/3500c17468e474902044413679b024dc7af75621/src/templates/console.html
<!-- taken from https://github.com/pyodide/pyodide/blob/main/src/templates/console.html --> | ||
<!-- Copyright (C) 2019-2022, Pyodide contributors and Mozilla --> | ||
<!-- SPDX-FileCopyrightText: 2019-2022, Pyodide contributors and Mozilla --> | ||
<!-- SPDX-License-Identifier: MPL-2.0 --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sethmlarson , I added mention of the source, copyright and license here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome and perfectly recreates the issue w/ InsecureRequestWarning, thank you @ecerulm!
@ecerulm The linked issue was a bounty issue for $100, so if you're able to please submit an expense to our Open Collective linking back to this PR. |
This adds a nox session called
pyodineconsole
.This nox session
urllib
intodist/
index.html
file indist/
, with a pyodine terminal takenfrom pyodine src/templates/console.html
import micropip
await micropip.install("http://localhost:8000/urllib3-2.2.0-py3-none-any.whl")
import urllib3
urllib3.__version__
Then you open http://localhost:8000 and you will be presented with
Closes #3330