Skip to main content

setuptools extensions for working with Node.js

The setuptools_node package contains a number of useful setuptools extensions for working with Node.js, many useful web development tools can be found in the npm ecosystem.

General Use

In general custom setuptools command are used by registering the custom command in the cmdclass argument to the setup() function

setup(cmdclass={ 'my_command': MyCommand })

General options

By default all paths are relative to the directory containing setup.py. Node will be in the node directory and node modules in node_modules

  • --node-dir Specify an alternate directory where node may be found
  • --node-modules-dir Specify an alternate directory for node modules

InstallNode

The InstallNode command is used to fetch a copy of node.js and install it in the project directory. The download will be cached in the cache directory to facilitate a quick reinstall.

InstallNode Options

  • --node-dist-url Specify the URL from which to fetch node
  • --node-version Specify the version of node to fetch
  • --cache-dir Specify the directory in which to store the node download

setup.py:

from setuptools_node import InstallNode


setup(cmdclass={ 'install_node': InstallNode })

Use:

user@host $ python setup.py install_node

NpmInstall

The NpmInstall command is used to install modules from npm. By default npm install is used, npm ci may be specified with --use-ci

NpmInstall Options

  • --use-ci Use npm ci to install modules instead of npm install

setup.py:

from setuptools_node import NpmInstall


setup(cmdclass={ 'npm_install': NpmInstall })

Use:

user@host $ python setup.py npm_install  # or
user@host $ python setup.py npm_install --use-ci

Gulp

The Gulp command runs the gulp build tool

Gulp Options

  • --task Specify the task to run insteaed of the default. Multiple tasks may be specified as a comma separated list.

setup.py:

from setuptools_node import Gulp


setup(cmdclass={ 'gulp': Gulp })

Use:

user@host $ python setup.py gulp  # run default task
user@host $ python setup.py gulp --task foo  # run the 'foo' task
user@host $ python setup.py gupl --task clean,foo # run 'clean' and 'foo' tasks

GulpBuild

The GulpBuild command provides a version of build_py that executes gulp before proceeding with the normal build_py process, this allows you to build/transform static files for a web application before they are included in the package built by build_py.

Node will be installed if it is not found, and modules will be installed/updated.

GulpBuild Options

  • --task Specify the task to run insteaed of the default. Multiple tasks may be specified as a comma separated list.

Since you don't generally run build_py directly, you will need to add any arguments to the setup.cfg:

[build_py]
task=myGulpTask

setup.py:

from setuptools_node import GulpBuild


setup(cmdclass={ 'build_py': GulpBuild })

Use:

user@host $ python setup.py bdist_wheel

Metadata

Release files for setuptools-node 0.3.0

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

Source distribution (sdist)

Source distribution for setuptools-node 0.3.0
File Size Uploaded
setuptools_node-0.3.0.tar.gz 6.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for setuptools-node 0.3.0
File Interpreter ABI Platform
setuptools_node-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.3 kB

Release files / setuptools_node-0.3.0.tar.gz

Download URL setuptools_node-0.3.0.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
5e1e603375605b48cd1990a90fab13d0f20f8d8831dc7566f359363b1622957a
BLAKE2b-256 checksum
How to use checksums
b43942d72e8852e2b81d7fd1dc1e87334c9c620a1d112c2bad66b176c461f3a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / setuptools_node-0.3.0-py3-none-any.whl

Download URL setuptools_node-0.3.0-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c3843291c0b32be152946867d0fe2d4be448bceff595c561b8e2cbb26993354
BLAKE2b-256 checksum
How to use checksums
d93422c794d073201366a190492bff97ddba6c30730b55d77432508e8cd1a060
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

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