Commandline

nppm is the Node.py package manager.

Synopsis

nppm bin
nppm dist
nppm init
nppm install
nppm publish
nppm register
nppm run
nppm uninstall
nppm upload

bin

nppm bin [--global] [--pip]

Prints the local or global binary directory that nppm installs to. If you pass the --pip switch, the Pip binary directory will be printed instead.

Note that nppm install will automatically create wrappers in the Node.py binary directory that reference respective commands in the Pip binary directory, thus if you have Python dependencies that expose scripts, you only need to add the Node.py binary directory to your path.

The local binary directory is nodepy_modules/.bin.


dist

nppm dist

Create a .tar.gz archive from your package and save it into the dist/ directory. If you want to publish the package on the registry, use the nppm publish command.


init

nppm init

Initialize a package.json file in the current working directory.


install

nppm install [-g,--global] [--root] [-e,--develop] [-P,--packagedir]
             [-I,--ignore-installed]
             [--pip-separate-process] [--dev/--production] [--save]
             [--save-dev] [--recursive] [-F,--from] [PACKAGES]

Installs one or more Node.py packages from the package registry, package distribution files (see nppm dist) or a directory. If no PACKAGES are specified, the dependencies of the current package are installed. In that case, the --dev switch is enabled by default, otherwise --production is the default.

The PACKAGES argument, if specified, can be of the following type:

  • A package name and version selector of the format <package>[@<version>], in which case the package will be looked up and installed from the package registry.
  • An existing directory that contains a package.json to install from.
  • A Git URL in the format git+<url>[@<ref>] to install the package from.
  • A Python package requirement in the format py/<req>

With --dev enabled, the development dependencies of the packages are installed additionally to their normal runtime dependencies. Note that development dependencies are never installed transitively.

Using --global will install the PACKAGES into the user-global modules directory and creates scripts in the global binaries directory. Note that "global" always refers to the "User-space global". Global installations are only supposed to be used for command-line tools. Node.py will not look to resolve require()s in the global modules directory for your local project.

The --root option will install the package into the global Python prefix and should only be used when a command-line utility should be installed for all users of a system.

Note: Inside a virtual environment, -g,--global will be promoted to --root.

The --develop flag can only be used when installing a package from a directory. Using this flag will install the package in development mode, which means that a .nodepy-link file will be created instead of the package contents being copied. Node.py will read this link and continue resolving require()s in the target directory (which is your package that you installed with --develop).

The -I,--ignore-installed option will be passed to pip install.

The -P,--packagedir option can be used to change the directory from which the package.json will be read (in case of an installation without packages specified on the command-line) or written to (in case of --save and --save-dev).

Using the --save or --save-dev options requires a package.json in the current working directory to which the new dependencies can be added. Note also that the package manifest will be re-written with a strict 2-space indentation.

The --recursive option can be used to make sure dependencies of already satisfied dependencies are satisfied as well. This can be useful if you uninstall a dependencies of another package and want to re-install them without remembering them all.


publish

nppm publish [-f,--force] [-u,--user] [-p,--password] [--to]

A combination of nppm dist and nppm upload that also invokes the pre-publish and post-publish scripts.

Requirements

In order to publish a package to registry.nodepy.org, it must meet the following requirements:

  • The name of the package must be scoped with your username (ie. @username/packagename)
  • The license field in package.json must not be empty

After a package version has been uploaded to the registry, arbitrary files may be uploaded to that version as well. This is intended to be used for additional files that may be downloaded by the actual package when necessary. Note that https://registry.nodepy.org currently has a size upload limit of 2MiB.

It is important that you read and understand the NPPM Registry Terms of Use before you publish packages and upload content to the registry.


register

nppm register [REGISTRY] [--agree-tos] [--save]

Register a new account on the package registry. Note that you can change the URL to the registry being used in the ~/.nppmrc file. By default, it will point to https://registry.nodepy.org.

$ cat ~/.nppmrc
[registry:default]
url = http://localhost:8000

run

nppm run SCRIPT [ARGS]

Runs the SCRIPT that is specified in the current package's manifest. Note that some scripts have special meanings and will be invoked automatically by other actions of the package manager (eg. post-install or pre-publish).

Example

{
  "scripts": {
    "build-docs": "!mkdocs build",
    "pre-publish": "scripts/pre-publish.py"
  }
}
$ nppm run build-docs

uninstall

nppm uninstall [-g,--global] PACKAGES

Uninstalls one or more previously installed PACKAGES.


upload

nppm upload [-f, --force] [-u, --user] [-p, --password] [--to] FILENAME

For the current version that is specified in the package.json of your project, uploads the specified FILENAME to the package registry. If the version and/or package does not exist at the time of the upload, the file will be rejected unless you upload the distribution archive created with nppm dist first. If you upload the distribution archive, the package and package version will be created and assigned to your account.

Note: You should prefer to use the nppm publish command to publish your package as it is less error prone and will also invoke the pre-publish script if you have one specified in your package manifest.

Read about the Requirements to publish a package.

Table of Contents