Skip to main content

Built and signed on GitHub Actions

The python-cli module provides a simple way to execute python scripts or files.

This package works with Bun, Node.js, Deno
JSR Score
100%
Published
2 weeks ago (0.1.1)

The python-cli module provides a simple way to execute python scripts or files.

The module relies upon the @gnome/exec module and has the same basic usage as the Command and ShellCommand class.

Basic Usage

import { pythonScript, python } from "@gnome/python-cli";

const cmd = await pythonScript("print('Hello, World!')");
console.log(await cmd.text());
console.log(cmd.code);

console.log(await pythonScript("print('Hello, World!')").text());

console.log(await pythonScript("test.py").text());
console.log(await python(["test.py"]).text())
console.log(await python(["-V"]).text());

// runs python script and writes directly to console
await pythonScript("print('I am alive')").run();
Built and signed on
GitHub Actions
View transparency log

Add Package

deno add @gnome/python-cli

Import symbol

import * as mod from "@gnome/python-cli";

Add Package

npx jsr add @gnome/python-cli

Import symbol

import * as mod from "@gnome/python-cli";

Add Package

yarn dlx jsr add @gnome/python-cli

Import symbol

import * as mod from "@gnome/python-cli";

Add Package

pnpm dlx jsr add @gnome/python-cli

Import symbol

import * as mod from "@gnome/python-cli";

Add Package

bunx jsr add @gnome/python-cli

Import symbol

import * as mod from "@gnome/python-cli";