Skip to content

[IDEA] Web imports for WASM #659

@palaviv

Description

@palaviv

When using our WASM code currently doing import to anything that is not packaged in the build (builtins, stdlib) will not work. I suggest we will allow import in a way very similar to any other web resource.
For example when we will run the following from http://test.org/py.html

rp.pyEval("import test")

The WASM import will do a HTTP GET request to http://test.org/test.py and import the content of the file.

We can also allow the users to add other paths to sys.path so the browser will try to look for the imported file there as well. I think that the paths should be treated like html paths:

  • path/to/import: will be relative to the current file.
  • /path/to/import : will be absolute to the server root.
  • 'http://rustpypi.org/imports': will look in the imports path at domain rustpypi.org.

We should probably add the js VirtualMachine a setSysPath function like setStdout.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions