JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q34183F
  • License GPL-3.0

🚀 A versatile Node.js library for seamless interaction with Python. Execute Python commands effortlessly and manage Python sessions with ease! ( No Dependencies )

Package Exports

  • py3
  • py3/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (py3) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Py3: Python Interaction Library

Py3 is a versatile Node.js library for interacting with Python, providing a seamless bridge between the two languages.

Key Features

  • 100% Pure javascript (no native files included): Enjoy more flexibility with a lower cost and a shorter setup process.

  • Dependency-less: Py3 eliminates the need for additional dependencies, ensuring a lightweight and hassle-free integration with your projects.

  • Seamless Python Integration: Py3 enables you to execute Python commands and scripts directly from your JavaScript or TypeScript code, making it easy to leverage the power of Python within your application.

  • Robust Error Handling: Py3 includes robust error handling features, allowing you to capture and handle errors gracefully, ensuring your application remains stable even when executing complex Python commands.

  • Asynchronous Execution: Execute Python commands asynchronously, preventing your application from becoming unresponsive while waiting for script execution to complete.

  • Detailed Results: Access detailed results of Python script executions, including standard output, standard error, and execution success status. Py3 provides a convenient result object for easy data retrieval.

  • Comprehensive Documentation: Py3 includes comprehensive TypeScript declaration files (.d.ts) and inline code comments, making it easy to understand and use the module in your projects.

  • Cross-Platform Compatibility: Py3 is designed to work across different platforms, ensuring consistent Python integration regardless of the operating system.

Installation

From github. ( For recent features )

npm install obaydmerz/py3

Or from npm: ( For stable relases )

npm install py3

Usage

Basic Example

const { Py } = require("py3");

// Create a Py instance
const pythonShell = new Py();

// Execute a Python command
pythonShell
  .exec('"Hello, Py3!"')
  .then((result) => {
    console.log("Python Output:", result);
  })
  .catch((error) => {
    console.error("Error:", error);
  });

Easy, isn't it?

API Documentation

For detailed API documentation, refer to the index.d.ts. For more information and advanced usage, check out the Py3 Wiki.