Package: reptile
The Reptile image is created byChill Desk.ReptileReptile is a command-line interface for Python. Specifically, Reptile helps with producing interactiveREPL-like software. With Reptile, you can easily create different prompts depending on the specific type of question you want the user to respond to (input, list, checkbox, etc.).The design of Reptile is heavily based onPyInquirer, which in turn is heavily based onInquirer.js. Compared to PyInquirer, Reptile features tow major improvements:It's based on the latest version ofprompt_toolkit(3.0+), rather than 1.0.The code is well formatted, commented and documented.To create prompts with Reptile is as simple as:importreptile# Single-question prompt.question={"Type":"List","Name":"Movie","Message":"What's your favourite movie?","Choices":["Into the Wild","Fight Club","Casablanca"]}answers=reptile.prompt(question)# {"Movie": "Casablanca"}importreptile# Multiple-questions prompt.questions=[{"Type":"Checkbox","Name":"Books","Message":"What books have you read?","Choices":["Infinite Jest","The Little Prince","The Hobbit"]},{"Type":"Confirm","Name":"Confirmed","Message":"Do you agree Parasite was a masterpiece?",},{"Type":"Input","Name":"Name","Message":"What's your name?",},{"Type":"List","Name":"Movie","Message":"What's your favourite movie?","Choices":["Into the Wild","Fight Club","Casablanca"]},]answers=reptile.prompt(question)# {#   "Checkbox": ["Infinite Jest", "The Little Prince", "The Hobbit"],#   "Confirmed": False,#   "Name": "Alessandro",#   "Movie": "Casablanca",# }The PromptsCheckboxAcheckboxis a prompt that allows the user to select zero, one or more options. It offers two shortcuts: <a> to select all options and <i> to invert the selections.Options:Name: str → The name of the question. It's then used as key in the output dictionary (answer = reptile.prompt(question)).Message: str → The message to display to the user (the question itself).Choices: list → The options available to be selected.Values: list → A list of the same length of Choices. If available, the corresponded value(s) in Values is returned instead of the choice(s) selected by the user.Default: Any → The value to return if the output is empty.Validate: function → A function that takes the output of the prompt as input and returns either True (if validated) or a string (if not validated; the string is used as error message).Transform: function → A function that takes the output of the prompt and replaces it with something else.When: function → Used to create conditional flows of questions. It's a function that takes the whole answers dictionary and returns either True (if the question has to be asked) or False (if it's to be skiped).ConfirmConfirmis a prompt that allows the user to respond to a Yes or No question. It only accepts y/Y and n/N. The output value is True for Yes and False for No.Options:Name: str → The name of the question. It's then used as key in the output dictionary (answer = reptile.prompt(question)).Message: str → The message to display to the user (the question itself).Transform: function → A function that takes the output of the prompt and replaces it with something else.When: function → Used to create conditional flows of questions. It's a function that takes the whole answers dictionary and returns either True (if the question has to be asked) or False (if it's to be skiped).InputAninputis a prompt that allows the user input its own value as text.Options:Name: str → The name of the question. It's then used as key in the output dictionary (answer = reptile.prompt(question)).Message: str → The message to display to the user (the question itself).Default: Any → The value to return if the output is empty.Validate: function → A function that takes the output of the prompt as input and returns either True (if validated) or a string (if not validated; the string is used as error message).Transform: function → A function that takes the output of the prompt and replaces it with something else.When: function → Used to create conditional flows of questions. It's a function that takes the whole answers dictionary and returns either True (if the question has to be asked) or False (if it's to be skiped).ListAlistis a prompt that allows the user to select one out of many options (but one and only one).Options:Name: str → The name of the question. It's then used as key in the output dictionary (answer = reptile.prompt(question)).Message: str → The message to display to the user (the question itself).Choices: list → The options available to be selected.Values: list → A list of the same length of Choices. If available, the corresponded value(s) in Values is returned instead of the choice(s) selected by the user.Transform: function → A function that takes the output of the prompt and replaces it with something else.When: function → Used to create conditional flows of questions. It's a function that takes the whole answers dictionary and returns either True (if the question has to be asked) or False (if it's to be skiped).DevelopmentTestsYou can run the unit tests via PyTest. After you've activated the virtual environment (pipenv shell), just execute:python-mpytestReptile also comes with a handy manual test module, so that the interactions with the shell can be tested as well. To execute the module, activate the virtual environment and install Reptile from the local files themselves (rather than downloading the build from PyPI). An explanation of why this step is necessary can be foundhere. Once you've activated the virtual environment (again,pipenv shell), to install Reptile locally simply navigate to the folder containing thesetup.pyfile and execute:pipenvinstall-e.The dot (.) meanshereand the-eflag signifies the package should be installed ineditable mode, meaning all changes to the raw files will be reflected in the installed package live (this is only necessary if you inteded to make changes to Reptile).Once Reptile has been installed locally, you can execute:pythontests/manual/manual.pyJust follow the instructions as they appear on-screen to complete the test.