8000 Merge branch 'master' into gabog/UpdateLabelTemplates · ToucanToco/botbuilder-python@e4cc566 · GitHub
[go: up one dir, main page]

Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e4cc566

Browse files
authored
Merge branch 'master' into gabog/UpdateLabelTemplates
2 parents c5c5a36 + e885962 commit e4cc566

27 files changed

+930
-119
lines changed

.github/CODEOWNERS

Lines changed: 75 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,81 @@
1111
# In each subsection folders are ordered first by depth, then alphabetically.
1212
# This should make it easy to add new rules without breaking existing ones.
1313

14-
# Bot Framework SDK notes:
15-
# The first code owners for a file or library are the primary approvers.
16-
# The later code owners represent a "escalation path" in case the primary code owners are unavailable.
17-
# - @microsoft/bb-python will also never receive a request for a PR review and should be manually requested
18-
# for PRs that only trigger the Global rule ("*")
19-
# - @microsoft/bf-admin should never receive a request for a PR review
20-
2114
# Global rule:
22-
* @microsoft/bb-python @microsoft/bf-admin
15+
* @microsoft/bb-python
16+
17+
# Functional tests
18+
/libraries/functional-tests/** @tracyboehrer
2319

2420
# Adapters
25-
/libraries/botbuilder-adapters-slack/** @garypretty @microsoft/bb-python @microsoft/bf-admin
26-
27-
# Platform Integration Libaries
28-
/libraries/botbuilder-integration-aiohttp/** @microsoft/bf-admin @axelsrz @tracyboehrer
29-
/libraries/botbuilder-integration-applicationinsights-aiohttp/** @microsoft/bf-admin @axelsrz @tracyboehrer
30-
31-
# BotBuilder libraries
32-
/libraries/botbuilder-ai/botbuilder/ai/luis/** @microsoft/bf-admi F438 n @bb-python @munozemilio
33-
/libraries/botbuilder-ai/botbuilder/ai/qna/** @microsoft/bf-admin @bb-python @johnataylor
34-
/libraries/botbuilder-applicationinsights/** @microsoft/bf-admin @bb-python @munozemilio
35-
/libraries/botbuilder-core/** @johnataylor @microsoft/bb-python @microsoft/bf-admin
36-
/libraries/botbuilder-core/botbuilder/core/teams/** @microsoft/bb-python @microsoft/bf-admin @microsoft/bf-teams
37-
/libraries/botbuilder-dialogs/** @johnataylor @microsoft/bb-python @microsoft/bf-admin
38-
/libraries/botframework-connector/** @microsoft/bf-admin @bb-python @johnataylor
39-
/libraries/botframework-connector/botframework/connector/auth/** @microsoft/bf-admin @bb-python @bf-auth
40-
/libraries/botbuilder-streaming/** @microsoft/bf-admin @microsoft/bf-streaming
21+
/libraries/botbuilder-adapters-slack/** @tracyboehrer @garypretty
22+
23+
# Platform Integration Libaries (aiohttp)
24+
/libraries/botbuilder-integration-aiohttp/** @microsoft/bb-python-integration
25+
/libraries/botbuilder-integration-applicationinsights-aiohttp/** @microsoft/bb-python-integration @garypretty
26+
27+
# Application Insights/Telemetry
28+
/libraries/botbuilder-applicationinsights/** @axelsrz @garypretty
29+
30+
# AI: LUIS + QnA Maker
31+
/libraries/botbuilder-ai/** @microsoft/bf-cog-services
32+
33+
# Azure (Storage)
34+
/libraries/botbuilder-azure/** @tracyboehrer @EricDahlvang
35+
36+
# Adaptive Dialogs
37+
/libraries/botbuilder-dialogs-*/** @tracyboehrer @microsoft/bf-adaptive
38+
39+
# AdaptiveExpressions & LanguageGeneration libraries
40+
/libraries/adaptive-expressions/** @axelsrz @microsoft/bf-adaptive
41+
/libraries/botbuilder-lg/** @axelsrz @microsoft/bf-adaptive
42+
43+
# BotBuilder Testing
44+
/libraries/botbuilder-testing/** @axelsrz @gabog
45+
46+
# Streaming library
47+
/libraries/botbuilder-streaming/** @microsoft/bf-streaming
48+
49+
# BotBuilder library
50+
/libraries/botbuilder-core/** @axelsrz @gabog @johnataylor
51+
52+
# BotBuilder Dialogs
53+
/libraries/botbuilder-dialogs/** @microsoft/bf-dialogs
54+
55+
# Swagger
56+
/libraries/swagger/** @axelsrz @EricDahlvang
57+
58+
# Bot Framework Schema
59+
/libraries/botbuilder-schema/** @EricDahlvang @johnataylor
60+
61+
# Bot Framework connector
62+
libraries\botframework-connector/** @axelsrz @carlosscastro @johnataylor
63+
64+
# Bot Framework Authentication
65+
/libraries/botbuilder-core/botbuilder/core/oauth/** @microsoft/bf-auth
66+
/libraries/botframework-connector/botframework/connector/auth/** @microsoft/bf-auth
67+
68+
# Bot Framework Skills
69+
/libraries/botbuilder-core/botbuilder/core/skills/** @microsoft/bf-skills
70+
/libraries/botbuilder-integration-aiohttp/botbuilder/integration/aiohttp/skills/** @microsoft/bf-skills
71+
/tests/skills/** @microsoft/bf-skills
72+
73+
# Bot Framework & Microsoft Teams
74+
/libraries/botbuilder-core/botbuilder/core/teams/** @microsoft/bf-teams
75+
/libraries/botbuilder-schema/botbuilder/schema/teams/** @microsoft/bf-teams
76+
/tests/teams/** @microsoft/bf-teams
77+
78+
# Ownership by specific files or file types
79+
# This section MUST stay at the bottom of the CODEOWNERS file. For more information, see
80+
# https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#example-of-a-codeowners-file
81+
82+
# Shipped package files
83+
# e.g. READMEs, requirements.txt, setup.py, MANIFEST.in
84+
/libraries/**/README.rst @microsoft/bb-python
85+
/libraries/**/requirements.txt @microsoft/bb-python
86+
/libraries/**/setup.py @microsoft/bb-python
87+
/libraries/**/setup.cfg @microsoft/bb-python
88+
/libraries/**/MANIFEST.in @microsoft/bb-python
89+
90+
# CODEOWNERS
91+
/.github/CODEOWNERS @stevengum @cleemullins @microsoft/bb-python

README.md

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
### [What's new with Bot Framework](https://docs.microsoft.com/en-us/azure/bot-service/what-is-new?view=azure-bot-service-4.0)
44

5-
This repository contains code for the Python version of the [Microsoft Bot Framework SDK](https://github.com/Microsoft/botframework-sdk), which is part of the Microsoft Bot Framework - a comprehensive framework for building enterprise-grade conversational AI experiences.
5+
This repository contains code for the Python version of the [Microsoft Bot Framework SDK](https://github.com/Microsoft/botframework-sdk), which is part of the Microsoft Bot Framework - a comprehensive framework for building enterprise-grade conversational AI experiences.
66

77
This SDK enables developers to model conversation and build sophisticated bot applications using Python. SDKs for [JavaScript](https://github.com/Microsoft/botbuilder-js), [.NET](https://github.com/Microsoft/botbuilder-dotnet) and [Java (preview)](https://github.com/Microsoft/botbuilder-java) are also available.
88

@@ -21,7 +21,7 @@ For more information jump to a section below.
2121

2222
| Branch | Description | Build Status | Coverage Status | Code Style |
2323
|----|---------------|--------------|-----------------|--|
24-
| Master | 4.10.* Preview Builds | [![Build Status](https://fuselabs.visualstudio.com/SDK_v4/_apis/build/status/Python/Python-CI-PR-yaml?branchName=master)](https://fuselabs.visualstudio.com/SDK_v4/_build/latest?definitionId=771&branchName=master) | [![Coverage Status](https://coveralls.io/repos/github/microsoft/botbuilder-python/badge.svg?branch=HEAD)](https://coveralls.io/github/microsoft/botbuilder-python?branch=HEAD) | [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) |
24+
| Master | 4.11.* Preview Builds | [![Build Status](https://fuselabs.visualstudio.com/SDK_v4/_apis/build/status/Python/Python-CI-PR-yaml?branchName=master)](https://fuselabs.visualstudio.com/SDK_v4/_build/latest?definitionId=771&branchName=master) | [![Coverage Status](https://coveralls.io/repos/github/microsoft/botbuilder-python/badge.svg?branch=HEAD)](https://coveralls.io/github/microsoft/botbuilder-python?branch=HEAD) | [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) |
2525

2626
## Packages
2727

@@ -40,13 +40,13 @@ To get started building bots using the SDK, see the [Azure Bot Service Documenta
4040

4141
The [Bot Framework Samples](https://github.com/microsoft/botbuilder-samples) includes a rich set of samples repository.
4242

43-
If you want to debug an issue, would like to [contribute](#contributing), or understand how the Bot Builder SDK works, instructions for building and testing the SDK are below.
43+
If you want to debug an issue, would like to [contribute](#contributing-code), or understand how the Bot Builder SDK works, instructions for building and testing the SDK are below.
4444

4545
### Prerequisites
4646
- [Git](https://git-scm.com/downloads)
4747
- [Python 3.8.2](https://www.python.org/downloads/)
4848

49-
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](https://packaging.python.org/tutorials/installing-packages/#creating-virtual-environments) to learn more about creating _and activating_ Virtual Environments in Python.
49+
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](https://packaging.python.org/tutorials/installing-packages/#creating-virtual-environments) to learn more about creating _and activating_ Virtual Environments in Python.
5050

5151
### Clone
5252
Clone a copy of the repo:
@@ -60,12 +60,7 @@ cd botbuilder-python
6060

6161
### Using the SDK locally
6262

63-
You will need the following 3 packages installed in your environment:
64-
- [botframework-connector](https://pypi.org/project/botframework-connector/)
65-
- [botbuilder-core](https://pypi.org/project/botbuilder-core/)
66-
- [botbuilder-schema](https://pypi.org/project/botbuilder-schema/)
67-
68-
To use a local copy of the SDK you can link to these packages with the pip -e option.
63+
To use a local copy of the SDK you can link to these packages with the pip -e option.
6964

7065
```bash
7166
pip install -e ./libraries/botbuilder-schema
@@ -108,12 +103,12 @@ plugins: cov-2.5.1
108103
Below are the various channels that are available to you for obtaining support and providing feedback. Please pay carful attention to which channel should be used for which type of content. e.g. general "how do I..." questions should be asked on Stack Overflow, Twitter or Gitter, with GitHub issues being for feature requests and bug reports.
109104

110105
### Github issues
111-
[Github issues](https://github.com/Microsoft/botbuilder-python/issues) should be used for bugs and feature requests.
106+
[Github issues](https://github.com/Microsoft/botbuilder-python/issues) should be used for bugs and feature requests.
112107

113108
### Stack overflow
114109
[Stack Overflow](https://stackoverflow.com/questions/tagged/botframework) is a great place for getting high-quality answers. Our support team, as well as many of our community members are already on Stack Overflow providing answers to 'how-to' questions.
115110

116-
### Azure Support
111+
### Azure Support
117112
If you issues relates to [Azure Bot Service](https://azure.microsoft.com/en-gb/services/bot-service/), you can take advantage of the available [Azure support options](https://azure.microsoft.com/en-us/support/options/).
118113

119114
### Twitter
@@ -125,19 +120,29 @@ The [Gitter Channel](https://gitter.im/Microsoft/BotBuilder) provides a place wh
125120
## Contributing and our code of conduct
126121
We welcome contributions and suggestions. Please see our [contributing guidelines](./contributing.md) for more information.
127122

128-
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
123+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
124+
129125
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact
130126
[opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
131127

128+
### Contributing Code
129+
130+
In order to create pull requests, submitted code must pass ```pylint``` and ```black``` checks. Run both tools on every file you've changed.
131+
132+
For more information and installation instructions, see:
133+
134+
* [black](https://pypi.org/project/black/)
135+
* [pylint](https://pylint.org/)
136+
132137
## Reporting Security Issues
133-
Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC)
138+
Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC)
134139
at [secure@ 10000 microsoft.com](mailto:secure@microsoft.com). You should receive a response within 24 hours. If for some
135-
reason you do not, please follow up via email to ensure we received your original message. Further information,
136-
including the [MSRC PGP](https://technet.microsoft.com/en-us/security/dn606155) key, can be found in the
140+
reason you do not, please follow up via email to ensure we received your original message. Further information,
141+
including the [MSRC PGP](https://technet.microsoft.com/en-us/security/dn606155) key, can be found in the
137142
[Security TechCenter](https://technet.microsoft.com/en-us/security/default).
138143

139144
Copyright (c) Microsoft Corporation. All rights reserved.
140145

141-
Licensed under the [MIT](./LICENSE.md) License.
146+
Licensed under the [MIT](./LICENSE) License.
142147

143148

libraries/botbuilder-applicationinsights/botbuilder/applicationinsights/processor/telemetry_processor.py

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
3+
import base64
34
import json
45
from abc import ABC, abstractmethod
6+
from _sha256 import sha256
57

68

79
class TelemetryProcessor(ABC):
@@ -11,8 +13,9 @@ class TelemetryProcessor(ABC):
1113
def activity_json(self) -> json:
1214
"""Retrieve the request body as json (Activity)."""
1315
body_text = self.get_request_body()
14-
body = json.loads(body_text) if body_text is not None else None
15-
return body
16+
if body_text:
17+
return body_text if isinstance(body_text, dict) else json.loads(body_text)
18+
return None
1619

1720
@abstractmethod
1821
def can_process(self) -> bool:
@@ -67,15 +70,34 @@ def __call__(self, data, context) -> bool:
6770
conversation = (
6871
post_data["conversation"] if "conversation" in post_data else None
6972
)
70-
conversation_id = conversation["id"] if "id" in conversation else None
73+
74+< 10000 /span>
session_id = ""
75+
if "id" in conversation:
76+
conversation_id = conversation["id"]
77+
session_id = base64.b64encode(
78+
sha256(conversation_id.encode("utf-8")).digest()
79+
).decode()
80+
81+
# Set the user id on the Application Insights telemetry item.
7182
context.user.id = channel_id + user_id
72-
context.session.id = conversation_id
7383

74-
# Additional bot-specific properties
84+
# Set the session id on the Application Insights telemetry item.
85+
# Hashed ID is used due to max session ID length for App Insights session Id
86+
context.session.id = session_id
87+
88+
# Set the activity id:
89+
# https://github.com/Microsoft/botframework-obi/blob/master/botframework-activity/botframework-activity.md#id
7590
if "id" in post_data:
7691
data.properties["activityId"] = post_data["id"]
92+
93+
# Set the channel id:
94+
# https://github.com/Microsoft/botframework-obi/blob/master/botframework-activity/botframework-activity.md#channel-id
7795
if "channelId" in post_data:
7896
data.properties["channelId"] = post_data["channelId"]
97+
98+
# Set the activity type:
99+
# https://github.com/Microsoft/botframework-obi/blob/master/botframework-activity/botframework-activity.md#type
79100
if "type" in post_data:
80101
data.properties["activityType"] = post_data["type"]
102+
81103
return True

libraries/botbuilder-azure/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from setuptools import setup
66

77
REQUIRES = [
8-
"azure-cosmos==3.1.2",
8+
"azure-cosmos==3.2.0",
99
"azure-storage-blob==2.1.0",
1010
"botbuilder-schema==4.10.0",
1111
"botframework-connector==4.10.0",

libraries/botbuilder-core/botbuilder/core/activity_handler.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ async def on_turn(self, turn_context: TurnContext):
8686
await self.on_end_of_conversation_activity(turn_context)
8787
elif turn_context.activity.type == ActivityTypes.typing:
8888
await self.on_typing_activity(turn_context)
89+
elif turn_context.activity.type == ActivityTypes.installation_update:
90+
await self.on_installation_update(turn_context)
8991
else:
9092
await self.on_unrecognized_activity_type(turn_context)
9193

@@ -365,6 +367,19 @@ async def on_typing_activity( # pylint: disable=unused-argument
365367
"""
366368
return
367369

370+
async def on_installation_update( # pylint: disable=unused-argument
371+
self, turn_context: TurnContext
372+
):
373+
"""
374+
Override this in a derived class to provide logic specific to
375+
ActivityTypes.InstallationUpdate activities.
376+
377+
:param turn_context: The context object for this turn
378+
:type turn_context: :class:`botbuilder.core.TurnContext`
379+
:returns: A task that represents the work queued to execute
380+
"""
381+
return
382+
368383
async def on_unrecognized_activity_type( # pylint: disable=unused-argument
369384
self, turn_context: TurnContext
370385
):

0 commit comments

Comments
 (0)
0