31 Building the SDK
tracyboehrer редактировал(а) эту страницу 2020-05-05 12:57:17 -05:00

Build and Run Bot Builder SDK

If you want to understand how the Bot Builder SDK works or want to debug an issue, you'll want to get the source, build it, and use it locally with a bot project.

Prerequisites

Python “Virtual Environments” allow Python packages to be installed in an isolated location for a particular application, rather than being installed globally, as such it is common practice to use them. Click here to learn more about creating and activating Virtual Environments in Python.

Clone

Clone a copy of the repo:

git clone https://github.com/Microsoft/botbuilder-python.git

Change to the SDK's directory:

cd botbuilder-python

You will need the following 3 packages installed in your environment:

To use a local copy of the SDK you can link to these packages with the pip -e option.

pip install -e ./libraries/botbuilder-schema
pip install -e ./libraries/botframework-connector
pip install -e ./libraries/botbuilder-core
pip install -e ./libraries/botbuilder-integration-aiohttp
pip install -e ./libraries/botbuilder-ai
pip install -e ./libraries/botbuilder-applicationinsights
pip install -e ./libraries/botbuilder-integration-applicationinsights-aiohttp
pip install -e ./libraries/botbuilder-dialogs
pip install -e ./libraries/botbuilder-azure
pip install -e ./libraries/botbuilder-adapters-slack
pip install -e ./libraries/botbuilder-testing

Running the Echo bot sample

Check out the home page for the source code to run the echo-bot!

Unit Tests

First execute the following command from the root level of the repo:

pip install -r ./libraries/botframework-connector/tests/requirements.txt
pip install -r ./libraries/botbuilder-core/tests/requirements.txt
pip install -r ./libraries/botbuilder-ai/tests/requirements.txt

Then enter run pytest by simply typing it into your CLI:

pytest

This is the expected output:

============================= test session starts =============================
platform win32 -- Python 3.8.2, pytest-3.4.0, py-1.5.2, pluggy-0.6.0
rootdir: C:\projects\botbuilder-python, inifile:
plugins: cov-2.5.1
...