Additional parameter types for the "click" module that I find useful.
Project description
clicktypes
Additional types for the click module that I find useful.
For a list of available types check the README file from the module.
Installation
Install from PyPI:
## Python 3
python3 -m pip install clicktypes
## PyPy3
pypy3 -m pip install clicktypes
Examples
The following are some examples. For complete examples check the appropriate README.
Networking
If you accept an IP address parameter:
from clicktypes.network import IPAddressParam
@click.argument(
'ip',
nargs = -1,
required = True,
type = IPAddressParam(),
)
This will validate the IP or IP's provided are IPv4 or IPv6 addresses and return them as an IPv4Address
or IPv6Address
object.
Web
If you accept an email address parameter:
from clicktypes.web import EmailParam
@click.argument(
'email',
nargs = -1,
required = True,
type = EmailParam(),
)
This will validate the email address provided matches an approved regex and it will convert it to lowercase.
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
Built Distribution
File details
Details for the file clicktypes-0.0.4.tar.gz
.
File metadata
- Download URL: clicktypes-0.0.4.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0daf06ff581d9f1e5c5afb980c8bd95684c3e0eea31e52bdef6933f30aabc882 |
|
MD5 | fa297d5a8472e25d2d6edf9c55737a45 |
|
BLAKE2b-256 | 375fe6f4128efc94b1a9225d263bec8cac2fda9259f50c356ed3e2728048729c |
File details
Details for the file clicktypes-0.0.4-py2.py3-none-any.whl
.
File metadata
- Download URL: clicktypes-0.0.4-py2.py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d79feaf18478d9e3ad818b41f24db53fab6ce7c4c156accd089b968aa3a0ae5 |
|
MD5 | b65c8afda7714640a7eac0cabf51f65e |
|
BLAKE2b-256 | b593665821745e9652bb7342548ce9b0ff339191805fdced7d8f624520b9f7b6 |