Dialog Flow Script Parser is python module add-on for Dialog Flow Framework, a free and open-source software stack for creating chatbots, released under the terms of Apache License 2.0.
Dialog Flow Script Parser allows you to parse python files in order to extract inputs and dictionaries.
pip install df_script_parser
df_script_parser.py2yaml --help
usage: df_script_parser.py2yaml [-h] [--requirements REQUIREMENTS] ROOT_FILE PROJECT_ROOT_DIR OUTPUT_FILE
Compress a dff project into a yaml file by parsing files inside PROJECT_ROOT_DIR starting with ROOT_FILE.
Extract imports, assignments of dictionaries and function calls from each file.
Recursively parse imported local modules.
Collect non-local modules as project requirements
positional arguments:
ROOT_FILE Python file to start parsing with
PROJECT_ROOT_DIR Directory that contains all the local files required to run ROOT_FILE
OUTPUT_FILE Yaml file to store parser output in
optional arguments:
-h, --help show this help message and exit
--requirements REQUIREMENTS
File with project requirements to override those collected by parser
NOTE: Use py2yaml
parser in the same python environment that is used to launch the script otherwise site packages will not be found.
NOTE: Any assignments of function calls in which the function being called is df_engine.core.Actor
will be checked for correctness of the arguments passed to the function.
The OUTPUT_FILE
will contain:
requirements
key which points to a list of project requirements collected by parser. If optional argumentREQUIREMENTS
was specified replace the list with a list of requirements from that filenamespaces
key which points to a dictionary with all the parsed files. Keys are the names of those modules that could be used to import it fromPROJECT_ROOT_DIR
or its parent directory ifPROJECT_ROOT_DIR
contains a__init__.py
file. The values are dictionaries in which keys are the names of the objects inside the module while values are their definitions.
df_script_parser.yaml2py --help
usage: df_script_parser.yaml2py [-h] YAML_FILE OUTPUT_DIR
Extract project from a yaml file to a directory
positional arguments:
YAML_FILE Yaml file to load
OUTPUT_DIR Path to the directory to extract project to
optional arguments:
-h, --help show this help message and exit
To get more advanced examples, take a look at examples.
Please refer to CONTRIBUTING.md.