Skip to main content

No description has been added so far.

Project description

Build Status PyPI version License Test Coverage

This python package allows you to validate nom package names. It is a python implementation of the original npm/validate-npm-package-name written in javascript.

$ pip install npm_package_validator

Usage

Validate an npm package name like this:

import npm_package_validator
assert npm_package_validator.valid_old_package('MY-package')  # SUCCEEDS!
assert npm_package_validator.valid_new_package('MY-package')  # FAILS!

If you want to know whats wrong with a name, use:

from npm_package_validator.validate import validate_package
errors, warnings = validate_package('MY-package')
print("Errors: %s" % ", ".join(errors))
print("Warnings: %s" % ", ".join(warnings))

A valid new package name must have neither errors nor warnings. Existing packages can have warnings, as the npm validation rules have become stricter over time.

Credits

This package is a port from npm/validate-npm-package-name

Development

For detailed instructions see CONTRIBUTING.

Tests

You can run tests with

$ invoke test
$ invoke test --min-coverage=90     # Fail when code coverage is below 90%
$ invoke type-check                 # Run mypy type checks

Linting and formatting

Lint and format the code with

$ invoke format
$ invoke lint

All of this happens when you run invoke pre-commit.

Note

This project is still in the alpha stage and should not be considered production ready.

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

npm_package_validator-1.0.0.tar.gz (7.3 kB view details)

Uploaded Source

File details

Details for the file npm_package_validator-1.0.0.tar.gz.

File metadata

  • Download URL: npm_package_validator-1.0.0.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.6.7

File hashes

Hashes for npm_package_validator-1.0.0.tar.gz
Algorithm Hash digest
SHA256 95dc7cd62ff5352bbdbe54d9366346e7eb740a092337a6c1568f6ecdb89487d2
MD5 9bd8c05eb511fd0d3704a1970a3711ae
BLAKE2b-256 72e46a06e50a2ba606bb5a2a9f0c49645c6f0d51cf2893562257840706841009

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