Package: argteller
The argteller package provides the class and method decorators for a self-documenting, highly user-friendly interactive class object constructor. It will ask you for parameters that you need to provide, one by one. It will tell you the options that are available, and ask you for different parameters depending on what you have already provided. You can encode all of these in the custom DSL (domain specific language) script.Installpip install argtellerGetting started: topics and parametersTo start using argteller, you must first create a DSL script, either in the form of a text file or a string value. This script contains the names of the parameters as well as other auxiliary information, which we will go over in detail.The first two, and most basic, pieces of information are:topicandparameter. The name of atopicis just a line of string. The name of aparameteris a line of string preceded by-. Let’s look at an example:person          <--- topic
-height         <--- parameter
-weight
-nameWe will now apply this DSL script to a Python class. First we need to import the class decorator. Also, we need to put the script either as a string variable or a text file, in which case, we need the path to the file. Let’s assume this variable isstring.fromargtellerimportArgtellerClassDecorator@ArgtellerClassDecorator(map_str=string)classMyClass():def__init__(self):print('Finally!')my_object=MyClass()Running the above code will parse the script into tree data structure and prompt the user for the required arguments by recursively traversing down this tree, giving appropriate prompts for the given node.✔ Checking person requirements...     Failed!

Required argument(s):

► height  weight  nameProviding an argument for one of the parameter will prompt different set of required arguments:my_object=MyClass(height=189,name='Tim')✔ Checking person requirements...     Failed!

Required argument(s):

► weightYou could have multiple topics:person          <--- topic
-height
-weight
-name

other_details   <--- 2nd topic
-hobby
-majorIt will check them one by one, providing the user an opportunity to partition and organize the parameters by topics:my_object=MyClass(height=189,weight=80,name='Tim',hobby='basketball')✔ Checking person requirements...     Passed!
✔ Checking other_details requirements...     Failed!

Required argument(s):

► majorOnce you provide all the required parameters, the original__init__method will be called.my_object=MyClass(height=189,weight=80,name='Tim',hobby='basketball',major='math')✔ Checking person requirements...     Passed!
✔ Checking other_details requirements...     Passed!
Finally!At this point, all of the parameters are accessible as object fields, anywhere as if they were always there, including from within the__init__method as well as any other instance methods.print(my_object.major)print(my_object.name)Available optionsYou can specify available options by preceding the name with ataband=character:person
-height
-weight
-name

other_details
-hobby
    =basketball         <--- available options
    =soccer
-majormy_object=MyClass(height=189,weight=80,name='Tim')✔ Checking person requirements...     Passed!
✔ Checking other_details requirements...     Failed!

Required argument(s):

► hobby  major

Available [ hobby ] options:

► basketball  soccerConditional parametersWhat if there is a parameter that’s needed only if thehobbyisbasketball, such asstyle, that could beindoororoutdoor?person
-height
-weight
-name

other_details
-hobby
    =basketball
        -style          <--- conditional parameter
            =indoor
            =outdoor
    =soccer
-majormy_object=MyClass(height=189,weight=80,name='Tim',hobby='basketball')✔ Checking person requirements...     Passed!
✔ Checking other_details requirements...     Failed!

Required argument(s):

► major

Required argument(s) for [ basketball ] hobby:

► style

Available [ style ] options:

► indoor  outdoorOptional parametersYou could also have optional parameters, which are parameters that you can leave empty and still pass the topic requirement. For these you use+character.person
-height
-weight
-name
+gender                 <--- you can provide this parameter or not

other_details
-hobby
    =basketball
        -style
            =indoor
            =outdoor
    =soccer
-majormy_object=MyClass(height=189,weight=80,name='Tim',hobby='basketball')✔ Checking person requirements...     Passed!
✔ Checking other_details requirements...     Failed!

Required argument(s):

► major

Required argument(s) for [ basketball ] hobby:

► style

Available [ style ] options:

► indoor  outdoor

Optional argument(s) for person:

► genderBoolean parameter conditioned parameterYou could have a parameter whose value is eitherTrueorFalse, and perhaps a conditional parameter depends on this boolean parameter. For these you use?character. For example:person
-height
-weight
-name
+gender

other_details
-hobby
-major
?has_car                <--- only ask for car_brand if this person has_car
    -car_brandmy_object=MyClass(height=189,weight=80,name='Tim',hobby='basketball',has_car=True)✔ Checking person requirements...     Passed!
✔ Checking other_details requirements...     Failed!

Required argument(s):

► major

Required argument(s) for [ has_car ] option:

► car_brand

Optional argument(s) for person:

► genderString examples of the parameter valuesYou could provide example for the parameter value with explicit string values. For these you use==characters.person
-height
-weight
-name
+gender

other_details
-hobby
-major
?has_car
    -car_brand
        =='Toyota', 'BMW', 'Tesla'              <--- string examples of the valuemy_object=MyClass(height=189,weight=80,name='Tim',hobby='basketball',has_car=True)✔ Checking person requirements...     Passed!
✔ Checking other_details requirements...     Failed!

Required argument(s):

► major

Required argument(s) for [ has_car ] option:

► car_brand

Examples for [ car_brand ]: 'Toyota', 'BMW', 'Tesla'

Optional argument(s) for person:

► genderConditional parameter value assignementLastly, you can assign a value to a parameter depending on which available option argument was chosen:person
-height
-weight
-name
+gender

other_details
-hobby
    =basketball
        -style
            =indoor
            =outdoor
    =soccer
    =coding
        -major:'comp-sci'
-majormy_object=MyClass(height=189,weight=80,name='Tim',hobby='coding')✔ Checking person requirements...     Passed!
✔ Checking other_details requirements...     Passed!

Optional argument(s) for person:

► gender
Finally!This object now hascomp-scistring value assigned tomajorfield because we chosecodingoption for thehobbyparameter:print(my_object.major)# comp-sciSubtopicsIn case there are too many parameters to cover under one topic, but you feel reluctant to branch it out into a separate topic, you have an option of using subtopic. The subtopic only differs in that it adds a tab.main_topic

    sub_topic1
    -param1
    -param2

    sub_topic2
    -param3
    -param4my_object=MyClass(param1=1,param2=2)✔ Checking main_topic requirements...
  ⮑ sub_topic1 requirements...     Passed!
  ⮑ sub_topic2 requirements...     Failed!

Required argument(s):

► param3  param4