myjs
A JavaScript interpreter for Python -- run .js against a DOM, call native C via ffi, reach the Python ecosystem
myjs is a programming research lab tool. It's best for Python developers needing JavaScript execution and Developers requiring headless browser automation without a full browser. Pricing is free.
Pricing
free
Audience
Python developers needing JavaScript execution
Platforms
Community
0%
About myjs
myjs is a JavaScript interpreter for Python that allows running JavaScript files, rendering HTML pages headlessly, scripting the DOM, calling native C through FFI, and accessing the Python ecosystem from JavaScript without Node.js or a browser.
myjs provides a comprehensive JavaScript environment within Python, enabling developers to execute JavaScript code, interact with a full DOM implementation, and integrate with native C libraries. It supports standard web APIs like `fetch`, `WebSocket`, and ES modules, allowing for complex web application logic to be run directly from Python scripts. The interpreter handles asynchronous operations with Promises, `async/await`, `setTimeout`, and `setInterval`, ensuring a complete JavaScript runtime experience.
The tool offers robust headless HTML rendering capabilities, similar to Puppeteer but without the need for a separate browser download. Users can load URLs or local HTML files, apply CSS, execute JavaScript against the rendered page, fill forms, submit them, and wait for specific elements to appear. This makes it suitable for web scraping, automation, and server-side rendering (SSR) of web pages.
Beyond web-centric features, myjs extends JavaScript's reach into the system and Python ecosystem. It includes Node.js-flavored `fs`, `path`, `sh`, `http`, `os`, and `process` modules for file system operations, shell command execution, and HTTP serving. Crucially, it provides a Foreign Function Interface (FFI) to call any C library via `ctypes` and a `py` object to evaluate Python code, import Python modules (like `pandas` or `numpy`), and execute Python scripts directly from JavaScript. This bridges the gap between JavaScript, C, and Python, offering a powerful multi-language scripting environment.
Key Features
Pricing
freemyjs is available for free via pip install from PyPI.
Who is it for?
Best for
- Python projects requiring embedded JavaScript execution
- Headless web scraping and automation tasks
- Server-side rendering of HTML pages with JavaScript
- Projects needing to call native C libraries from JavaScript within a Python environment
- Developers looking to leverage the Python ecosystem from JavaScript
Not ideal for
- Users seeking a full-fledged browser environment for complex UI testing
- Projects that strictly require Node.js-specific module ecosystems
- Beginners unfamiliar with both Python and JavaScript development
Integrations
Community Discussion
No discussions yet. Be the first to share your experience!