Skip to main content

static-npm

Downloads and runs npm, npx and node through static binary downloads.

Linting MacOS_Tests MacOSx86_Tests Ubuntu_Tests Win_Tests

Install

pip install static-npm

Cmds

# 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

Example: Install npm live-server and use it

# 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()

Api

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 stdout

To develop software, run . ./activate.sh

Windows

This environment requires you to use git-bash.

Linting

Run ./lint.sh to find linting errors using pylint, flake8 and mypy.

Metadata

Release files for static-npm 1.0.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for static-npm 1.0.13
File Size Uploaded
static_npm-1.0.13.tar.gz 13.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for static-npm 1.0.13
File Interpreter ABI Platform
static_npm-1.0.13-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 24.0 kB

Release files / static_npm-1.0.13.tar.gz

Download URL static_npm-1.0.13.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ef3080d5b1a04f30b9081093f1c4efd4497fabacceae24a257078981fd6a3a41
BLAKE2b-256 checksum
How to use checksums
c53c411668073d2ee0c1877a194487da347dfa100a1fe049a12778edb12c6485
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.11.5

Release files / static_npm-1.0.13-py2.py3-none-any.whl

Download URL static_npm-1.0.13-py2.py3-none-any.whl
Size 10.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
3c74085cd0262ee5915c3ed8e6c1eb6ab5a1eba80329c97ed549d4a401fcc9a3
BLAKE2b-256 checksum
How to use checksums
c6b72919bd23b180e4db7f2719f63cfb47c4c6d39f553efb2c242ed8dff987fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.11.5

Release history Release notifications | RSS feed

This release

1.0.13 This release

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page