Skip to main content

**Dialog Flow Script Parser** is python module add-on for [Dialog Flow Framework](https://github.com/deeppavlovteam/dialog_flow_framework), a free and open-source software stack for creating chatbots, released under the terms of Apache License 2.0.

Project description

Dialog Flow Script Parser

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. Codestyle Tests License Apache 2.0 Python 3.6, 3.7, 3.8, 3.9

Quick Start

Installation

pip install df_script_parser

py2yaml

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.

File formats

The OUTPUT_FILE will contain:

  1. requirements key which points to a list of project requirements collected by parser. If optional argument REQUIREMENTS was specified replace the list with a list of requirements from that file
  2. namespaces 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 from PROJECT_ROOT_DIR or its parent directory if PROJECT_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.

yaml2py

df_script_parser.yaml2py --help
usage: df_script_parser.yaml2py [-h] YAML_FILE EXTRACT_TO_DIRECTORY

Extract project from a yaml file to a directory

positional arguments:
YAML_FILE             Yaml file to load
EXTRACT_TO_DIRECTORY  Path to the directory to extract project to

optional arguments:
-h, --help            show this help message and exit

Examples

To get more advanced examples, take a look at examples.

Contributing to the Dialog Flow Script Parser

Please refer to CONTRIBUTING.md.

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

df_script_parser-0.2.0.tar.gz (26.5 kB view hashes)

Uploaded Source

Built Distribution

df_script_parser-0.2.0-py3-none-any.whl (29.3 kB view hashes)

Uploaded Python 3

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