Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pyodide
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
pyodide
Commits
2d473282
Commit
2d473282
authored
Dec 19, 2018
by
Michael Droettboom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add comments in PR
parent
f4400b12
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
5 deletions
+12
-5
docs/api_reference.md
docs/api_reference.md
+9
-2
src/pyodide.js
src/pyodide.js
+2
-2
test/test_python.py
test/test_python.py
+1
-1
No files found.
docs/api_reference.md
View file @
2d473282
...
...
@@ -98,6 +98,14 @@ For example, to access the `foo` Python object from Javascript:
| | | types, a Proxy object to the Python |
| | | object is returned. |
### pyodide.globals
An object whose attributes are members of the Python global namespace. This is a
more convenient alternative to
`pyodide.pyimport`
.
For example, to access the
`foo`
Python object from Javascript:
`pyodide.globals.foo`
### pyodide.repr(obj)
...
...
@@ -191,4 +199,3 @@ None
| name | type | description |
|-----------|--------|------------------------|
|
*version*
| String | Pyodide version string |
src/pyodide.js
View file @
2d473282
...
...
@@ -233,9 +233,9 @@ var languagePluginLoader = new Promise((resolve, reject) => {
////////////////////////////////////////////////////////////
// Rearrange namespace for public API
let
PUBLIC_API
=
[
'
globals
'
,
'
loadPackage
'
,
'
loadedPackages
'
,
'
py
'
,
'
pyimport
'
,
'
repr
'
,
'
runPython
'
,
...
...
@@ -278,7 +278,7 @@ var languagePluginLoader = new Promise((resolve, reject) => {
.
then
((
response
)
=>
response
.
json
())
.
then
((
json
)
=>
{
fixRecursionLimit
(
window
.
pyodide
);
window
.
pyodide
.
py
=
window
.
pyodide
.
globals
=
window
.
pyodide
.
runPython
(
'
import sys
\n
sys.modules["__main__"]
'
);
window
.
pyodide
=
makePublicAPI
(
window
.
pyodide
,
PUBLIC_API
);
window
.
pyodide
.
_module
.
packages
=
json
;
...
...
test/test_python.py
View file @
2d473282
...
...
@@ -609,4 +609,4 @@ def test_py(selenium_standalone):
"""
)
assert
selenium_standalone
.
run_js
(
'return pyodide.
py
.func()'
)
==
42
assert
selenium_standalone
.
run_js
(
'return pyodide.
globals
.func()'
)
==
42
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment