akracer
akracer is a Python library that serves as an extension for py_mini_racer, specifically designed to address dynamic link library (DLL) calling issues on 64-bit ARM operating systems. It facilitates a one-click installation of py_mini_racer by providing pre-compiled dynamic link libraries for environments like Apple M-series chips, Ubuntu (18.04, 20.04, 22.04), and Raspberry Pi 64-bit OS. The current version is 0.0.14. It is actively maintained with a beta development status.
Warnings
- gotcha akracer primarily addresses dynamic library issues for py_mini_racer on 64-bit ARM operating systems. While installing akracer may not hurt on other architectures, its primary benefit is for ARM users. On x86-64, py_mini_racer typically installs and compiles correctly without akracer.
- breaking The project is currently in '4 - Beta' development status according to PyPI. This indicates that the API or stability might not be fully mature and could be subject to breaking changes in future releases.
- gotcha A security analysis by ReversingLabs indicated that the akracer package contains 'risks' and 'known severe vulnerabilities' that are actively being exploited. Users should review the analysis results before use.
Install
-
pip install akracer
Imports
- MiniRacer
from py_mini_racer import MiniRacer
Quickstart
import os
from py_mini_racer import MiniRacer
# Initialize a MiniRacer context
context = MiniRacer()
# Evaluate JavaScript code
result = context.eval("1 + 1")
print(f"Result of '1 + 1': {result}")
# Call a JavaScript function
context.eval("var add = function(a, b) { return a + b; };")
add_result = context.call("add", 5, 3)
print(f"Result of add(5, 3): {add_result}")
# Example using a JavaScript file (simulate loading a file)
js_content = """
var greet = function(name) {
return 'Hello, ' + name + '!';
};
"""
context.eval(js_content)
greet_result = context.call("greet", "World")
print(f"Result of greet('World'): {greet_result}")