static binaries of npm and node
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
static_npm-1.0.13.tar.gz
(13.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file static_npm-1.0.13.tar.gz.
File metadata
- Download URL: static_npm-1.0.13.tar.gz
- Upload date:
- Size: 13.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef3080d5b1a04f30b9081093f1c4efd4497fabacceae24a257078981fd6a3a41
|
|
| MD5 |
2a4e72d711dd28cedcc4da7b6e2615eb
|
|
| BLAKE2b-256 |
c53c411668073d2ee0c1877a194487da347dfa100a1fe049a12778edb12c6485
|
File details
Details for the file static_npm-1.0.13-py2.py3-none-any.whl.
File metadata
- Download URL: static_npm-1.0.13-py2.py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c74085cd0262ee5915c3ed8e6c1eb6ab5a1eba80329c97ed549d4a401fcc9a3
|
|
| MD5 |
a17f486b4dc669655daa7db1d718f591
|
|
| BLAKE2b-256 |
c6b72919bd23b180e4db7f2719f63cfb47c4c6d39f553efb2c242ed8dff987fb
|