static-npm


Namestatic-npm JSON
Version 1.0.13 PyPI version JSON
download
home_pagehttps://github.com/zackees/static-npm
Summarystatic binaries of npm and node
upload_time2025-01-01 05:42:36
maintainerZachary Vorhies
docs_urlNone
authorNone
requires_python>=3.10
licenseBSD 3-Clause License
keywords template-python-cmd
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # static-npm

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

[![Linting](https://github.com/zackees/static-npm/actions/workflows/lint.yml/badge.svg)](https://github.com/zackees/static-npm/actions/workflows/lint.yml)
[![MacOS_Tests](https://github.com/zackees/static-npm/actions/workflows/test_macos.yml/badge.svg)](https://github.com/zackees/static-npm/actions/workflows/test_macos.yml)
[![MacOSx86_Tests](https://github.com/zackees/static-npm/actions/workflows/test_macos_x64.yml/badge.svg)](https://github.com/zackees/static-npm/actions/workflows/test_macos_x64.yml)
[![Ubuntu_Tests](https://github.com/zackees/static-npm/actions/workflows/test_ubuntu.yml/badge.svg)](https://github.com/zackees/static-npm/actions/workflows/test_ubuntu.yml)
[![Win_Tests](https://github.com/zackees/static-npm/actions/workflows/test_win.yml/badge.svg)](https://github.com/zackees/static-npm/actions/workflows/test_win.yml)

# Install

`pip install static-npm`

# Cmds

```bash
# 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

```python
# 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

```python
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`.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/zackees/static-npm",
    "name": "static-npm",
    "maintainer": "Zachary Vorhies",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "template-python-cmd",
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/c5/3c/411668073d2ee0c1877a194487da347dfa100a1fe049a12778edb12c6485/static_npm-1.0.13.tar.gz",
    "platform": null,
    "description": "# static-npm\r\n\r\nDownloads and runs `npm`, `npx` and `node` through static binary downloads.\r\n\r\n[![Linting](https://github.com/zackees/static-npm/actions/workflows/lint.yml/badge.svg)](https://github.com/zackees/static-npm/actions/workflows/lint.yml)\r\n[![MacOS_Tests](https://github.com/zackees/static-npm/actions/workflows/test_macos.yml/badge.svg)](https://github.com/zackees/static-npm/actions/workflows/test_macos.yml)\r\n[![MacOSx86_Tests](https://github.com/zackees/static-npm/actions/workflows/test_macos_x64.yml/badge.svg)](https://github.com/zackees/static-npm/actions/workflows/test_macos_x64.yml)\r\n[![Ubuntu_Tests](https://github.com/zackees/static-npm/actions/workflows/test_ubuntu.yml/badge.svg)](https://github.com/zackees/static-npm/actions/workflows/test_ubuntu.yml)\r\n[![Win_Tests](https://github.com/zackees/static-npm/actions/workflows/test_win.yml/badge.svg)](https://github.com/zackees/static-npm/actions/workflows/test_win.yml)\r\n\r\n# Install\r\n\r\n`pip install static-npm`\r\n\r\n# Cmds\r\n\r\n```bash\r\n# Get the versions of all tools\r\nstatic-npm --version\r\nstatic-node --version\r\nstatic-npx --version\r\n\r\n# Install live-server\r\nstatic-npm install -g live-server\r\n\r\n# Install and run in isolated environment.\r\nstatic-npm-tool live-server --port=1234\r\n```\r\n\r\n# Example: Install npm `live-server` and use it\r\n\r\n```python\r\n# NpmTool handle downloading and running a npm based tool installed in isolation.\r\nimport time\r\nfrom static_npm import NpmTool\r\nlive_server = NpmTool(\"live-server\").run([f\"--port=8888\"])\r\n# Web browser should pop up.\r\ntime.sleep(10)\r\nlive_server.kill()\r\n```\r\n\r\n# Api\r\n\r\n```python\r\nfrom pathlib import Path\r\nfrom static_npm.npm import Npm\r\nfrom static_npm.npx import Npx\r\nfrom static_npm.paths import CACHE_DIR\r\n\r\ndef _get_tool_dir(tool: str) -> Path:\r\n    return CACHE_DIR / tool\r\n\r\nnpm = Npm()\r\nnpx = Npx()\r\ntool_dir = _get_tool_dir(\"live-server\")\r\nnpm.run([\"install\", \"live-server\", \"--prefix\", str(tool_dir)])\r\nproc = npx.run([\"live-server\", \"--version\", \"--prefix\", str(tool_dir)])\r\nrtn = proc.wait()\r\nstdout = proc.stdout\r\nassert 0 == rtn\r\nassert \"live-server\" in stdout\r\n```\r\n\r\n\r\nTo develop software, run `. ./activate.sh`\r\n\r\n# Windows\r\n\r\nThis environment requires you to use `git-bash`.\r\n\r\n# Linting\r\n\r\nRun `./lint.sh` to find linting errors using `pylint`, `flake8` and `mypy`.\r\n\r\n\r\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause License",
    "summary": "static binaries of npm and node",
    "version": "1.0.13",
    "project_urls": {
        "Homepage": "https://github.com/zackees/static-npm"
    },
    "split_keywords": [
        "template-python-cmd"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c6b72919bd23b180e4db7f2719f63cfb47c4c6d39f553efb2c242ed8dff987fb",
                "md5": "a17f486b4dc669655daa7db1d718f591",
                "sha256": "3c74085cd0262ee5915c3ed8e6c1eb6ab5a1eba80329c97ed549d4a401fcc9a3"
            },
            "downloads": -1,
            "filename": "static_npm-1.0.13-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a17f486b4dc669655daa7db1d718f591",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.10",
            "size": 10207,
            "upload_time": "2025-01-01T05:42:34",
            "upload_time_iso_8601": "2025-01-01T05:42:34.472317Z",
            "url": "https://files.pythonhosted.org/packages/c6/b7/2919bd23b180e4db7f2719f63cfb47c4c6d39f553efb2c242ed8dff987fb/static_npm-1.0.13-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c53c411668073d2ee0c1877a194487da347dfa100a1fe049a12778edb12c6485",
                "md5": "2a4e72d711dd28cedcc4da7b6e2615eb",
                "sha256": "ef3080d5b1a04f30b9081093f1c4efd4497fabacceae24a257078981fd6a3a41"
            },
            "downloads": -1,
            "filename": "static_npm-1.0.13.tar.gz",
            "has_sig": false,
            "md5_digest": "2a4e72d711dd28cedcc4da7b6e2615eb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 13814,
            "upload_time": "2025-01-01T05:42:36",
            "upload_time_iso_8601": "2025-01-01T05:42:36.555988Z",
            "url": "https://files.pythonhosted.org/packages/c5/3c/411668073d2ee0c1877a194487da347dfa100a1fe049a12778edb12c6485/static_npm-1.0.13.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-01 05:42:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zackees",
    "github_project": "static-npm",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "static-npm"
}
        
Elapsed time: 0.53127s