### Install BotFramework-Streaming Source: https://github.com/microsoft/botbuilder-python/blob/main/libraries/botframework-streaming/README.rst Use pip to install the botframework-streaming library. ```bash pip install botframework-streaming ``` -------------------------------- ### Install Test Dependencies Source: https://github.com/microsoft/botbuilder-python/wiki/Building-the-SDK Install the necessary requirements for running unit tests. ```bash 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 ``` -------------------------------- ### Install botbuilder-integration-aiohttp Source: https://github.com/microsoft/botbuilder-python/blob/main/libraries/botbuilder-integration-aiohttp/README.rst Use pip to install the botbuilder-integration-aiohttp library. ```python pip install botbuilder-integration-aiohttp ``` -------------------------------- ### Install BotBuilder-Azure SDK Source: https://github.com/microsoft/botbuilder-python/blob/main/libraries/botbuilder-azure/README.rst Use pip to install the botbuilder-azure package. ```python pip install botbuilder-azure ``` -------------------------------- ### Install Local SDK Packages Source: https://github.com/microsoft/botbuilder-python/wiki/Building-the-SDK Install local copies of the SDK packages using pip's editable install option. ```bash 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 ``` -------------------------------- ### Install Bot Dependencies Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/README.md Install the project dependencies required to run the bot locally. ```bash # install dependencies pip install -r requirements.txt ``` -------------------------------- ### Install BotBuilder-AI SDK Source: https://github.com/microsoft/botbuilder-python/blob/main/libraries/botbuilder-ai/README.rst Install the botbuilder-ai package using pip. ```python pip install botbuilder-ai ``` -------------------------------- ### Install LUIS CLI Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/app/templates/core/{{cookiecutter.bot_name}}/README-LUIS.md Installs the LUIS CLI globally using npm. Ensure Azure CLI is installed and updated first. ```bash npm i -g luis-apis@^2.4.0 ``` -------------------------------- ### Install botbuilder-schema Source: https://github.com/microsoft/botbuilder-python/blob/main/libraries/botbuilder-schema/README.rst Use pip to install the botbuilder-schema package. ```python pip install botbuilder-schema ``` -------------------------------- ### Verify Cookiecutter Installation Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/README.md Verify that cookiecutter has been installed correctly by running the help command. ```bash cookiecutter --help ``` -------------------------------- ### Install BotBuilder-Adapters Slack Source: https://github.com/microsoft/botbuilder-python/blob/main/libraries/botbuilder-adapters-slack/README.rst Installs the botbuilder-adapters-slack package using pip. ```python pip install botbuilder-adapters-slack ``` -------------------------------- ### Install Bot Framework Connector Source: https://github.com/microsoft/botbuilder-python/blob/main/libraries/botframework-connector/README.rst Install the botframework-connector package using pip. ```python pip install botframework-connector ``` -------------------------------- ### Install Cookiecutter Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/README.md Install the cookiecutter tool using pip. This is a prerequisite for using the bot generator. ```bash pip install cookiecutter ``` -------------------------------- ### Install BotBuilder-ApplicationInsights SDK Source: https://github.com/microsoft/botbuilder-python/blob/main/libraries/botbuilder-integration-applicationinsights-aiohttp/README.rst Install the necessary SDK package using pip. This command adds the aiohttp integration for Application Insights to your project. ```bash pip install botbuilder-integration-applicationinsights-aiohttp ``` -------------------------------- ### Install BotBuilder-Core SDK Source: https://github.com/microsoft/botbuilder-python/blob/main/libraries/botbuilder-core/README.rst Install the botbuilder-core package using pip. This command is used to add the SDK to your Python environment. ```python pip install botbuilder-core ``` -------------------------------- ### Install botbuilder-testing SDK Source: https://github.com/microsoft/botbuilder-python/blob/main/libraries/botbuilder-testing/README.rst Install the botbuilder-testing package using pip. This command is used to add the testing SDK to your Python environment. ```python pip install botbuilder-testing ``` -------------------------------- ### Install BotBuilder-ApplicationInsights SDK Source: https://github.com/microsoft/botbuilder-python/blob/main/libraries/botbuilder-applicationinsights/README.rst Use pip to install the BotBuilder-ApplicationInsights package for your Python project. ```python pip install botbuilder-applicationinsights ``` -------------------------------- ### Install BotBuilder Core from TestPyPI Source: https://github.com/microsoft/botbuilder-python/blob/main/UsingTestPyPI.md Use this command to install a specific BotBuilder package from the TestPyPI repository. Replace 'botbuilder-core' with the desired package name. ```bash $ pip install --index-url https://test.pypi.org/simple/ botbuilder-core ``` -------------------------------- ### Install BotBuilder-Dialogs SDK Source: https://github.com/microsoft/botbuilder-python/blob/main/libraries/botbuilder-dialogs/README.rst Installs the botbuilder-dialogs package using pip. Ensure you have Python 3.7.0 or later. ```python pip install botbuilder-dialogs ``` -------------------------------- ### Install BotBuilder Python SDK Locally Source: https://github.com/microsoft/botbuilder-python/blob/main/README.md Install the BotBuilder Python SDK packages locally in editable mode using pip. This allows for direct use of local code changes. ```bash pip install -e ./libraries/botbuilder-schema pip install -e ./libraries/botframework-connector pip install -e ./libraries/botframework-streaming pip install -e ./libraries/botbuilder-core pip install -e ./libraries/botbuilder-ai pip install -e ./libraries/botbuilder-applicationinsights pip install -e ./libraries/botbuilder-dialogs pip install -e ./libraries/botbuilder-azure pip install -e ./libraries/botbuilder-integration-applicationinsights-aiohttp pip install -e ./libraries/botbuilder-adapters-slack pip install -e ./libraries/botbuilder-integration-aiohttp pip install -e ./libraries/botbuilder-testing ``` -------------------------------- ### Install and run Black code formatter Source: https://github.com/microsoft/botbuilder-python/wiki/How-to-Contribute Ensure your code adheres to the Black code format by installing and running the formatter on your libraries. ```shell pip install black black libraries ``` -------------------------------- ### Install BotBuilder Core from TestPyPI with PyPI Fallback Source: https://github.com/microsoft/botbuilder-python/blob/main/UsingTestPyPI.md Install a BotBuilder package from TestPyPI while allowing pip to fetch dependencies from the main PyPI repository. This is useful when the package being tested has dependencies hosted on PyPI. ```bash pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ botbuilder-core ``` -------------------------------- ### Example Pytest Output Source: https://github.com/microsoft/botbuilder-python/blob/main/README.md This is an example of the expected output when running the pytest command for the BotBuilder Python SDK. ```bash ============================= 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 ... ============================== 2 passed in 0.xx seconds ============================== ``` -------------------------------- ### Install and run Pylint linter Source: https://github.com/microsoft/botbuilder-python/wiki/How-to-Contribute Check for code errors using Pylint by installing it and running it with the specified configuration file on your libraries. ```shell pip install pylint pylint --rcfile=.pylintrc libraries ``` -------------------------------- ### LUIS Resource Creation Output Example Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/app/templates/core/{{cookiecutter.bot_name}}/README-LUIS.md This JSON output details the properties of a newly created LUIS Cognitive Services resource on Azure. ```json { "endpoint": "https://westus.api.cognitive.microsoft.com/luis/v2.0", "etag": "\"########-####-####-####-############\"", "id": "/subscriptions/########-####-####-####-############/resourceGroups/ResourceGroupName/providers/Microsoft.CognitiveServices/accounts/NewLuisResourceName", "internalId": "################################", "kind": "luis", "location": "westus", "name": "NewLuisResourceName", "provisioningState": "Succeeded", "resourceGroup": "ResourceGroupName", "sku": { "name": "S0", "tier": null }, "tags": null, "type": "Microsoft.CognitiveServices/accounts" } ``` -------------------------------- ### LUIS Keys List Output Example Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/app/templates/core/{{cookiecutter.bot_name}}/README-LUIS.md This JSON output displays the primary and secondary keys for your LUIS Cognitive Services account. Keep these keys secure. ```json { "key1": "9a69####dc8f####8eb4####399f####", "key2": "####f99e####4b1a####fb3b####6b9f" } ``` -------------------------------- ### Expected Pytest Output Source: https://github.com/microsoft/botbuilder-python/wiki/Building-the-SDK Example of the expected output when running pytest successfully. ```bash ============================= 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 ... ==================================== 1 passed in 0.XXs ===================================== ``` -------------------------------- ### Azure Access Token Response Example Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/app/templates/core/{{cookiecutter.bot_name}}/README-LUIS.md This JSON object contains the access token and its expiration details. The 'accessToken' value is crucial for subsequent API calls. ```json { "accessToken": "eyJ0eXAiOiJKVtokentokentokentokentokeng1dCI6Ik4tbEMwbi05REFMcXdodUhZbkhRNjNHZUNYYyIsItokenI6Ik4tbEMwbi05REFMcXdodUhZbkhRNjNHZUNYYyJ9.eyJhdWQiOiJodHRwczovL21hbmFnZW1lbnQuY29yZS53aW5kb3dzLm5ldC8iLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC83MmY5ODhiZi04NmYxLTQxYWYtOTFhYi0yZDdjZDAxMWRiNDcvIiwiaWF0IjoxNTUzODc3MTUwLCJuYmYiOjE1NTM4NzcxNTAsImV4cCI6MTU1Mzg4MTA1MCwiX2NsYWltX25hbWVzIjp7Imdyb3VwcyI6InNyYzEifSwiX2NsYWltX3NvdXJjZXMiOnsic3JjMSI6eyJlbmRwb2ludCI6Imh0dHBzOi8vZ3JhcGgud2luZG93cy5uZXQvNzJmOTg4YmYtODZmMS00MWFmLTkxYWItMmQ3Y2QwMTFkYjQ3L3VzZXJzL2ZmZTQyM2RkLWJhM2YtNDg0Ny04NjgyLWExNTI5MDA4MjM4Ny9nZXRNZW1iZXJPYmplY3RzIn19LCJhY3IiOiIxIiwiYWlvIjoiQVZRQXEvOEtBQUFBeGVUc201NDlhVHg4RE1mMFlRVnhGZmxxOE9RSC9PODR3QktuSmRqV1FqTkkwbmxLYzB0bHJEZzMyMFZ5bWZGaVVBSFBvNUFFUTNHL0FZNDRjdk01T3M0SEt0OVJkcE5JZW9WU0dzd0kvSkk9IiwiYW1yIjpbIndpYSIsIm1mYSJdLCJhcHBpZCI6IjA0YjA3Nzk1LThkZGItNDYxYS1iYmVlLTAyZjllMWJmN2I0NiIsImFwcGlkYWNyIjoiMCIsImRldmljZWlkIjoiNDhmNDVjNjEtMTg3Zi00MjUxLTlmZWItMTllZGFkZmMwMmE3IiwiZmFtaWx5X25hbWUiOiJHdW0iLCJnaXZlbl9uYW1lIjoiU3RldmVuIiwiaXBhZGRyIjoiMTY3LjIyMC4yLjU1IiwibmFtZSI6IlN0ZXZlbiBHdW0iLCJvaWQiOiJmZmU0MjNkZC1iYTNmLTQ4NDctODY4Mi1hMTUyOTAwODIzODciLCJvbnByZW1fc2lkIjoiUy0xLTUtMjEtMjEyNzUyMTE4NC0xNjA0MDEyOTIwLTE4ODc5Mjc1MjctMjYwOTgyODUiLCJwdWlkIjoiMTAwMzdGRkVBMDQ4NjlBNyIsInJoIjoiSSIsInNjcCI6InVzZXJfaW1wZXJzb25hdGlvbiIsInN1YiI6Ik1rMGRNMWszN0U5ckJyMjhieUhZYjZLSU85LXVFQVVkZFVhNWpkSUd1Nk0iLCJ0aWQiOiI3MmY5ODhiZi04NmYxLTQxYWYtOTFhYi0yZDdjZDAxMWRiNDciLCJ1bmlxdWVfbmFtZSI6InN0Z3VtQG1pY3Jvc29mdC5jb20iLCJ1cG4iOiJzdGd1bUBtaWNyb3NvZnQuY29tIiwidXRpIjoiT2w2NGN0TXY4RVNEQzZZQWRqRUFtokenInZlciI6IjEuMCJ9.kFAsEilE0mlS1pcpqxf4rEnRKeYsehyk-gz-zJHUrE__oad3QjgDSBDPrR_ikLdweynxbj86pgG4QFaHURNCeE6SzrbaIrNKw-n9jrEtokenlosOxg_0l2g1LeEUOi5Q4gQREAU_zvSbl-RY6sAadpOgNHtGvz3Rc6FZRITfkckSLmsKAOFoh-aWC6tFKG8P52rtB0qVVRz9tovBeNqkMYL49s9ypduygbXNVwSQhm5JszeWDgrFuVFHBUP_iENCQYGQpEZf_KvjmX1Ur1F9Eh9nb4yI2gFlKncKNsQl-tokenK7-tokentokentokentokentokentokenatoken", "expiresOn": "2200-12-31 23:59:59.999999", "subscription": "AzureSubscriptionGuid", "tenant": "tenant-guid", "tokenType": "Bearer" } ``` -------------------------------- ### Get Azure Access Token Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/app/templates/core/{{cookiecutter.bot_name}}/README-LUIS.md Retrieves an ARM access token using the Azure CLI. This token is required for authenticating LUIS operations that interact with Azure resources. ```bash az account get-access-token --subscription "AzureSubscriptionGuid" ``` -------------------------------- ### Navigate to SDK Directory Source: https://github.com/microsoft/botbuilder-python/wiki/Building-the-SDK Change the current directory to the cloned SDK directory. ```bash cd botbuilder-python ``` -------------------------------- ### Create Connector Client, Initialize Conversation, and Send Activity Source: https://github.com/microsoft/botbuilder-python/blob/main/libraries/botframework-connector/README.rst Demonstrates how to create a ConnectorClient with authentication, initialize a conversation, and send a message activity to a user. Ensure you replace placeholders with your actual App ID, App Password, and other relevant IDs. ```python from botbuilder.schema import * from botframework.connector import ConnectorClient from botframework.connector.auth import MicrosoftAppCredentials APP_ID = '' APP_PASSWORD = '' SERVICE_URL = 'https://slack.botframework.com' CHANNEL_ID = 'slack' BOT_ID = '' RECIPIENT_ID = '' credentials = MicrosoftAppCredentials(APP_ID, APP_PASSWORD) connector = ConnectorClient(credentials, base_url=SERVICE_URL) conversation = connector.conversations.create_conversation(ConversationParameters( bot=ChannelAccount(id=BOT_ID), members=[ChannelAccount(id=RECIPIENT_ID)])) connector.conversations.send_to_conversation(conversation.id, Activity( type=ActivityTypes.message, channel_id=CHANNEL_ID, recipient=ChannelAccount(id=RECIPIENT_ID), from_property=ChannelAccount(id=BOT_ID), text='Hello World!')) ``` -------------------------------- ### Create Core Bot Project Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/README.md Use cookiecutter to generate a new Core Bot project from a specific template URL. ```bash cookiecutter https://github.com/microsoft/botbuilder-python/releases/download/Templates/core.zip ``` -------------------------------- ### Run the Console EchoBot Source: https://github.com/microsoft/botbuilder-python/blob/main/tests/functional-tests/functionaltestbot/functionaltestbot/README.md Navigate to the sample directory and run the bot using Python. ```bash python main.py ``` -------------------------------- ### Azure CLI Login and Deployment Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/app/templates/empty/{{cookiecutter.bot_name}}/deploymentTemplates/deployUseExistResourceGroup/readme.md Log in to Azure using the Azure CLI and then create a resource group deployment using a specified template and parameter file. ```bash az login az deployment group create --resource-group --template-file --parameters @ ``` -------------------------------- ### Python Settings for BotFramework Connector Source: https://github.com/microsoft/botbuilder-python/blob/main/swagger/README.md Python-specific AutoRest settings for generating the botframework-connector package. Avoid using --basic-setup-py to preserve existing setup.py files. ```yaml python: license-header: MICROSOFT_MIT_NO_VERSION add-credentials: true payload-flattening-threshold: 2 namespace: botframework.connector package-name: botframework-connector override-client-name: ConnectorClient clear-output-folder: true output-folder: ./generated ``` -------------------------------- ### Create Azure Deployment Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/app/templates/echo/{{cookiecutter.bot_name}}/deploymentTemplates/deployUseExistResourceGroup/readme.md Create an Azure resource group deployment using a template and parameter file. Ensure you replace placeholders with your specific values. ```bash az deployment group create --resource-group --template-file --parameters @ ``` -------------------------------- ### Import Local LUIS Application Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/app/templates/core/{{cookiecutter.bot_name}}/README-LUIS.md Imports a local LUIS application file into your LUIS account. Replace placeholders with your specific region, authoring key, and application name. ```bash luis import application --region "LuisAppAuthoringRegion" --authoringKey "LuisAuthoringKey" --appName "FlightBooking" --in "./cognitiveModels/FlightBooking.json" ``` -------------------------------- ### Generate Bot with Project Name Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/README.md Run the generator, defaulting the bot name to 'test_project' by passing a named argument. ```bash # Run the generator defaulting the bot name to test_project cookiecutter https://github.com/microsoft/botbuilder-python/releases/download/Templates/echo.zip project_name="test_project" ``` -------------------------------- ### Create Echo Bot Project Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/README.md Use cookiecutter to generate a new Echo Bot project from a specific template URL. ```bash cookiecutter https://github.com/microsoft/botbuilder-python/releases/download/Templates/echo.zip ``` -------------------------------- ### Create Empty Bot Project Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/README.md Use cookiecutter to generate a new Empty Bot project from a specific template URL. ```bash cookiecutter https://github.com/microsoft/botbuilder-python/releases/download/Templates/empty.zip ``` -------------------------------- ### Run Bot Locally with Flask Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/README.md Alternatively, set the FLASK_APP environment variable and run the bot using 'flask run'. ```bash set FLASK_APP=app.py flask run --host=127.0.0.1 --port=3978 ``` -------------------------------- ### Deploy Azure Bot with New Resource Group Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/app/templates/core/{{cookiecutter.bot_name}}/deploymentTemplates/deployWithNewResourceGroup/readme.md Deploys an Azure Bot and its associated resources into a new resource group using an ARM template. Ensure you have the template and parameter files ready. ```bash az deployment sub create --template-file --location --parameters @ ``` -------------------------------- ### Clone the Bot Builder SDK Repository Source: https://github.com/microsoft/botbuilder-python/wiki/Building-the-SDK Clone the official Bot Builder SDK repository from GitHub. ```bash git clone https://github.com/Microsoft/botbuilder-python.git ``` -------------------------------- ### Login to Azure CLI Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/app/templates/core/{{cookiecutter.bot_name}}/deploymentTemplates/deployWithNewResourceGroup/readme.md Logs you into your Azure account. This command is a prerequisite for subsequent Azure CLI operations. ```bash az login ``` -------------------------------- ### Generate Bot with No Input and Default Options Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/README.md Run the generator in --no-input mode, using all the default command line options. ```bash # Run the generator using all default options cookiecutter https://github.com/microsoft/botbuilder-python/releases/download/Templates/echo.zip --no-input ``` -------------------------------- ### Generate Bot with No Input and All Options Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/README.md Run the generator in --no-input mode, setting all required options on the command line. ```bash # Run the generator, setting all command line options cookiecutter https://github.com/microsoft/botbuilder-python/releases/download/Templates/echo.zip --no-input project_name="test_bot" bot_description="Test description" ``` -------------------------------- ### Run Bot Locally Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/README.md Run the bot locally using the python app.py command. ```bash # run the bot python app.py ``` -------------------------------- ### LUIS Application Import Output Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/app/templates/core/{{cookiecutter.bot_name}}/README-LUIS.md This is the JSON output after successfully importing a LUIS application. The 'id' and 'activeVersion' are crucial for subsequent steps. ```json { "id": "########-####-####-####-############", "name": "FlightBooking", "description": "A LUIS model that uses intent and entities.", "culture": "en-us", "usageScenario": "", "domain": "", "versionsCount": 1, "createdDateTime": "2019-03-29T18:32:02Z", "endpoints": {}, "endpointHitsCount": 0, "activeVersion": "0.1", "ownerEmail": "bot@contoso.com", "tokenizerVersion": "1.0.0" } ``` -------------------------------- ### BotFramework Connector Generation Configuration Source: https://github.com/microsoft/botbuilder-python/blob/main/swagger/README.md Basic configuration for generating the BotFramework Connector SDK, specifying data-plane operations and credential inclusion. ```yaml add-credentials: true openapi-type: data-plane ``` -------------------------------- ### Instantiate BotFrameworkAdapter with Custom Claims Validator Source: https://github.com/microsoft/botbuilder-python/blob/main/doc/SkillClaimsValidation.md Configure `BotFrameworkAdapter` to use the custom `AllowedSkillsClaimsValidator` by passing its claims validator to `AuthenticationConfiguration`. ```python AUTH_CONFIG = AuthenticationConfiguration( claims_validator=AllowedSkillsClaimsValidator(CONFIG).claims_validator ) SETTINGS = BotFrameworkAdapterSettings( ..., auth_configuration=AUTH_CONFIG, ) ADAPTER = BotFrameworkAdapter( ..., SETTINGS, ) ``` -------------------------------- ### Configure Authentication for SingleTenant Bots Source: https://github.com/microsoft/botbuilder-python/blob/main/doc/SkillClaimsValidation.md For SingleTenant bots, specify the `tenant_id` in `AuthenticationConfiguration` along with the custom claims validator. ```python AUTH_CONFIG = AuthenticationConfiguration( claims_validator=AllowedSkillsClaimsValidator(CONFIG).claims_validator, tenant_id=the_tenant_id ) ``` -------------------------------- ### Train LUIS Application Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/app/templates/core/{{cookiecutter.bot_name}}/README-LUIS.md Trains the LUIS application. The --wait flag ensures the command waits for the training to complete before exiting. ```bash luis train version --region "LuisAppAuthoringRegion" --authoringKey "LuisAuthoringKey" --appId "LuisAppId" --versionId "LuisAppversion" --wait ``` -------------------------------- ### Run Unit Tests Source: https://github.com/microsoft/botbuilder-python/wiki/Building-the-SDK Execute the unit tests using pytest. ```bash pytest ``` -------------------------------- ### Token API 3.0 Input File Configuration Source: https://github.com/microsoft/botbuilder-python/blob/main/swagger/tokenAPI.md Specifies the OpenAPI input file for generating the Token API version 3.0. ```yaml input-file: TokenAPI.json ``` -------------------------------- ### Connector API 3.0 Input File Source: https://github.com/microsoft/botbuilder-python/blob/main/swagger/README.md Specifies the OpenAPI definition file for generating the Connector API v3.0. ```yaml input-file: ConnectorAPI.json ``` -------------------------------- ### Rebase and force push after suggested changes Source: https://github.com/microsoft/botbuilder-python/wiki/How-to-Contribute If changes are suggested for your pull request, rebase your branch interactively with master and force push to update your PR. ```shell git rebase master -i git push -f ``` -------------------------------- ### Push branch to GitHub Source: https://github.com/microsoft/botbuilder-python/wiki/How-to-Contribute Push your local feature branch to your GitHub repository to prepare for a pull request. ```shell git push origin my-fix-branch ``` -------------------------------- ### Python Settings for Token API 3.0 Generation Source: https://github.com/microsoft/botbuilder-python/blob/main/swagger/tokenAPI.md Python-specific Autorest settings for generating the BotFramework Token API client. These settings configure licensing, credential handling, namespace, package name, client name, and output folder. ```yaml python: license-header: MICROSOFT_MIT_NO_VERSION add-credentials: true payload-flattening-threshold: 2 namespace: botframework.tokenApi package-name: botframework-Token override-client-name: TokenApiClient clear-output-folder: true output-folder: ./tokenApi ``` -------------------------------- ### LUIS Application Publish Output Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/app/templates/core/{{cookiecutter.bot_name}}/README-LUIS.md This JSON output confirms the successful publishing of a LUIS application version. It includes the endpoint URL and assigned key. ```json { "versionId": "0.1", "isStaging": false, "endpointUrl": "https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/########-####-####-####-############", "region": "westus", "assignedEndpointKey": null, "endpointRegion": "westus", "failedRegions": "", "publishedDateTime": "2019-03-29T18:40:32Z", "directVersionPublish": false } ``` -------------------------------- ### Publish LUIS Application Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/app/templates/core/{{cookiecutter.bot_name}}/README-LUIS.md Publishes a specific version of the LUIS application to a specified endpoint region. Ensure you use the correct authoring and publish regions. ```bash luis publish version --region "LuisAppAuthoringRegion" --authoringKey "LuisAuthoringKey" --appId "LuisAppId" --versionId "LuisAppversion" --publishRegion "LuisAppPublishRegion" ``` -------------------------------- ### Create Azure Resource Group Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/app/templates/core/{{cookiecutter.bot_name}}/README-LUIS.md Creates a new resource group on Azure if one does not already exist. Specify your subscription, desired location, and resource group name. ```bash az group create --subscription "AzureSubscriptionGuid" --location "westus" --name "ResourceGroupName" ``` -------------------------------- ### Implement AllowedSkillsClaimsValidator Source: https://github.com/microsoft/botbuilder-python/blob/main/doc/SkillClaimsValidation.md This class validates claims and throws a `PermissionError` if the claims are identified as skill claims. It requires a configuration object to load allowed callers. ```python class AllowedSkillsClaimsValidator: config_key = "ALLOWED_CALLERS" def __init__(self, config: DefaultConfig): if not config: raise TypeError( "AllowedSkillsClaimsValidator: config object cannot be None." ) # ALLOWED_CALLERS is the setting in config.py file # that consists of the list of parent bot ids that are allowed to access the skill # to add a new parent bot simply go to the AllowedCallers and add # the parent bot's microsoft app id to the list caller_list = getattr(config, self.config_key) if caller_list is None: raise TypeError(f'"{self.config_key}" not found in configuration.') self._allowed_callers = caller_list @property def claims_validator(self) -> Callable[[List[Dict]], Awaitable]: async def allow_callers_claims_validator(claims: Dict[str, object]): if skillValidation.is_skill_claim(claims): raise PermissionError( "Invalid call from a skill." ) return return allow_callers_claims_validator ``` -------------------------------- ### Associate LUIS Resource with LUIS Application Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/app/templates/core/{{cookiecutter.bot_name}}/README-LUIS.md Uses the LUIS CLI to link your Azure LUIS resource to a specific LUIS application. Requires the path to your request body JSON, LUIS App ID, Authoring Key, and the Azure ARM token. ```bash luis add appazureaccount --in "path/to/created/requestBody.json" --appId "LuisAppId" --authoringKey "LuisAuthoringKey" --armToken "accessToken" ``` -------------------------------- ### LUIS Resource Configuration JSON Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/app/templates/core/{{cookiecutter.bot_name}}/README-LUIS.md A JSON file format required for configuring LUIS application associations. It includes subscription ID, resource group, and account name. ```json { "azureSubscriptionId": "00000000-0000-0000-0000-000000000000", "resourceGroup": "ResourceGroupName", "accountName": "NewLuisResourceName" } ``` -------------------------------- ### Create LUIS Cognitive Services Resource Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/app/templates/core/{{cookiecutter.bot_name}}/README-LUIS.md Provisions a new LUIS resource on Azure. Ensure you have a resource group and subscription ID. The SKU 'S0' is commonly used for LUIS. ```bash # Use Azure CLI to create the LUIS Key resource on Azure az cognitiveservices account create --kind "luis" --name "NewLuisResourceName" --sku "S0" --location "westus" --subscription "AzureSubscriptionGuid" -g "ResourceGroupName" ``` -------------------------------- ### Commit changes Source: https://github.com/microsoft/botbuilder-python/wiki/How-to-Contribute Commit your changes using a descriptive message. The -a option automatically stages edited files. ```shell git commit -a ``` -------------------------------- ### List LUIS Cognitive Services Keys Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/app/templates/core/{{cookiecutter.bot_name}}/README-LUIS.md Retrieves the primary and secondary keys for your LUIS Cognitive Services resource using the Azure CLI. These keys are essential for authenticating LUIS API requests. ```bash az cognitiveservices account keys list --name "NewLuisResourceName" --subscription "AzureSubscriptionGuid" -g "ResourceGroupName" ``` -------------------------------- ### Lint Compliant Code Check Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/README.md Use pylint to check if the generated bot code adheres to the project's pylint ruleset. ```bash # Assuming you created a project with the bot_name value 'my_chat_bot' pylint --rcfile=my_chat_bot/.pylintrc my_chat_bot ``` -------------------------------- ### Create a new feature branch Source: https://github.com/microsoft/botbuilder-python/wiki/How-to-Contribute When contributing code, create a new git branch from the master branch to isolate your changes. ```shell git checkout -b my-fix-branch master ``` -------------------------------- ### Update local master with upstream changes Source: https://github.com/microsoft/botbuilder-python/wiki/How-to-Contribute Synchronize your local master branch with the latest changes from the upstream repository. ```shell git pull --ff upstream master ``` -------------------------------- ### LUIS Association Success Response Source: https://github.com/microsoft/botbuilder-python/blob/main/generators/app/templates/core/{{cookiecutter.bot_name}}/README-LUIS.md Indicates a successful operation when associating a LUIS resource with a LUIS application via the LUIS CLI. ```json { "code": "Success", "message": "Operation Successful" } ``` -------------------------------- ### Checkout and delete local branch Source: https://github.com/microsoft/botbuilder-python/wiki/How-to-Contribute After merging, switch to the master branch and delete the local feature branch. ```shell git checkout master -f git branch -D my-fix-branch ``` -------------------------------- ### Delete remote branch on GitHub Source: https://github.com/microsoft/botbuilder-python/wiki/How-to-Contribute After your pull request is merged, delete the feature branch from your GitHub repository. ```shell git push origin --delete my-fix-branch ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.