Metadata-Version: 2.1
Name: npm-package-validator
Version: 1.0.3
Summary: No description has been added so far.
Home-page: https://github.com/romnn/npm-package-validator
Author: romnn
Author-email: contact@romnn.com
License: MIT
Keywords: npm_package_validator
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Environment :: Console
Classifier: Operating System :: OS Independent
Classifier: Natural Language :: English
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Requires-Python: >=3.6
Requires-Dist: Click (>=6.0)
Provides-Extra: dev
Requires-Dist: Click (>=6.0) ; extra == 'dev'
Requires-Dist: tox ; extra == 'dev'
Requires-Dist: pytest ; extra == 'dev'
Requires-Dist: pytest-cov ; extra == 'dev'
Requires-Dist: pytest-xdist ; extra == 'dev'
Requires-Dist: pytest-sugar ; extra == 'dev'
Requires-Dist: mypy ; extra == 'dev'
Requires-Dist: pyfakefs ; extra == 'dev'
Requires-Dist: coverage ; extra == 'dev'
Requires-Dist: codecov ; extra == 'dev'
Requires-Dist: sphinx (>=2.0) ; extra == 'dev'
Requires-Dist: romnn-sphinx-press-theme ; extra == 'dev'
Requires-Dist: sphinxemoji ; extra == 'dev'
Requires-Dist: flake8 ; extra == 'dev'
Requires-Dist: black (==19.10b0) ; extra == 'dev'
Requires-Dist: isort ; extra == 'dev'
Requires-Dist: m2r ; extra == 'dev'
Requires-Dist: twine ; extra == 'dev'
Requires-Dist: invoke ; extra == 'dev'
Requires-Dist: ruamel.yaml ; extra == 'dev'
Requires-Dist: pre-commit ; extra == 'dev'
Requires-Dist: cookiecutter ; extra == 'dev'
Requires-Dist: bump2version ; extra == 'dev'
Provides-Extra: docs
Requires-Dist: sphinx (>=2.0) ; extra == 'docs'
Requires-Dist: romnn-sphinx-press-theme ; extra == 'docs'
Requires-Dist: sphinxemoji ; extra == 'docs'
Provides-Extra: test
Requires-Dist: tox ; extra == 'test'
Requires-Dist: pytest ; extra == 'test'
Requires-Dist: pytest-cov ; extra == 'test'
Requires-Dist: pytest-xdist ; extra == 'test'
Requires-Dist: pytest-sugar ; extra == 'test'
Requires-Dist: mypy ; extra == 'test'
Requires-Dist: pyfakefs ; extra == 'test'

===============================
npm-package-validator
===============================

.. image:: https://travis-ci.com/romnn/npm-package-validator.svg?branch=master
        :target: https://travis-ci.com/romnn/npm-package-validator
        :alt: Build Status

.. image:: https://img.shields.io/pypi/v/npm_package_validator.svg
        :target: https://pypi.python.org/pypi/npm_package_validator
        :alt: PyPI version

.. image:: https://img.shields.io/github/license/romnn/npm-package-validator
        :target: https://github.com/romnn/npm-package-validator
        :alt: License

.. image:: https://codecov.io/gh/romnn/npm-package-validator/branch/master/graph/badge.svg
        :target: https://codecov.io/gh/romnn/npm-package-validator
        :alt: Test Coverage

""""""""

This python package allows you to validate npm package names.
It is a python implementation of the official `npm/validate-npm-package-name <https://github.com/npm/validate-npm-package-name>`_ package for javascript.

.. code-block:: console

    $ pip install npm_package_validator

CLI Usage
----------

.. code-block:: console

    $ npm_package_validator my-package

Programmatic usage
-------------------

Validate an npm package name like this:

.. code-block:: python

    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:

.. code-block:: python

    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:

.. code-block:: python

    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 <https://github.com/npm/validate-npm-package-name>`_

Development
-----------

For detailed instructions see `CONTRIBUTING <CONTRIBUTING.rst>`_.

Tests
~~~~~~~
You can run tests with

.. code-block:: console

    $ 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

.. code-block:: console

    $ 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.


