Skip to main content

additional types for `click` parameter using `validators`.

Project description

click-validators

PyPI - Python Version PyPI - Version PyPI - Downloads PyPI - License GitHub - Pytest GitHub - Page GitHub - Release codecov pre-commit


Additional click parameter types are built on top of the validators library, providing a wide range of validation options for various data types, including email addresses, IP addresses, credit card numbers, and more. This package simplifies the process of adding robust validation to your Click-based CLI applications.

  • clicktypes.amex()
  • clicktypes.base16()
  • clicktypes.base32()
  • clicktypes.base58()
  • clicktypes.base64()
  • clicktypes.bsc_address()
  • clicktypes.btc_address()
  • clicktypes.calling_code()
  • clicktypes.card_number()
  • clicktypes.country_code()
  • clicktypes.cron()
  • clicktypes.currency()
  • clicktypes.cusip()
  • clicktypes.diners()
  • clicktypes.discover()
  • clicktypes.domain()
  • clicktypes.email()
  • clicktypes.es_cif()
  • clicktypes.es_doi()
  • clicktypes.es_nie()
  • clicktypes.es_nif()
  • clicktypes.eth_address()
  • clicktypes.fi_business_id()
  • clicktypes.fi_ssn()
  • clicktypes.fr_department()
  • clicktypes.fr_ssn()
  • clicktypes.hostname()
  • clicktypes.iban()
  • clicktypes.ind_aadhar()
  • clicktypes.ind_pan()
  • clicktypes.ipv4()
  • clicktypes.ipv6()
  • clicktypes.isin()
  • clicktypes.jcb()
  • clicktypes.mac_address()
  • clicktypes.mastercard()
  • clicktypes.md5()
  • clicktypes.mir()
  • clicktypes.ru_inn()
  • clicktypes.sedol()
  • clicktypes.sha1()
  • clicktypes.sha224()
  • clicktypes.sha256()
  • clicktypes.sha384()
  • clicktypes.sha512()
  • clicktypes.slug()
  • clicktypes.trx_address()
  • clicktypes.unionpay()
  • clicktypes.url()
  • clicktypes.uuid()
  • clicktypes.visa()

Install

pip install click-validators

for clicktypes.eth_address() validation, additional package eth-hash[pycryptodome]>=0.7.0 is required.

PyPI - eth-hash

pip install click-validators[eth]

Usage

import the module clicktypes and use the validators as types in click commands.

import click

import clicktypes


@click.command(
    help="validate email address",
)
@click.argument(
    "email",
    type=clicktypes.email(),
)
def main(email):
    click.echo(f"valid {email=}")


if __name__ == "__main__":
    main()

Example

$ main.py fu@bar.com

valid email='fu@bar.com'
$ main.py fu.bar.com

Usage: main.py [OPTIONS] EMAIL
Try 'main.py --help' for help.

Error: Invalid value for 'EMAIL': 'fu.bar.com'.

Dependencies

PyPI - click PyPI - validators


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

click_validators-0.2.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

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

click_validators-0.2.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file click_validators-0.2.0.tar.gz.

File metadata

  • Download URL: click_validators-0.2.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.13.3 Linux/6.11.0-1012-azure

File hashes

Hashes for click_validators-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d3c5bb883d8df9db296ba384ab0bab02eb75191cb0b569c53723fd5d9776c4cd
MD5 51b10eaed943ce0c38bda00207a7fb8f
BLAKE2b-256 afc88b2e0689761c94bed432d4f00d7c15cae88f46e2ffcd0f6ff47d02cc360e

See more details on using hashes here.

File details

Details for the file click_validators-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: click_validators-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.13.3 Linux/6.11.0-1012-azure

File hashes

Hashes for click_validators-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bf5f0a4f77f13261e472327a1cb8917ce38f08fc6bf6f9fa2561c2d76eed4067
MD5 1ae3b5716a1b806f82d2bd30a99574d9
BLAKE2b-256 fd4179446046c398257d4fc1718c01917e6ccdd198971691d8941dcfd030a18f

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