Plugin for setuptools and npm
Project description
Plugin for setuptools to run npm commands.
Usage
This command provides npm_install and npm_run commands.
Run python setup.py npm_install –help or python setup.py 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.
Example
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 setup.py build. You’d configure your project like this:
# pyproject.toml
[build-system]
requires = ["setuptools", "setuptools-npm"]
build-backend = "setuptools.build_meta"
# setup.py
from distutils.command.build 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
[npm_run]
script = build
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
Built Distribution
Hashes for setuptools_npm-0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60879c6c5115e17db2e976d39ae99f2d894aeb1c26b607e8ab0fcd5b4fd3afd8 |
|
MD5 | e62a949c94ab96c674610a36bf9a66bc |
|
BLAKE2b-256 | 1e30098cfa6181400af54c7e1b6d0852cdf6a35ff0dc4bea14ad07dcdcdca0e7 |