### Install PythonMonkey from PyPI Source: https://docs.pythonmonkey.io/index.html Standard installation command for PythonMonkey using pip. ```bash pip install pythonmonkey ``` -------------------------------- ### Install Project Dependencies Source: https://docs.pythonmonkey.io/index.html Installs all project dependencies and compiles the project within the Poetry virtual environment. ```bash poetry install ``` -------------------------------- ### Start Debugging in VSCode Source: https://docs.pythonmonkey.io/index.html Instructions for starting the debugger in VSCode by pressing F5 on an open Python file. Assumes `launch.json` is configured. ```plaintext F5 ``` -------------------------------- ### Install Development Dependencies Source: https://docs.pythonmonkey.io/index.html Installs only the development dependencies for the project, excluding the main project root. This is a prerequisite for running tests. ```bash poetry install --no-root --only=dev ``` -------------------------------- ### Install and Evaluate JavaScript Source: https://docs.pythonmonkey.io/index.html Install PythonMonkey using pip and evaluate JavaScript code directly within Python. This is a quick way to get started with basic JavaScript execution. ```python pip install pythonmonkey from pythonmonkey import eval as js_eval js_eval("console.log")('hello, world') ``` -------------------------------- ### Install PythonMonkey Nightly Build Source: https://docs.pythonmonkey.io/index.html Command to install the latest nightly build of PythonMonkey from a specific index URL. ```bash pip install --extra-index-url https://nightly.pythonmonkey.io/ --pre pythonmonkey ``` -------------------------------- ### repl() Source: https://docs.pythonmonkey.io/namespacemembers_func.html Starts a Read-Eval-Print Loop (REPL) session. ```APIDOC ## repl() ### Description Starts a Read-Eval-Print Loop (REPL) session. ### Method N/A (Function) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ### Associated Namespace pythonmonkey.cli.pmjs ``` -------------------------------- ### Build Project Documentation Source: https://docs.pythonmonkey.io/index.html Builds the project documentation by setting the `BUILD_DOCS` environment variable before running the install command. ```bash BUILD_DOCS=1 poetry install ``` -------------------------------- ### pythonmonkey.cli.pmjs.repl Source: https://docs.pythonmonkey.io/pmjs_8py.html Starts the Read-Eval-Print Loop (REPL) for the pmjs environment. ```APIDOC ## pythonmonkey.cli.pmjs.repl () ### Description Starts the Read-Eval-Print Loop (REPL) for the pmjs environment. ### Method python ### Endpoint N/A ### Parameters None ### Request Example None ### Response None ``` -------------------------------- ### Define Low Surrogate Start Source: https://docs.pythonmonkey.io/StrType_8cc.html Defines the minimum value for a low surrogate code point in UTF-16. ```c #define LOW_SURROGATE_START 0xDC00 ``` -------------------------------- ### LOW_SURROGATE_START Source: https://docs.pythonmonkey.io/jsTypeFactory_8cc.html Macro defining the start of the low surrogate range in Unicode. ```APIDOC ## LOW_SURROGATE_START #define LOW_SURROGATE_START 0xDC00 ``` -------------------------------- ### Initialization Source: https://docs.pythonmonkey.io/pythonmonkey_8hh_source.html Provides the initialization function for the pythonmonkey module. This function starts the JSContext, creates the global object, and sets up the necessary environment for PythonMonkey operations. ```APIDOC ## PyInit_pythonmonkey ### Description Initialization function for the module. Starts the JSContext, creates the global object, and performs other necessary setup. ### Signature PyMODINIT_FUNC PyInit_pythonmonkey(void); ### Definition `pythonmonkey.cc:558` ``` -------------------------------- ### Functions starting with 'e' Source: https://docs.pythonmonkey.io/functions_func_e.html This section lists functions that start with the letter 'e'. ```APIDOC ## Functions ### - e - * empty() : JobQueue * enqueue() : PyEventLoop * enqueuePromiseJob() : JobQueue * enqueueWithDelay() : PyEventLoop * ensureFuture() : PyEventLoop * enumerate() : PyDictProxyHandler, PyObjectProxyHandler ``` -------------------------------- ### open(method, url, async, username, password) Source: https://docs.pythonmonkey.io/classXMLHttpRequest.html Initializes a request. Must be called before any network activity is initiated. ```APIDOC ## open(method, url, async, username, password) ### Description Initializes a request. Must be called before any network activity is initiated. ### Method XMLHttpRequest::open ### Parameters #### Path Parameters - **method** (string) - Required - The HTTP method to use (e.g., 'GET', 'POST'). - **url** (string) - Required - The URL to send the request to. - **async** (boolean) - Optional - Defaults to `true`. Whether the request should be asynchronous. - **username** (string) - Optional - Defaults to `null`. Username for authentication. - **password** (string) - Optional - Defaults to `null`. Password for authentication. ``` -------------------------------- ### init() Source: https://docs.pythonmonkey.io/functions_i.html Initializes a JobQueue. ```APIDOC ## init() ### Description Initializes the JobQueue, preparing it for operation. ### Class JobQueue ``` -------------------------------- ### Functions starting with 'd' Source: https://docs.pythonmonkey.io/functions_func_d.html This section details functions that start with the letter 'd', along with their associated classes. ```APIDOC ## Functions starting with 'd' ### Description Lists functions that start with the letter 'd' and the classes they belong to. ### Functions - decCounter() : PyEventLoop::Lock - defineProperty() : PyDictProxyHandler, PyListProxyHandler, PyObjectProxyHandler - delete_() : PyDictProxyHandler, PyListProxyHandler, PyObjectProxyHandler - dispatchEvent() : EventTarget, XMLHttpRequest ``` -------------------------------- ### main() Source: https://docs.pythonmonkey.io/namespacemembers_func.html Entry point for the main program execution. ```APIDOC ## main() ### Description Entry point for the main program execution. ### Method N/A (Function) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ### Associated Namespace pythonmonkey.cli.pmjs ``` -------------------------------- ### Functions starting with 'c' Source: https://docs.pythonmonkey.io/functions_func_c.html This section details functions that start with the letter 'c'. Each function is listed with the class it is associated with. ```APIDOC ## Functions starting with 'c' ### Description Lists functions that start with the letter 'c' and the classes they belong to. ### Functions - **cancel()** : PyEventLoop::AsyncHandle - **cancelAll()** : PyEventLoop::AsyncHandle - **cancelled()** : PyEventLoop::AsyncHandle - **close()** : Timeout - **Console()** : Console - **constructor()** : Console, Event, ProgressEvent, Timeout - **createFuture()** : PyEventLoop ``` -------------------------------- ### HIGH_SURROGATE_START Source: https://docs.pythonmonkey.io/jsTypeFactory_8cc.html Macro defining the start of the high surrogate range in Unicode. ```APIDOC ## HIGH_SURROGATE_START #define HIGH_SURROGATE_START 0xD800 ``` -------------------------------- ### Define High Surrogate Start Source: https://docs.pythonmonkey.io/StrType_8cc.html Defines the minimum value for a high surrogate code point in UTF-16. ```c #define HIGH_SURROGATE_START 0xD800 ``` -------------------------------- ### __init__ Source: https://docs.pythonmonkey.io/classpythonmonkey_1_1pythonmonkey_1_1JSStringProxy.html Initializes a new instance of the JSStringProxy class. This constructor does not take any arguments. ```APIDOC ## __init__() ### Description Initializes a new instance of the JSStringProxy class. ### Method __init__ ### Parameters None ### Request Example ```python proxy = JSStringProxy() ``` ### Response Initializes the JSStringProxy object. ``` -------------------------------- ### JSStringProxy.__init__ Source: https://docs.pythonmonkey.io/classpythonmonkey_1_1pythonmonkey_1_1JSStringProxy-members.html Initializes a new instance of the JSStringProxy class. ```APIDOC ## JSStringProxy.__init__(self) ### Description Initializes a new instance of the JSStringProxy class. ### Method __init__ ### Parameters * **self** (JSStringProxy) - The instance of the JSStringProxy class. ``` -------------------------------- ### Class Members starting with 'l' Source: https://docs.pythonmonkey.io/functions_l.html Lists class members whose names start with 'l', along with their respective classes or types. ```APIDOC ## Class Members - l ### Description Provides a list of class members starting with the letter 'l'. ### Members - **lineno** : pythonmonkey.pythonmonkey.EvalOptions - **list** : JSArrayProxy - **LOADING** : XMLHttpRequest - **Lock()** : PyEventLoop::Lock ``` -------------------------------- ### main() Source: https://docs.pythonmonkey.io/namespacepythonmonkey_1_1cli_1_1pmjs.html The main program entry point for the PythonMonkey CLI pmjs module. ```APIDOC ## main() ### Description Main program entry point. ### Signature `main()` ``` -------------------------------- ### CommonJS JavaScript Module Example Source: https://docs.pythonmonkey.io/index.html An example of a CommonJS module written in JavaScript (`date-lib.js`). It exports the current date formatted as YYYY-MM-DD. ```javascript // date-lib.js - require("./date-lib") const d = new Date(); exports.today = `${d.getFullYear()}-${String(d.getMonth()).padStart(2,'0')}-${String(d.getDay()).padStart(2,'0')}` ``` -------------------------------- ### JSArrayProxy.__init__ Source: https://docs.pythonmonkey.io/classpythonmonkey_1_1pythonmonkey_1_1JSArrayProxy-members.html Initializes a new instance of the JSArrayProxy class. ```APIDOC ## JSArrayProxy.__init__ ### Description Initializes a new instance of the JSArrayProxy class. ### Method __init__ ### Parameters - **self** (pythonmonkey.pythonmonkey.JSArrayProxy) - The instance of the JSArrayProxy class. ### Request Example ```python # Example usage (conceptual) js_array_proxy = JSArrayProxy() ``` ### Response #### Success Response (None) This method does not return a value. ``` -------------------------------- ### Class Members - Functions starting with 't' Source: https://docs.pythonmonkey.io/functions_t.html This section details functions that start with the letter 't' and are members of classes within the PythonMonkey library. ```APIDOC ## Functions starting with 't' ### Description Details for functions whose names begin with the letter 't'. ### Members - **target** : Event - **timeout** : XMLHttpRequest - **timeStamp** : Event - **toJsBigInt()** : IntType - **toJsDate()** : DateType - **toJsError()** : ExceptionType - **toJsPromise()** : PromiseType - **toJsTypedArray()** : BufferType - **type** : Event ``` -------------------------------- ### Console Constructor Source: https://docs.pythonmonkey.io/classConsole-members.html Initializes a new instance of the Console class. ```APIDOC ## Console() ### Description Initializes a new instance of the Console class. ### Method constructor ### Parameters #### Path Parameters - **stdout** (any) - Required - Description - **stderr** (any) - Required - Description - **ignoreErrors** (any) - Required - Description ``` -------------------------------- ### JSObjectProxy.__init__ Source: https://docs.pythonmonkey.io/classpythonmonkey_1_1pythonmonkey_1_1JSObjectProxy-members.html Initializes a new instance of the JSObjectProxy class. ```APIDOC ## JSObjectProxy.__init__ ### Description Initializes a new instance of the JSObjectProxy class. ### Method __init__ ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### CommonJS Python Module Example Source: https://docs.pythonmonkey.io/index.html An example of a CommonJS module written in Python (`date-lib.py`). It imports Python's `date` and exports today's date. ```python # date-lib.py - require("./date-lib") from datetime import date # You can use Python libraries. exports['today'] = date.today() ``` -------------------------------- ### C++ Class Definitions for Doxygen Graph Example Source: https://docs.pythonmonkey.io/graph_legend.html These C++ class definitions are used to generate an example inheritance graph in Doxygen. They demonstrate various inheritance types and template usage. ```cpp /*! Invisible class because of truncation */ class Invisible { }; ``` ```cpp /*! Truncated class, inheritance relation is hidden */ class Truncated : public Invisible { }; ``` ```cpp /* Class not documented with doxygen comments */ class Undocumented { }; ``` ```cpp /*! Class that is inherited using public inheritance */ class PublicBase : public Truncated { }; ``` ```cpp /*! A template class */ template class Templ { }; ``` ```cpp /*! Class that is inherited using protected inheritance */ class ProtectedBase { }; ``` ```cpp /*! Class that is inherited using private inheritance */ class PrivateBase { }; ``` ```cpp /*! Class that is used by the Inherited class */ class Used { }; ``` ```cpp /*! Super class that inherits a number of other classes */ class Inherited : public PublicBase, protected ProtectedBase, private PrivateBase, public Undocumented, public Templ { private: Used *m_usedClass; }; ``` -------------------------------- ### File Members - Macros Source: https://docs.pythonmonkey.io/functions_a.html Lists macros available within files, categorized by their starting letter. ```APIDOC ## File Members - Macros ### Description Lists macros available within files, categorized by their starting letter. ### Macros * b * c * h * i * j * k * l * n * p * s ``` -------------------------------- ### JSArrayIterProxy.__init__ Source: https://docs.pythonmonkey.io/classpythonmonkey_1_1pythonmonkey_1_1JSArrayIterProxy-members.html Initializes a new instance of the JSArrayIterProxy class. ```APIDOC ## __init__(self) ### Description Initializes the JSArrayIterProxy object. ### Method __init__ ### Parameters * **self** (JSArrayIterProxy) - The instance of the class. ### Response #### Success Response (None) This method does not return a value. ``` -------------------------------- ### responseURL Source: https://docs.pythonmonkey.io/classXMLHttpRequest.html Gets the URL of the response. ```APIDOC ## responseURL ### Description Returns the URL of the response. ### Method get XMLHttpRequest::responseURL ``` -------------------------------- ### Console Constructor with Streams Source: https://docs.pythonmonkey.io/classConsole.html Initializes a new Console instance with specified output streams and error handling. ```APIDOC ## constructor(stdout, stderr, ignoreErrors) ### Description Initializes a new Console instance. ### Parameters - **stdout** (stream) - The stream to write standard output to. - **stderr** (stream) - The stream to write standard error to. - **ignoreErrors** (boolean) - Whether to ignore errors during output. ### Constructor `Console(stdout, stderr, ignoreErrors)` ``` -------------------------------- ### response Source: https://docs.pythonmonkey.io/classXMLHttpRequest.html Gets the response body. ```APIDOC ## response ### Description Returns the response body. ### Method get XMLHttpRequest::response ``` -------------------------------- ### status Source: https://docs.pythonmonkey.io/classXMLHttpRequest-members.html Gets the status of the request. ```APIDOC ## status ### Description Gets the status of the request. ### Method `status()` ### Response #### Success Response (200) - **status** (number) - The HTTP status code of the response. ``` -------------------------------- ### Initialize Global REPL Libraries Source: https://docs.pythonmonkey.io/global-init_8js.html Initializes global utility and event libraries for the REPL environment. It also requires 'core-js' for DOMException. ```javascript exports.initReplLibs = function pmjs$$initReplLibs() { globalThis.util = require('util'); globalThis.events = require('events'); } require('core-js/actual/dom-exception') ``` -------------------------------- ### File Members - Functions Source: https://docs.pythonmonkey.io/functions_a.html Lists functions available within files, categorized by their starting letter. ```APIDOC ## File Members - Functions ### Description Lists functions available within files, categorized by their starting letter. ### Functions * _ * a * c * d * f * g * i * j * k * n * o * p * r * s * t * u ``` -------------------------------- ### url Source: https://docs.pythonmonkey.io/classXMLHttpRequest-internal_1_1XHRResponse-members.html Gets the URL of the request. ```APIDOC ## url ### Description Gets the URL of the request. ### Method static ### Endpoint N/A (Class method) ### Parameters None ### Response - **url** (string) - The URL that was requested. ``` -------------------------------- ### usage() Source: https://docs.pythonmonkey.io/namespacemembers_func.html Displays usage information for the command-line tool. ```APIDOC ## usage() ### Description Displays usage information for the command-line tool. ### Method N/A (Function) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ### Associated Namespace pythonmonkey.cli.pmjs ``` -------------------------------- ### PythonMonkey Module Initialization Source: https://docs.pythonmonkey.io/pythonmonkey_8hh_source.html Defines the initialization function for the pythonmonkey module. This function starts the JSContext and creates the global object. ```c #ifndef PythonMonkey_Module_PythonMonkey #define PythonMonkey_Module_PythonMonkey #include "include/JobQueue.hh" #include #include #include #include extern JSContext *GLOBAL_CX; extern JS::PersistentRootedObject jsFunctionRegistry; static JS::Rooted *global; static JSAutoRealm *autoRealm; static JobQueue *JOB_QUEUE; // Get handle on global object PyObject *getPythonMonkeyNull(); PyObject *getPythonMonkeyBigInt(); static void cleanup(); static PyObject *collect(PyObject *self, PyObject *args); static PyObject *eval(PyObject *self, PyObject *args); PyMODINIT_FUNC PyInit_pythonmonkey(void); extern PyMethodDef PythonMonkeyMethods[]; extern struct PyModuleDef pythonmonkey; extern PyObject * SpiderMonkeyError; #endif ``` -------------------------------- ### q Source: https://docs.pythonmonkey.io/functions_func_q.html Functions starting with the letter 'q'. ```APIDOC ## queueFinalizationRegistryCallback() ### Description This function is related to job queue finalization callbacks. ### Method N/A (Function Signature) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ### Related Class JobQueue ``` -------------------------------- ### Run JavaScript Program with pmjs Source: https://docs.pythonmonkey.io/index.html Demonstrates executing a simple JavaScript file (`my-program.js`) using the `pmjs` shell. The output 'hello world' is printed to the console. ```bash $ echo "console.log('hello world')" > my-program.js $ pmjs my-program.js ``` -------------------------------- ### JSMethodProxy.__init__ Source: https://docs.pythonmonkey.io/classpythonmonkey_1_1pythonmonkey_1_1JSMethodProxy-members.html Initializes a JSMethodProxy object. This is the constructor for the class. ```APIDOC ## JSMethodProxy.__init__(self) ### Description Initializes a JSMethodProxy object. ### Method __init__ ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### responseType Source: https://docs.pythonmonkey.io/classXMLHttpRequest.html Gets or sets the response type. ```APIDOC ## responseType ### Description Gets or sets the response type. ### Method get XMLHttpRequest::responseType set XMLHttpRequest::responseType ``` -------------------------------- ### on() Source: https://docs.pythonmonkey.io/globals_func.html Attaches an event listener. Found in global-init.js. ```APIDOC ## on() ### Description Attaches an event listener. ### Method N/A (Global Function) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ### Associated File global-init.js ``` -------------------------------- ### responseLength Source: https://docs.pythonmonkey.io/classXMLHttpRequest-members.html Gets the length of the response body. ```APIDOC ## responseLength ### Description Gets the length of the response body. ### Method `responseLength()` ### Response #### Success Response (200) - **responseLength** (number) - The length of the response body in bytes. ``` -------------------------------- ### Require EventTarget and Event Source: https://docs.pythonmonkey.io/XMLHttpRequest_8js.html Imports EventTarget and Event from the 'event-target' module. This is a common setup for event-driven programming. ```javascript const { EventTarget, Event } = require('event-target') ``` -------------------------------- ### responseType Source: https://docs.pythonmonkey.io/classXMLHttpRequest-members.html Gets or sets the type of the response. ```APIDOC ## responseType ### Description Gets or sets the type of the response. ### Method `responseType()` `responseType(t)` ### Parameters - **t** (string) - Optional - The type of the response (e.g., 'text', 'json', 'blob', 'arraybuffer'). ``` -------------------------------- ### responseText Source: https://docs.pythonmonkey.io/classXMLHttpRequest-members.html Gets the response body as a string. ```APIDOC ## responseText ### Description Gets the response body as a string. ### Method `responseText()` ### Response #### Success Response (200) - **responseText** (string) - The response body as a string. ``` -------------------------------- ### Open XMLHttpRequest Source: https://docs.pythonmonkey.io/classXMLHttpRequest.html Initializes a request. Use this before calling send(). ```javascript open (method, url, async=true, username=null, password=null) ``` -------------------------------- ### statusText Source: https://docs.pythonmonkey.io/classXMLHttpRequest-members.html Gets the status text of the request. ```APIDOC ## statusText ### Description Gets the status text of the request. ### Method `statusText()` ### Response #### Success Response (200) - **statusText** (string) - The HTTP status text of the response. ``` -------------------------------- ### pythonmonkey.cli.pmjs.main Source: https://docs.pythonmonkey.io/pmjs_8py.html The main entry point for the pmjs command-line interface. ```APIDOC ## pythonmonkey.cli.pmjs.main () ### Description The main entry point for the pmjs command-line interface. ### Method python ### Endpoint N/A ### Parameters None ### Request Example None ### Response None ``` -------------------------------- ### contentLength Source: https://docs.pythonmonkey.io/classXMLHttpRequest-internal_1_1XHRResponse-members.html Gets the content length of the response. ```APIDOC ## contentLength ### Description Gets the content length of the response. ### Method static ### Endpoint N/A (Class method) ### Parameters None ### Response - **contentLength** (number) - The length of the response content. ``` -------------------------------- ### Build PythonMonkey Wheel Package Source: https://docs.pythonmonkey.io/index.html Commands to build a wheel package for PythonMonkey from a local version. This involves navigating to the `pminit` directory, building the source distribution, and then building the wheel. ```bash cd python/pminit && poetry build --format=sdist && cd - && mv -v python/pminit/dist/* ./dist/ ``` ```bash poetry build --format=wheel ``` -------------------------------- ### new Source: https://docs.pythonmonkey.io/pythonmonkey_8pyi.html Creates a new JavaScript object using a provided constructor function. ```APIDOC ## new ### Description Creates a new JavaScript object using a provided constructor function. ### Method pythonmonkey.pythonmonkey.new ### Parameters #### Arguments - **ctor** (JSFunctionProxy) - The JavaScript constructor function to use. ### Returns - _typing.Callable[..., _typing.Any] - A callable that can be used to instantiate the JavaScript object. ``` -------------------------------- ### Namespace Members - i Source: https://docs.pythonmonkey.io/namespacemembers.html Members starting with 'i' in the PythonMonkey namespace. ```APIDOC ## i ### Description Members starting with 'i'. ### Members - **initCtxModule** : pythonmonkey.require - **initGlobalThis()** : pythonmonkey.cli.pmjs - **inspect** : pythonmonkey.require - **internalBinding()** : pythonmonkey.pythonmonkey - **isCompilableUnit()** : pythonmonkey.pythonmonkey, pythonmonkey.require ``` -------------------------------- ### usage() Source: https://docs.pythonmonkey.io/namespacepythonmonkey_1_1cli_1_1pmjs.html Displays usage information for the PythonMonkey CLI pmjs module. ```APIDOC ## usage() ### Description Displays usage information. ### Signature `usage()` ``` -------------------------------- ### Namespace Members - a Source: https://docs.pythonmonkey.io/namespacemembers.html Members starting with 'a' in the PythonMonkey namespace. ```APIDOC ## a ### Description Members starting with 'a'. ### Members - **atob()** : base64 ``` -------------------------------- ### Namespace Variables (i) Source: https://docs.pythonmonkey.io/namespacemembers_vars.html Variables starting with 'i' in the PythonMonkey namespace. ```APIDOC ## Namespace Variables (i) ### Description Variables starting with 'i' in the PythonMonkey namespace. ### Variables - **initCtxModule** (pythonmonkey.require) - **inspect** (pythonmonkey.require) - **isCompilableUnit** (pythonmonkey.require) ``` -------------------------------- ### getHandleObject() Source: https://docs.pythonmonkey.io/structPyEventLoop_1_1AsyncHandle.html Gets the underlying `asyncio.Handle` Python object. ```APIDOC ## ◆ getHandleObject() PyObject * PyEventLoop::AsyncHandle::getHandleObject | ( | | ) | const ---|---|---|---|--- Get the underlying `asyncio.Handle` Python object. ``` -------------------------------- ### load() Source: https://docs.pythonmonkey.io/namespacemembers_func.html Loads a module or script. ```APIDOC ## load() ### Description Loads a module or script. ### Method N/A (Function) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ### Associated Namespace pythonmonkey.require ``` -------------------------------- ### getAllTimers() Source: https://docs.pythonmonkey.io/structPyEventLoop_1_1AsyncHandle.html Gets an iterator for all active AsyncHandles (timers). ```APIDOC ## ◆ getAllTimers() | static auto & PyEventLoop::AsyncHandle::getAllTimers | ( | | ) | ---|---|---|---|--- static Get an iterator for the `AsyncHandle`s of all timers. ``` -------------------------------- ### WTF Context Manager Usage Source: https://docs.pythonmonkey.io/classwtfpm_1_1WTF.html Demonstrates how to use the WTF class as a context manager with the `with` statement to manage the PythonMonkey event loop. ```APIDOC ## WTF Class ### Description `WTFPythonMonkey` is designed to be used as a Python context manager, enabling the use of the `with`-statement for managing the PythonMonkey event loop. ### Usage Example ```python from pythonmonkey.lib.wtfpm import WTF import asyncio async def pythonmonkey_main(): # Your main program logic here pass with WTF(): # The main entry point for the program utilizes PythonMonkey event-loop asyncio.run(pythonmonkey_main()) ``` ### Member Functions #### `__enter__(self)` This method is called when entering the `with` block. It initializes the context. #### `__exit__(self, errType, errValue, traceback)` This method is called when exiting the `with` block. It handles any exceptions that occurred within the block. ``` -------------------------------- ### statusText() Source: https://docs.pythonmonkey.io/classXMLHttpRequest.html Gets the HTTP status text of the XMLHttpRequest. ```APIDOC ## statusText() ### Description Gets the HTTP status text of the XMLHttpRequest. ### Returns - {string} HTTP status message ``` -------------------------------- ### status() Source: https://docs.pythonmonkey.io/classXMLHttpRequest.html Gets the HTTP status code of the XMLHttpRequest. ```APIDOC ## status() ### Description Gets the HTTP status code of the XMLHttpRequest. ### Returns - {number} HTTP status code ``` -------------------------------- ### pythonmonkey.helpers.new Source: https://docs.pythonmonkey.io/helpers_8py.html Creates a new instance of a JavaScript constructor. ```APIDOC ## pythonmonkey.helpers.new ### Description Creates a new instance of a JavaScript constructor. ### Parameters #### Path Parameters - **ctor** (any) - Required - The JavaScript constructor to instantiate. ``` -------------------------------- ### responseURL Source: https://docs.pythonmonkey.io/classXMLHttpRequest-members.html Gets the final URL of the request, after any redirects. ```APIDOC ## responseURL ### Description Gets the final URL of the request, after any redirects. ### Method `responseURL()` ### Response #### Success Response (200) - **responseURL** (string) - The final URL of the request. ``` -------------------------------- ### initReplLibs Source: https://docs.pythonmonkey.io/global-init_8js.html Initializes essential Node.js core modules like 'util' and 'events' into the global scope, making them available for use within the REPL or script execution. ```APIDOC ## initReplLibs exports initReplLibs --- **Initial value:** = function pmjs$$initReplLibs() { globalThis.util = require('util'); globalThis.events = require('events'); } require require('core-js/actual/dom-exception') ``` -------------------------------- ### responseXML Source: https://docs.pythonmonkey.io/classXMLHttpRequest-members.html Gets the response body as an XML Document. ```APIDOC ## responseXML ### Description Gets the response body as an XML Document. ### Method `responseXML()` ### Response #### Success Response (200) - **responseXML** (Document) - The response body as an XML Document. ``` -------------------------------- ### Using WTF as a Context Manager Source: https://docs.pythonmonkey.io/classwtfpm_1_1WTF.html Demonstrates how to use the WTF class as a context manager for the PythonMonkey event loop. Ensure `asyncio` and `pythonmonkey_main` are available in your scope. ```python from pythonmonkey.lib.wtfpm import WTF with WTF(): # the main entry point for the program utilizes PythonMonkey event-loop asyncio.run(pythonmonkey_main()) ``` -------------------------------- ### timeout Source: https://docs.pythonmonkey.io/classXMLHttpRequest-members.html Gets or sets the timeout in milliseconds for the request. ```APIDOC ## timeout ### Description Gets or sets the timeout in milliseconds for the request. ### Property `timeout` (number) ``` -------------------------------- ### PyBytesProxyHandler Constructor Source: https://docs.pythonmonkey.io/PyBytesProxyHandler_8hh_source.html Constructor for PyBytesProxyHandler, initializing the base class with the family. ```cpp PyBytesProxyHandler() : PyObjectProxyHandler(&family) {}; ``` -------------------------------- ### statusText Source: https://docs.pythonmonkey.io/classXMLHttpRequest-internal_1_1XHRResponse-members.html Gets the HTTP status text of the response. ```APIDOC ## statusText ### Description Gets the HTTP status text of the response. ### Method static ### Endpoint N/A (Class method) ### Parameters None ### Response - **statusText** (string) - The HTTP status text. ``` -------------------------------- ### runProgramModule() Source: https://docs.pythonmonkey.io/namespacepythonmonkey_1_1require.html Runs a program module by loading it from disk, setting up its execution environment, and invoking it. Program modules have specific characteristics, such as not being able to return and having a global scope. ```APIDOC ## runProgramModule() ### Description Runs the program module. This loads the code from disk, sets up the execution environment, and then invokes the program module (aka main module). ### Parameters * `_filename_` (str) - The path to the program module file. * `_argv_` (list) - Command-line arguments to pass to the program module. * `_extraPaths_` (list, optional) - Additional paths to search for modules. Defaults to `[]`. ### Notes The program module is different from other modules in that: 1. it cannot return (must throw) 2. the outermost block scope is the global scope, effectively making its scope a super-global to other modules. ``` -------------------------------- ### status Source: https://docs.pythonmonkey.io/classXMLHttpRequest-internal_1_1XHRResponse-members.html Gets the HTTP status code of the response. ```APIDOC ## status ### Description Gets the HTTP status code of the response. ### Method static ### Endpoint N/A (Class method) ### Parameters None ### Response - **status** (number) - The HTTP status code. ``` -------------------------------- ### pythonmonkey.cli.pmjs.initGlobalThis Source: https://docs.pythonmonkey.io/pmjs_8py.html Initializes the globalThis object within the JavaScript environment. ```APIDOC ## pythonmonkey.cli.pmjs.initGlobalThis () ### Description Initializes the globalThis object within the JavaScript environment. ### Method python ### Endpoint N/A ### Parameters None ### Request Example None ### Response None ``` -------------------------------- ### Namespace Members - m Source: https://docs.pythonmonkey.io/namespacemembers.html Members starting with 'm' in the PythonMonkey namespace. ```APIDOC ## m ### Description Members starting with 'm'. ### Members - **main()** : pythonmonkey.cli.pmjs ``` -------------------------------- ### JobQueue::init() Source: https://docs.pythonmonkey.io/classJobQueue.html Initializes the PythonMonkey event-loop job queue. This must be called before using other JobQueue functions. ```APIDOC ## init() ### Description Initialize PythonMonkey's event-loop job queue. ### Method `bool JobQueue::init(JSContext * _cx)` ### Parameters - `_cx` (JSContext *): Pointer to the JavaScript context. ### Returns - `true` on success. ``` -------------------------------- ### Namespace Members - d Source: https://docs.pythonmonkey.io/namespacemembers.html Members starting with 'd' in the PythonMonkey namespace. ```APIDOC ## d ### Description Members starting with 'd'. ### Members - **debuggerInput()** : pmdb - **decodeStr()** : XMLHttpRequest-internal - **dir** : pythonmonkey.require ``` -------------------------------- ### require() Source: https://docs.pythonmonkey.io/namespacemembers_func.html Imports a module. ```APIDOC ## require() ### Description Imports a module. ### Method N/A (Function) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ### Associated Namespace pythonmonkey.pythonmonkey, pythonmonkey.require ``` -------------------------------- ### Namespace Variables (t) Source: https://docs.pythonmonkey.io/namespacemembers_vars.html Variables starting with 't' in the PythonMonkey namespace. ```APIDOC ## Namespace Variables (t) ### Description Variables starting with 't' in the PythonMonkey namespace. ### Variables - **timers** (InternalBinding) ``` -------------------------------- ### Namespace Variables (s) Source: https://docs.pythonmonkey.io/namespacemembers_vars.html Variables starting with 's' in the PythonMonkey namespace. ```APIDOC ## Namespace Variables (s) ### Description Variables starting with 's' in the PythonMonkey namespace. ### Variables - **statSync_inner** (pythonmonkey.require) ``` -------------------------------- ### pythonmonkey.cli.pmjs.usage Source: https://docs.pythonmonkey.io/pmjs_8py.html Displays the usage information for the pmjs command-line tool. ```APIDOC ## pythonmonkey.cli.pmjs.usage () ### Description Displays the usage information for the pmjs command-line tool. ### Method python ### Endpoint N/A ### Parameters None ### Request Example None ### Response None ``` -------------------------------- ### PyInit_pythonmonkey Source: https://docs.pythonmonkey.io/pythonmonkey_8cc.html Initialization function for the pythonmonkey module. ```APIDOC ## PyInit_pythonmonkey() ### Description Initialization function for the pythonmonkey module. This function starts the JSContext, creates the global object, and sets up necessary cleanup functions. ### Returns PyObject* - The module object to be passed to the Python user. ``` -------------------------------- ### Namespace Variables (d) Source: https://docs.pythonmonkey.io/namespacemembers_vars.html Variables starting with 'd' in the PythonMonkey namespace. ```APIDOC ## Namespace Variables (d) ### Description Variables starting with 'd' in the PythonMonkey namespace. ### Variables - **dir** (pythonmonkey.require) ``` -------------------------------- ### pythonmonkey.require.load Source: https://docs.pythonmonkey.io/require_8py.html Loads a module from a file path. ```APIDOC ## pythonmonkey.require.load ### Description Loads a module from a file path. ### Signature Dict | pythonmonkey.require.load (str filename) ``` -------------------------------- ### get() Source: https://docs.pythonmonkey.io/classXMLHttpRequest.html Retrieves the total length of received bytes for the XMLHttpRequest. ```APIDOC ## get() ### Description Gets the total length of received bytes for the XMLHttpRequest by summing the lengths of all received chunks. ### Returns - {number} The total length of received bytes. ``` -------------------------------- ### requestBodyLength Source: https://docs.pythonmonkey.io/classXMLHttpRequest-members.html Gets the total length of the request body in bytes. ```APIDOC ## requestBodyLength ### Description Gets the total length of the request body in bytes. ### Method `requestBodyLength()` ### Response #### Success Response (200) - **requestBodyLength** (number) - The total length of the request body. ``` -------------------------------- ### response Source: https://docs.pythonmonkey.io/classXMLHttpRequest-members.html Gets the response body in the format specified by responseType. ```APIDOC ## response ### Description Gets the response body in the format specified by responseType. ### Method `response()` ### Response #### Success Response (200) - **response** (any) - The response body in the format specified by responseType. ``` -------------------------------- ### for() Source: https://docs.pythonmonkey.io/globals_func.html Iterates over elements. Found in global-init.js. ```APIDOC ## for() ### Description Iterates over elements. ### Method N/A (Global Function) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ### Associated File global-init.js ``` -------------------------------- ### Build Project with Debug Symbols Source: https://docs.pythonmonkey.io/index.html Builds the project with debug symbols enabled using Poetry. This is useful for debugging purposes. ```bash BUILD_TYPE=Debug poetry install ``` -------------------------------- ### Namespace Members - p Source: https://docs.pythonmonkey.io/namespacemembers.html Members starting with 'p' in the PythonMonkey namespace. ```APIDOC ## p ### Description Members starting with 'p'. ### Members - **paths** : pythonmonkey.require - **pmEval** : pythonmonkey.require - **pmGlobals** : pythonmonkey.helpers - **print** : pythonmonkey.require - **printTimersDebugInfo()** : wtfpm ``` -------------------------------- ### new() Source: https://docs.pythonmonkey.io/namespacemembers_func.html Creates a new instance of an object or class. ```APIDOC ## new() ### Description Creates a new instance of an object or class. ### Method N/A (Function) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ### Associated Namespace pythonmonkey.helpers, pythonmonkey.pythonmonkey ``` -------------------------------- ### Namespace Members - n Source: https://docs.pythonmonkey.io/namespacemembers.html Members starting with 'n' in the PythonMonkey namespace. ```APIDOC ## n ### Description Members starting with 'n'. ### Members - **name** : pythonmonkey.helpers - **new()** : pythonmonkey.helpers, pythonmonkey.pythonmonkey - **node_modules** : pythonmonkey.require - **nodeModules** : pythonmonkey.require - **null** : pythonmonkey.pythonmonkey ``` -------------------------------- ### Namespace Members - l Source: https://docs.pythonmonkey.io/namespacemembers.html Members starting with 'l' in the PythonMonkey namespace. ```APIDOC ## l ### Description Members starting with 'l'. ### Members - **load** : pythonmonkey.require ``` -------------------------------- ### pythonmonkey.require.runProgramModule Source: https://docs.pythonmonkey.io/require_8py.html Runs a module as a program. ```APIDOC ## pythonmonkey.require.runProgramModule ### Description Runs a module as a program. ### Signature | pythonmonkey.require.runProgramModule (filename, argv, extraPaths=[]) ``` -------------------------------- ### Namespace Members - k Source: https://docs.pythonmonkey.io/namespacemembers.html Members starting with 'k' in the PythonMonkey namespace. ```APIDOC ## k ### Description Members starting with 'k'. ### Members - **keepAliveConnector** : XMLHttpRequest-internal ``` -------------------------------- ### require() Source: https://docs.pythonmonkey.io/namespacepythonmonkey_1_1require.html Loads a module identified by its module identifier. ```APIDOC ## require() ### Description Loads a module specified by the module identifier. ### Parameters * `_moduleIdentifier_` (str) - The identifier of the module to load. ### Returns * The loaded module. ``` -------------------------------- ### Static Public Member Functions Source: https://docs.pythonmonkey.io/structPyObjectProxyHandler.html Static helper functions for PyObjectProxyHandler. ```APIDOC ## static bool handleOwnPropertyKeys(JSContext *cx, PyObject *keys, size_t length, JS::MutableHandleIdVector props) ### Description Helper function used by dicts and objects for ownPropertyKeys. ### Parameters - **cx** (JSContext *) - The JavaScript context. - **keys** (PyObject *) - The Python object containing keys. - **length** (size_t) - The number of keys. - **props** (JS::MutableHandleIdVector) - A mutable vector to store the property keys. ## static bool handleGetOwnPropertyDescriptor(JSContext *cx, JS::HandleId id, JS::MutableHandle< mozilla::Maybe< JS::PropertyDescriptor > > desc, PyObject *item) ### Description Helper function used by dicts and objects for get OwnPropertyDescriptor. ### Parameters - **cx** (JSContext *) - The JavaScript context. - **id** (JS::HandleId) - The identifier of the property. - **desc** (JS::MutableHandle< mozilla::Maybe< JS::PropertyDescriptor > >) - A mutable handle to store the property descriptor. - **item** (PyObject *) - The Python object item. ## static bool object_toString(JSContext *cx, unsigned argc, JS::Value *vp) ### Description Helper function used by dicts and objects to convert dict/object to String. ### Parameters - **cx** (JSContext *) - The JavaScript context. - **argc** (unsigned) - The number of arguments. - **vp** (JS::Value *) - The array of JavaScript values. ## static bool object_toLocaleString(JSContext *cx, unsigned argc, JS::Value *vp) ### Description Helper function used by dicts and objects to convert dict/object to LocaleString. ### Parameters - **cx** (JSContext *) - The JavaScript context. - **argc** (unsigned) - The number of arguments. - **vp** (JS::Value *) - The array of JavaScript values. ## static bool object_valueOf(JSContext *cx, unsigned argc, JS::Value *vp) ### Description Helper function used by dicts and objects to get valueOf, just returns a new reference to `self`. ### Parameters - **cx** (JSContext *) - The JavaScript context. - **argc** (unsigned) - The number of arguments. - **vp** (JS::Value *) - The array of JavaScript values. ``` -------------------------------- ### Namespace Members - g Source: https://docs.pythonmonkey.io/namespacemembers.html Members starting with 'g' in the PythonMonkey namespace. ```APIDOC ## g ### Description Members starting with 'g'. ### Members - **getenv** : pythonmonkey.require - **globalThis** : pythonmonkey.cli.pmjs, pythonmonkey.helpers, pythonmonkey.pythonmonkey, pythonmonkey.require ``` -------------------------------- ### runProgramModule(filename, argv, extraPaths) Source: https://docs.pythonmonkey.io/index.html Loads and evaluates a JavaScript program (main) module. Use this when the main entry point of your program is written in JavaScript. ```APIDOC ## runProgramModule(filename, argv, extraPaths) ### Description Load and evaluate a program (main) module. Program modules must be written in JavaScript. Program modules are not necessary unless the main entry point of your program is written in JavaScript. ### Parameters #### Path Parameters - **filename** (string) - The location of the JavaScript source code. - **argv** (list of strings) - The program's argument vector. - **extraPaths** (list of strings, optional) - A list of extra paths to search to resolve non-relative and non-absolute module identifiers. ### Caution Care should be taken to ensure that only one program module is run per JS context. ``` -------------------------------- ### Namespace Members - e Source: https://docs.pythonmonkey.io/namespacemembers.html Members starting with 'e' in the PythonMonkey namespace. ```APIDOC ## e ### Description Members starting with 'e'. ### Members - **enable()** : pmdb - **encoding** : pythonmonkey.require - **eval()** : pythonmonkey.pythonmonkey, pythonmonkey.require - **evalOpts** : pythonmonkey.cli.pmjs, pythonmonkey.helpers, pythonmonkey.require - **exec** : pythonmonkey.require - **existsSync** : pythonmonkey.require - **exit** : pythonmonkey.require - **exports** : internal-binding, pythonmonkey.helpers ``` -------------------------------- ### Uninstall PythonMonkey and Dependencies Source: https://docs.pythonmonkey.io/index.html Command to cleanly remove PythonMonkey and its dependency `pminit` from the system. ```bash pip uninstall pythonmonkey pminit ``` -------------------------------- ### Namespace Members - c Source: https://docs.pythonmonkey.io/namespacemembers.html Members starting with 'c' in the PythonMonkey namespace. ```APIDOC ## c ### Description Members starting with 'c'. ### Members - **collect()** : pythonmonkey.pythonmonkey - **createRequire()** : pythonmonkey.require - **createRequireInner** : pythonmonkey.require ``` -------------------------------- ### Namespace Variables (u) Source: https://docs.pythonmonkey.io/namespacemembers_vars.html Variables starting with 'u' in the PythonMonkey namespace. ```APIDOC ## Namespace Variables (u) ### Description Variables starting with 'u' in the PythonMonkey namespace. ### Variables - **utils** (InternalBinding) ``` -------------------------------- ### PyBaseProxyHandler Constructor Source: https://docs.pythonmonkey.io/structPyBaseProxyHandler.html Initializes a PyBaseProxyHandler object. It takes a constant void pointer representing the family. ```APIDOC ## PyBaseProxyHandler() ### Description Constructs a PyBaseProxyHandler. ### Parameters * **family** (const void *) - A pointer to the family identifier. ``` -------------------------------- ### Namespace Variables (r) Source: https://docs.pythonmonkey.io/namespacemembers_vars.html Variables starting with 'r' in the PythonMonkey namespace. ```APIDOC ## Namespace Variables (r) ### Description Variables starting with 'r' in the PythonMonkey namespace. ### Variables - **read** (pythonmonkey.require) - **readFileSync** (pythonmonkey.require) - **requireFromDisk** (pythonmonkey.require) - **requirePath** (pythonmonkey.cli.pmjs) ``` -------------------------------- ### pmdb.enable Source: https://docs.pythonmonkey.io/pmdb_8py.html Enables the debugger. ```APIDOC ## pmdb.enable ### Description Enables the debugger. ### Parameters #### Path Parameters - **debuggerGlobalObject** (object) - Optional - The global object for the debugger. Defaults to `pm.eval("debuggerGlobal")`. ### Request Example ```python pmdb.enable() ``` ### Response #### Success Response (200) - **None** - This function does not return a value. ```