Skip to main content

Plugin for setuptools and npm

Project description

Plugin for setuptools to run npm commands.


This command provides npm_install and npm_run commands.

Run python npm_install –help or python npm_run –help for available options.

npm_not_skipped is a helper function that can be used as predicate for distutils subcommand. It evaluates to True if env variable SKIP_NPM is not defined. This variable is exclusive to this helper function and is not evaluated in npm_install and npm_run commands themselves.


Let’s say you have defined build command in package.json and you’d like to run npm clean-install and npm run build each time you run build. You’d configure your project like this:

# pyproject.toml
requires = ["setuptools", "setuptools-npm"]
build-backend = "setuptools.build_meta"
from import build
from setuptools import setup
from setuptools_npm import npm_not_skipped

class custom_build(build):
    sub_commands = [
        ('npm_install', npm_not_skipped),
        ('npm_run', npm_not_skipped),
    ] + build.sub_commands

setup(cmdclass={'build': custom_build, 'sdist': custom_sdist})
# setup.cfg
script = build

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

setuptools-npm-0.2.tar.gz (15.5 kB view hashes)

Uploaded Source

Built Distribution

setuptools_npm-0.2-py3-none-any.whl (15.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page