{"id":17930216,"url":"https://github.com/samwillis/nodejs-pypi","last_synced_at":"2025-04-07T13:09:18.646Z","repository":{"id":37328187,"uuid":"504523755","full_name":"samwillis/nodejs-pypi","owner":"samwillis","description":"Project to repackage Node.js releases as Python binary wheels for distribution via PyPI","archived":false,"fork":false,"pushed_at":"2024-01-15T10:29:00.000Z","size":36,"stargazers_count":96,"open_issues_count":12,"forks_count":7,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-04-06T19:58:45.636Z","etag":null,"topics":["nodejs","npm","pip","python","virtual-environment"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samwillis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-17T12:19:33.000Z","updated_at":"2025-03-28T10:29:44.000Z","dependencies_parsed_at":"2024-06-18T17:01:03.050Z","dependency_job_id":"3e657386-a11a-46ed-ae1a-d04f4edf00bd","html_url":"https://github.com/samwillis/nodejs-pypi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samwillis%2Fnodejs-pypi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samwillis%2Fnodejs-pypi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samwillis%2Fnodejs-pypi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samwillis%2Fnodejs-pypi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samwillis","download_url":"https://codeload.github.com/samwillis/nodejs-pypi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247657281,"owners_count":20974345,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nodejs","npm","pip","python","virtual-environment"],"created_at":"2024-10-28T21:12:27.717Z","updated_at":"2025-04-07T13:09:18.624Z","avatar_url":"https://github.com/samwillis.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"Node.js PyPI distribution\n=====================\n\n[Node.js][nodejs] is an open-source, cross-platform, back-end JavaScript runtime environment that runs on the V8 engine and executes JavaScript code outside a web browser. \n\nThe [nodejs-bin][pypi] Python package redistributes Node.js so that it can be used as a dependency of Python projects. With `nodejs-bin` you can call `nodejs`, `npm` and `npx` from both the [command line](#command-line-usage) and a [Python API](#python-api-usage).\n\n**Note: this is an unofficial Node.js distribution.** However, it _does_ use only official bits distributed by the official NodeJS maintainers from one of the following sources:\n\n* NodeJS official releases: https://nodejs.org/en/download/releases/\n* NodeJS \"unofficial\" builds: https://github.com/nodejs/unofficial-builds/\n\n**This is intended for use within Python virtual environments and containers, it should probably not be used for global installation.**\n\nThis PyPI distribution is provided by \u003chttps://github.com/samwillis/nodejs-pypi\u003e.\n\n[nodejs]: https://nodejs.org/\n[pypi]: https://pypi.org/project/nodejs-bin/\n\nInstall\n-------\n\nTo install:\n\n```shell\npip install nodejs-bin\n```\n\nBy default the command line `node`, `npm` and `npx` commands are not installed to prevent collisions with already installed Node.js versions. To install them:\n\n```shell\npip install 'nodejs-bin[cmd]'\n```\n\nYou can specify the Node.js version to install with:\n\n```shell\npip install nodejs-bin==\u003cversion\u003e\n\n# Example:\npip install nodejs-bin==16.15.1\n```\n\nCommand Line Usage\n------------------\n\nTo run Node.js from the command line, use:\n\n```shell\npython -m nodejs\n```\n\n`npm` and `npx` are also available as `nodejs.npm` and `nodejs.npx`:\n\n```shell\npython -m nodejs.npm\npython -m nodejs.npx\n```\n\nIf you installed the optional command line commands with `pip install 'nodejs-bin[cmd]'` (see above), you can use them directly from the command line as you would normally with Node.js:\n\n```shell\nnode\nnpm\nnpx\n```\n\nPython API Usage\n----------------\n\n`node-bin` has a simple Python API that wraps the Node.js command line with the [Python `subprocess`](https://docs.python.org/3/library/subprocess.html).\n\nFor `node`, `npm` and `npx` there are `.call()`, `.run()` and `.Popen()` methods that match the equivalent `subprocess` methods.\n\nTo run Node.js from a Python program and return the exit code:\n\n```python\nfrom nodejs import node, npm, npx\n\n# Run Node.js and return the exit code.\nnode.call(['script.js', 'arg1', ...], **kwargs)\n\n# Run npm and return the exit code.\nnpm.call(['command', 'arg1', ...], **kwargs)\n\n# Run npx and return the exit code.\nnpx.call(['command', 'arg1', ...], **kwargs)\n```\n\nThe `call(args, **kwargs)` functions wrap [`subprocess.call()`](https://docs.python.org/3/library/subprocess.html#subprocess.call), passes though all `kwargs` and returns the exit code of the process.\n\nTo run Node.js from a Python program and return a [CompletedProcess](https://docs.python.org/3/library/subprocess.html#subprocess.CompletedProcess) object:\n\n```python\nfrom nodejs import node, npm, npx\n\n# Run Node.js and return the exit code.\nnode.run(['script.js', 'arg1', ...], **kwargs)\n\n# Run npm and return the exit code.\nnpm.run(['command', 'arg1', ...], **kwargs)\n\n# Run npx and return the exit code.\nnpx.run(['command', 'arg1', ...], **kwargs)\n```\n\nThe `run(args, **kwargs)` functions wrap [`subprocess.run()`](https://docs.python.org/3/library/subprocess.html#subprocess.run), passes though all `kwargs` and returns a `CompletedProcess`.\n\nAdditionally, to start a Node.js process and return a `subprocess.Popen` object, you can use the `Popen(args, **kwargs)` functions:\n\n```python\nfrom nodejs import node, npm, npx\n\n# Start Node.js and return the Popen object.\nnode_process = node.Popen(['script.js', 'arg1', ...], **kwargs)\n\n# Start npm and return the Popen object.\nnpm_process = npm.Popen(['command', 'arg1', ...], **kwargs)\n\n# Start npx and return the Popen object.\nnpx_process = npx.Popen(['command', 'arg1', ...], **kwargs)\n```\n\nThe `Popen(args, **kwargs)` functions wrap [`subprocess.Popen()`](https://docs.python.org/3/library/subprocess.html#subprocess.Popen), passes though all `kwargs` and returns a [`Popen` object](https://docs.python.org/3/library/subprocess.html#popen-objects).\n\nThe `nodejs.node` api is also available as `nodejs.run` and `nodejs.call` and `nodejs.Popen`.\n\nFinally, there are a number of convenient attributes on the `nodejs` module:\n\n  * `nodejs.node_version`: the version of Node.js that is installed.\n  * `nodejs.path`: the path to the Node.js executable.\n\n\nVersions\n--------\n\nnodejs-bin offers Node.js *Current* and *LTS* (long-term support) versions. See the [Node.js Documentation](https://nodejs.org/en/about/releases/) for more information.\n\nThe full list of versions is available on PyPI is here: \u003chttps://pypi.org/project/nodejs-bin/#history\u003e\n\n\nLicense\n-------\n\nThe [Node.js license](https://raw.githubusercontent.com/nodejs/node/master/LICENSE).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamwillis%2Fnodejs-pypi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamwillis%2Fnodejs-pypi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamwillis%2Fnodejs-pypi/lists"}