Runs npm, npx and node through lazy fetched binary downloads. Cross-platform: Windows, Linux, MacOsArm, and MacOsx86 supported.
pip install static-npm
# Get the versions of all tools
static-npm --version
static-node --version
static-npx --version
# Install live-server
static-npm install -g live-server
# Install and run in isolated environment.
static-npm-tool live-server --port=1234# NpmTool handle downloading and running a npm based tool installed in isolation.
import time
from static_npm import NpmTool
live_server = NpmTool("live-server").run([f"--port=8888"])
# Web browser should pop up.
time.sleep(10)
live_server.kill()from pathlib import Path
from static_npm.npm import Npm
from static_npm.npx import Npx
from static_npm.paths import CACHE_DIR
def _get_tool_dir(tool: str) -> Path:
return CACHE_DIR / tool
npm = Npm()
npx = Npx()
tool_dir = _get_tool_dir("live-server")
npm.run(["install", "live-server", "--prefix", str(tool_dir)])
proc = npx.run(["live-server", "--version", "--prefix", str(tool_dir)])
rtn = proc.wait()
stdout = proc.stdout
assert 0 == rtn
assert "live-server" in stdoutTo develop software, run . ./activate.sh
This environment requires you to use git-bash.
Run ./lint.sh to find linting errors using pylint, flake8 and mypy.