Skip to main content

Python interface to your NPM and package.json.

Project description

https://img.shields.io/travis/inveniosoftware/pynpm.svg https://img.shields.io/coveralls/inveniosoftware/pynpm.svg https://img.shields.io/github/tag/inveniosoftware/pynpm.svg https://img.shields.io/pypi/dm/pynpm.svg https://img.shields.io/github/license/inveniosoftware/pynpm.svg

Python interface to your NPM and package.json.

Further documentation is available on https://pynpm.readthedocs.io/.

Installation

PyNPM is on PyPI so all you need is:

$ pip install pynpm

Usage

First point PyNPM to your package.json:

from pynpm import NPMPackage
pkg = NPMPackage('path/to/package.json')

Now you can run e.g. npm install from within Python:

pkg.install()

Arguments are also support so you can run e.g. npm run build --report:

pkg.run_script('build', '--report')

Want to use yarn instead?

from pynpm import YarnPackage
pkg = YarnPackage('path/to/package.json')
pkg.install()

By default NPM output is piped through and the function call will wait for NPM to finish. If you want to silence the output or interact with process pass wait=False and you will get a subprocess.POpen object back:

p = pkg.install(wait=False)
p.wait()

By default you can run the following NPM commands:

  • build

  • init

  • install

  • link

  • run-script

  • start

  • stop

  • test

You can also run other NPM commands or restrict which commands you can run:

pkg = NPMPackage('path/to/package.json', commands=['install'])

Changes

Version 0.1.2 (released 2020-05-06)

  • Deprecated Python versions lower than 3.6.0. Now supporting 3.6.0 and 3.7.0.

Version 0.1.1 (released 2017-05-16)

  • Fix problem with testing click CLI output.

Version 0.1.0 (released 2017-05-12)

  • Initial public release.

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

pynpm-0.1.2.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pynpm-0.1.2-py2.py3-none-any.whl (6.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pynpm-0.1.2.tar.gz.

File metadata

  • Download URL: pynpm-0.1.2.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.7

File hashes

Hashes for pynpm-0.1.2.tar.gz
Algorithm Hash digest
SHA256 8a6d3f9423760cf3c142db3bf9bda5a075e8a91837e7d2e2b0a3de5be5e26da2
MD5 a11295475c3272f4844ee066741a536c
BLAKE2b-256 172f5dfd5a0fc9328ea1e2619f1b05c072cd193d14cb9653b426e432254fb6f0

See more details on using hashes here.

File details

Details for the file pynpm-0.1.2-py2.py3-none-any.whl.

File metadata

  • Download URL: pynpm-0.1.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.7

File hashes

Hashes for pynpm-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3f03fbf667549f8b8b7e0419eef88d1b21833ce288f96de66fbb761b9f4c4061
MD5 7bc559e18716bdc587793cb5490e4d46
BLAKE2b-256 65239180c01162e046d17808a01c3f5d81e51276a1b4c26d73dbceb7c282026b

See more details on using hashes here.

Supported by

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