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

@background404/node-red-contrib-python-venv

v0.5.0

Published

Node for python virtual environment

Downloads

505

Readme

node-red-contrib-python-venv

Node for python virtual environment

Overview

With this node, you can run Python programs.

When you install this node, python virtual environment (pyenv folder) is also created.
You can run python(.exe) or pip(.exe) in that environment.

Test Case

Windows 10

  • Node.js: v20.10.0
  • npm: 9.1.3
  • Python: 3.8.3
  • pip: 24.0

Sample flows are in the examples folder.
sample-flow.png

Nodes

venv node

python(.exe) is in the ./pyenv/Scripts/python.exe or Python virtual environment you have added.

Write your Python code in the node.
The program is saved in the virtual environment and executed.

venv-node.jpg

You can access Node-RED messages like print(msg['payload']).

msg-property-flow.png

msg-property.png

msg-property-inject.png

The number of running nodes is displayed in the status.

running-status.png

pip node

pip(.exe) is in the ./pyenv/Scripts/pip.exe or Python virtual environment you have added.

You can run pip commands like install, uninstall, list.
Select the commands.

pip-node.jpg

This node uses pip in the virtual environment, so it is different from the existing Python environment packages.
Please compare.

pip-list.jpg

venv-exec

This node can execute executable files in Scripts or bin folder.

venv-exec.jpg

You can see the name of the executable in List Executables mode.
Then you can execute it with arguments in Execute mode.

venv-exec-list.jpg venv-exec-execute.jpg

venv-config (config node)

You can create and switch between multiple Python virtual environments.
You need to add and set the name of the virtual environment.
You can also specify the Python version only in Windows.
venv-config.png

When a configuration node is deleted, the virtual environment with that name is also deleted.
If you add a node with the same venv Name, only one virtual environment will be created.

The nodes can be executed by creating virtual environments even if the venv Name contains spaces or is an absolute path.
venv-config-abspath.png

Other Links

Technical Articles

I refer to "Creating Nodes" page of Node-RED.
https://nodered.org/docs/creating-nodes/

My article about python-venv (version 0.0.2)
In Japanese: Node-REDのノードを作成してみる その1(python-venv)
https://404background.com/program/node-create-python-venv/
In English: Creating Nodes for Node-RED Part 1 (python-venv)
https://404background.com/en/programming/creating-nodes-1/

Nodes created based on this node

voicevox-core node: Node that outputs Japanese audio files using voicevox-core
https://flows.nodered.org/node/@background404/node-red-contrib-voicevox-core

whisper node: Node to transcribe text using Open AI's Whisper
https://flows.nodered.org/node/@background404/node-red-contrib-whisper