npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

py-em-node

v1.0.2

Published

py-em-node is a Node.js package designed to facilitate the execution and management of Python scripts within a Node.js environment.

Downloads

11

Readme

py-em-node

npm downloads

Introduction

py-em-node is a Node.js package designed to facilitate the execution and management of Python scripts within a Node.js environment. It provides functions to install Python, read configuration files, and execute Python scripts seamlessly.

Installation

You can install py-em-node via npm, yarn or pnpm:

npm install py-em-node
OR
pnpm add py-em-node
OR
yarn add py-em-node

Usage

Package.json OR Command-Line Interface (CLI)

py-em-node offers a command-line interface (CLI) or package.json for executing scripts directly from the terminal.

Example Usage

For this: Follow the Configuration Options as well

py-em-node start

OR

"scripts": {
  "start": "py-em-node start"
 },
npm run start
OR
pnpm start
OR
yarn start

This command will execute the Python script specified as the entry point in the configuration file.

Check out this video for quick sample usage:

Py-em-node-sample-video

Configuration

py-em-node supports configuration through a JSON file named python.config.json. TSON file python.config.tson will be removed in the next upcoming version. Place this file in the root directory of your project.

Configuration Options

  • entryPoint: Specifies the entry point Python file (default: app.py).
  • usePythonThree: Specifies the use of python3 if installed on system

Example Configuration File (python.config.json)

{
  "entryPoint": "main.py",
}

If using python3, and/or already installed

{
  "entryPoint": "main.py",
  "usePythonThree": true
}

API Reference

executeScript(script: string): Promise

Executes the specified Python script based on the provided script name.

  • script: Name of the script to execute.

readConfig(): Config

Reads the configuration from the python.config.json file and returns the configuration object.

executePythonScript(scriptPath: string, args: string[]): void

Executes the Python script located at the specified path with the provided arguments.

  • scriptPath: Path to the Python script.
  • args: Array of arguments to pass to the Python script.

License

This package is licensed under the MIT License. See the LICENSE file for details.

Acknowledgements

  • This package was inspired by the need to seamlessly integrate Python scripts into Node.js applications.

Note: Make sure to have Python installed on your system before using this package.

Credits

Ethern Myth

🎯 The following features are planned for future support

  • Allow user to enter the requirement.txt, and let this handle the installation.
  • Add support for command support that execute a script or starts a project.
  • More to be added.