Skip to main content

Interactive command line tool.

Project description

PyPI Documentation Status

Interactive command line tool.


  • Interact input

  • Supports multiple data types

  • Support input check

  • Support regex, see network.json

Support type

  • boolean

  • string

  • int

  • float

  • list

  • choice

  • mac

  • ipv4

  • cidr, eg:

  • hex


To install interact-cli, run this command in your terminal:

$ pip3 install interact-cli


$ git clone
$ cd interact-cli
$ pip3 install -e .


See interact.json


from interact import interacts

config = {
    "name": {
        "type": "string",
        "default": "jankinca",
        "max_length": 10,
        "min_length": 1,
        "description": "Your name"

if __name__ == "__main__":
    Your name [jankinca]: sssssssssssss
    Error: Invalided `sssssssssssss`
    Your name [jankinca]: jankincai



from interact import interacts

config = {
    "ipv4": {
        "type": "string",
        "regex": r"^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$",
        "default": "",
        "description": "IPv4 address"

if __name__ == "__main__":
    IPv4 address []: 22
    Error: Invalided `22`
    IPv4 address []:



from interact import interacts

config = {
    "use_code_hosting": {
        "type": "boolean",
        "default": True,
        "description": "Use code hosting platform"
    "code_hosting": {
        "type": "choice",
        "default": 1,
        "choice": [
        "description": "Code hosting",
        "when": "use_code_hosting == true"
    "code_hosting_username": {
        "type": "string",
        "default": "jankincai",
        "description": "Your code hosting username",
        "when": "use_code_hosting == true"

if __name__ == "__main__":
    Use code hosting platform [y]: y
    Select code hosting:
    1 - github
    2 - gitee
    3 - gitlab
    Choose from [1]:
    Your code hosting username [jankincai]: jankincai

    {'use_code_hosting': True, 'code_hosting': 'github', 'code_hosting_username': 'jankincai'}

    Use code hosting platform [y]: n
    {'use_code_hosting': False, 'code_hosting': None, 'code_hosting_username': None}


See demo


This package was created with Cookiecutter and the caizhengxin/cookiecutter-package project template.

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

interact-cli-0.5.0.tar.gz (9.3 kB view hashes)

Uploaded source

Built Distribution

interact_cli-0.5.0-py2.py3-none-any.whl (9.9 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page