static-npm
Downloads and runs npm, npx and node through static binary downloads.
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)
| File | Size | Uploaded | |
|---|---|---|---|
| static_npm-1.0.13.tar.gz | 13.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|