npm-package-validator
This python package allows you to validate npm package names. It is a python implementation of the official npm/validate-npm-package-name package for javascript.
$ pip install npm_package_validator
CLI Usage
$ npm_package_validator my-package
Programmatic usage
Validate an npm package name like this:
import npm_package_validator
# Fails! Uppercase is not allowed for new packages
assert npm_package_validator.valid_new_package('MY-package')
However, upper case once has been allowed and you can also validate old, existing packages:
assert npm_package_validator.valid_old_package('MY-package') # Succeeds!
When using the CLI, you can use the --old flag.
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 the official 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.
Metadata
Release files for npm-package-validator 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| npm_package_validator-1.0.3.tar.gz | 7.8 kB | Without provenance | Details for npm_package_validator-1.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| npm_package_validator-1.0.3-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for npm_package_validator-1.0.3-py2.py3-none-any.whl |
Total release size: 14.4 kB
Release files / npm_package_validator-1.0.3.tar.gz
| Download URL | npm_package_validator-1.0.3.tar.gz |
|---|---|
| Size | 7.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c9e63ddf2224c996d76e525f98f62a100a434d52b69fe45726aac9650eee0bbc
|
|
BLAKE2b-256 checksum How to use checksums |
8eaec122ae3ee4cd7c4e765e3a71fdf5ebee7efcfd03bc59358b1b8c1292685c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7
|
Release files / npm_package_validator-1.0.3-py2.py3-none-any.whl
| Download URL | npm_package_validator-1.0.3-py2.py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
1c307226ab7e097edb74fdba4490c7a0b66fb06fbe0926d1e1d5bccda82b4833
|
|
BLAKE2b-256 checksum How to use checksums |
c50c46bd836f7070a67b97f558ab8b97067583f4e45aa405d7734968c69dbacc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7
|
Security for npm-package-validator 1.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.