PyChakra
PyChakra is a Python binding to Microsoft Chakra(v1.11.16) Javascript engine.
Chakra is a modern JavaScript engine for Microsoft Edge, it support 96% ES6 feature, Complete info see https://kangax.github.io/compat-table/es6/
Installation
pip install PyChakra
Usage
from PyChakra import Runtime
# create runtime instance
runtime = Runtime()
# eval JavaScript code
runtime.eval("(() => 2)();") # (True, 2)
runtime.eval("(() => a)();") # (False, "ReferenceError: 'a' is not defined")
# set or get variable
runtime.set_variable("foo", "'bar'") # True
runtime.get_variable("foo") # 'bar'
API
eval(js_string)
Eval JavaScript code string.
Parameters:
js_string: str: JavaScript code string
Returns: (is_successful: bool, result: any)
is_successfully: indicates whether JavaScript is running successfully.
result:
if s is True, result is the JavaScript running return value.
if is_successfully is False and result is string, result is the JavaScript running exception.
if is_successfully is False and result is number, result is the chakra internal error code. see(github)
set_variable(variable_name: str, variable_value: any)
Set variable in global scope.
Parameters:
variable_name: str: JavaScript variable name.
variable_value: str: JavaScript variable value in Python str.
Returns: same as eval
get_variable(variable_name: str)
Get variable in global scope.
Parameters:
variable_name: str: JavaScript variable name.
Returns: variable_value: str - if returns value is None, it indicates there is no variable_name in the global scope.
Supports
Python2 >= 2.7
Python3 >= 3.4
Platform
macOS x64
Linux x64
Windows x86/x64 (tested on Windows 10 x64, Python 3.7)
Metadata
Release files for PyChakra 2.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| PyChakra-2.3.0.tar.gz | 38.5 MB | Without provenance | Details for PyChakra-2.3.0.tar.gz |
Release files / PyChakra-2.3.0.tar.gz
| Download URL | PyChakra-2.3.0.tar.gz |
|---|---|
| Size | 38.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f1469e361e40672bf8830c8300041267e3809f10afe6d9af2a46e300d0dc68c7
|
|
BLAKE2b-256 checksum How to use checksums |
b858702e626fe0074064637d3fe5cdbbea448b6b9af442b55782966922ca9f75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.3
|
Security for PyChakra 2.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.