8000 kill unwrapped_remote by madhur-tandon · Pull Request #1490 · pyscript/pyscript · GitHub
[go: up one dir, main page]

Skip to content

kill unwrapped_remote #1490

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

Merged
merged 4 commits into from
Jun 1, 2023

Conversation

madhur-tandon
Copy link
Member
@madhur-tandon madhur-tandon commented May 27, 2023

Closes #1384

@madhur-tandon madhur-tandon force-pushed the kill_unwrapped_remote branch from 6ad6cb9 to fa7cedc Compare May 27, 2023 18:45
@madhur-tandon madhur-tandon marked this pull request as ready for review May 27, 2023 19:55
@madhur-tandon madhur-tandon self-assigned this May 27, 2023
beforePyScriptExec?: { callKwargs: (options: any) => Promise<void> };
afterPyScriptExec?: { callKwargs: (options: any) => Promise<void> };
beforePyReplExec?: { callKwargs: (options: any) => Promise<void> };
afterPyReplExec?: { callKwargs: (options: any) => Promise<void> };
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed callKwargs to have actual list of args instead....

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to make it so that we can use kwargs. I'll look into fixing it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed callKwargs to have actual list of args instead....

good idea @madhur-tandon, it looks also cleaner and easier to read now

I would like to make it so that we can use kwargs. I'll look into fixing it.

yes, this looks like a good idea in general

@@ -63,12 +63,10 @@ class ExecTestLogger(Plugin):
async def beforePyScriptExec(self, interpreter, src, pyScriptTag):
console.log(f'beforePyScriptExec called')
console.log(f'before_src:{src}')
console.log(f'before_id:{pyScriptTag.id}')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pyScriptTag is a pyodide.ffi.JsProxy and I was unable to get the id.

I have removed this for now...since it wasn't testing something of any significant value I guess...
But of course, if there's a way to resolve this, we should re-add this stuff...

Copy link
Contributor
@JeffersGlass JeffersGlass May 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pyScriptTag should be unwrapped as an HtmlElement within Python, and not appear like a JsProxy in this context... I was having similar issues with the event listener work, with some methods/attributes on JsProxies not proxying properly.

We should try to understand why this regression happened, because it means something in the way the JS objects are proxied into Python is broken.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pyScriptTag should be unwrapped as an HtmlElement within Python, and not appear like a JsProxy in this context

I'm confused. pyScriptTag is a JS object of clas HTMLElement, isn't it? If so, then it must be a JSProxy, because that's the way in which pyodide passes JS objects into Python.
What am I missing?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I phrased my response poorly. This is my concern:

pyScriptTag is a pyodide.ffi.JsProxy and I was unable to get the id. I have removed this for now...

Accessing the id attribute here previous worked, and now doesn't. Which means attribute access on JsProxies is broken, in some way we don't understand. Does it need an await? Is it specific to async contexts? We don't know, but this previously worked and now doesn't.

Specific to this code, does this mean users can't access attributes of the pyScriptTag at all, and if not, what's the value in passing it?

Copy link
Contributor
@antocuni antocuni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

beforePyScriptExec?: { callKwargs: (options: any) => Promise<void> };
afterPyScriptExec?: { callKwargs: (options: any) => Promise<void> };
beforePyReplExec?: { callKwargs: (options: any) => Promise<void> };
afterPyReplExec?: { callKwargs: (options: any) => Promise<void> };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed callKwargs to have actual list of args instead....

good idea @madhur-tandon, it looks also cleaner and easier to read now

I would like to make it so that we can use kwargs. I'll look into fixing it.

yes, this looks like a good idea in general

@@ -63,12 +63,10 @@ class ExecTestLogger(Plugin):
async def beforePyScriptExec(self, interpreter, src, pyScriptTag):
console.log(f'beforePyScriptExec called')
console.log(f'before_src:{src}')
console.log(f'before_id:{pyScriptTag.id}')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pyScriptTag should be unwrapped as an HtmlElement within Python, and not appear like a JsProxy in this context

I'm confused. pyScriptTag is a JS object of clas HTMLElement, isn't it? If so, then it must be a JSProxy, because that's the way in which pyodide passes JS objects into Python.
What am I missing?

@madhur-tandon madhur-tandon merged commit 17d16b9 into pyscript:main Jun 1, 2023
@madhur-tandon madhur-tandon deleted the kill_unwrapped_remote branch June 1, 2023 17:22
WebReflection added a commit that referenced this pull request Jun 5, 2023
* kill unwrapped_remote (#1490)

* kill unwrapped_remote

* linting

* don't use callKwargs for python plugins

* fix tests and improve types

* Bringing PyScript.next PoC to the main project

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Madhur Tandon <20173739+madhur-tandon@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Worker support] Kill _unwrapped_remote
4 participants
0