Repository: BotBuilderCommunity/botbuilder-community-python (language: python)

Issue:
Working PR for fixing CI/CD
Working to resolve pipeline issues.


Discussion / hints:

Fix patch:
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 890a113..bccd558 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -21,6 +21,8 @@ steps:
 - script: |
     python -m pip install --upgrade pip
     pip install -e ./libraries/botbuilder-community-dialogs-prompts
+    pip install -e ./libraries/botbuilder-community-middleware-activity-type
+    pip install -e ./libraries/botbuilder-community-middleware-text-recognizer    
     pip install pytest pytest-azurepipelines
     pip install coveralls
     pip install pylint
diff --git a/libraries/botbuilder-community-middleware-activity-type/README.md b/libraries/botbuilder-community-middleware-activity-type/README.md
new file mode 100644
index 0000000..8b53de7
--- /dev/null
+++ b/libraries/botbuilder-community-middleware-activity-type/README.md
@@ -0,0 +1,20 @@
+# Activity Type Middleware
+
+This middleware package is a Python port of the [C# Activity Type middleware component](https://github.com/BotBuilderCommunity/botbuilder-community-dotnet/tree/develop/libraries/Bot.Builder.Community.Middleware.HandleActivityType) from the Bot Builder Community. It intercepts messages based on the activity type so that you can automatically handle certain types outside of the standard dialog flow.
+
+## Installing
+
+    Coming Soon
+
+## Usage
+
+```python
+
+from activity_type_middleware import ActivityTypeMiddleware;
+
+	async def turn_adapter_callback(turn_context:TurnContext):
+          await turn_context.send_activity("Hey activity Middlware") 
+
+activity_adapter.use(ActivityTypeMiddleware(ActivityTypes.message,turn_adapter_callback))
+
+```
diff --git a/libraries/botbuilder-community-middleware-activity-type/botbuilder/community/middleware/activity/type/__init__.py b/libraries/botbuilder-community-middleware-activity-type/botbuilder/community/middleware/activity/type/__init__.py
new file mode 100644
index 0000000..54e1b79
--- /dev/null
+++ b/libraries/botbuilder-community-middleware-activity-type/botbuilder/community/middleware/activity/type/__init__.py
@@ -0,0 +1,7 @@
+from .about import __version__
+from .activity_type_middleware import ActivityTypeMiddleware
+
+__all__ = [
+    "ActivityTypeMiddleware",
+    "__version__"  
+    ]
\ No newline at end of file
diff --git a/libraries/botbuilder-community-middleware-activity-type/botbuilder/community/middleware/activity/type/about.py b/libraries/botbuilder-community-middleware-activity-type/botbuilder/community/middleware/activity/type/about.py
new file mode 100644
index 0000000..b065f63
--- /dev/null
+++ b/libraries/botbuilder-community-middleware-activity-type/botbuilder/community/middleware/activity/type/about.py
@@ -0,0 +1,11 @@
+import os
+
+__title__ = "botbuilder-community-middleware-activity-type"
+__version__ = (
+    os.environ["packageVersion"] if "packageVersion" in os.environ else "0.1.0"
+)
+__uri__ = "https://github.com/BotBuilderCommunity/botbuilder-community-python"
+__author__ = "Bot Builder Community"
+__description__ = "Microsoft Bot Builder Community Middleware activity type"
+__summary__ = "Bot Framework middleware component to handle incoming activities based on a specific activity type"
+__license__ = "MIT"
\ No newline at end of file
diff --git a/libraries/botbuilder-community-middleware-activity-type/botbuilder/community/middleware/activity/type/activity_type_middleware.py b/libraries/botbuilder-community-middleware-activity-type/botbuilder/community/middleware/activity/type/activity_type_middleware.py
new file mode 100644
index 0000000..5e24a92
--- /dev/null
+++ b/libraries/botbuilder-community-middleware-activity-type/botbuilder/community/middleware/activity/type/activity_type_middleware.py
@@ -0,0 +1,18 @@
+from botbuilder.core import Middleware,TurnContext
+from botbuilder.schema import Activity,ActivityTypes
+from typing import Awaitable,Callable
+
+class ActivityTypeMiddleware(Middleware):
+    def __init__(self,
+        activitytype:ActivityTypes,
+        callback):
+        self._activitytype = activitytype
+        self._callback = callback
+
+    async def on_turn(self,
+            context:TurnContext,
+            next:Callable[[TurnContext],Awaitable]):
+            if self._activitytype == context.activity.type:
+                await self._callback(context)
+            await next()
+
diff --git a/libraries/botbuilder-community-middleware-activity-type/requirements.txt b/libraries/botbuilder-community-middleware-activity-type/requirements.txt
new file mode 100644
index 0000000..4d172be
--- /dev/null
+++ b/libraries/botbuilder-community-middleware-activity-type/requirements.txt
@@ -0,0 +1,4 @@
+aiounittest>=1.3.0
+botbuilder-core>=4.5.0b5
+botbuilder-schema>=4.5.0b5
+recognizers_text_suite>=1.0.2a2
\ No newline at end of file
diff --git a/libraries/botbuilder-community-middleware-activity-type/setup.py b/libraries/botbuilder-community-middleware-activity-type/setup.py
new file mode 100644
index 0000000..a7abc40
--- /dev/null
+++ b/libraries/botbuilder-community-middleware-activity-type/setup.py
@@ -0,0 +1,47 @@
+import os
+from setuptools import setup
+
+REQUIRES = [
+"botbuilder-core>=4.5.0b5",
+"botbuilder-schema>=4.5.0b5",
+"recognizers_text_suite>=1.0.2a2",
+"aiounittest>=1.3.0"
+]
+
+TESTS_REQUIRES = ["aiounittest>=1.3.0"]
+
+root = os.path.abspath(os.path.dirname(__file__))
+
+with open(os.path.join(root, "botbuilder", "community", "middleware", "activity","type", "about.py")) as f:
+    package_info = {}
+    info = f.read()
+    exec(info, package_info)
+
+with open(os.path.join(root, "README.md"), encoding="utf-8") as f:
+    long_description = f.read()
+
+setup(
+    name=package_info["__title__"],
+    version=package_info["__version__"],
+    url=package_info["__uri__"],
+    author=package_info["__author__"],
+    description=package_info["__description__"],
+    keywords="botbuilder bots ai botframework middleware activity type",
+    long_description=long_description,
+    long_description_content_type="text/markdown",
+    license=package_info["__license__"],
+    packages=[
+        "botbuilder.community.middleware.activity.type",
+    ],
+    install_requires=REQUIRES + TESTS_REQUIRES,
+    tests_require=TESTS_REQUIRES,
+    include_package_data=True,
+    classifiers=[
+        "Programming Language :: Python :: 3.7",
+        "Intended Audience :: Developers",
+        "License :: OSI Approved :: MIT License",
+        "Operating System :: OS Independent",
+        "Development Status :: 3 - Alpha",
+        "Topic :: Scientific/Engineering :: Artificial Intelligence",
+    ],
+)
\ No newline at end of file
diff --git a/libraries/botbuilder-community-middleware-text-recognizer/setup.py b/libraries/botbuilder-community-middleware-text-recognizer/setup.py
index ffe2e7a..08298f3 100644
--- a/libraries/botbuilder-community-middleware-text-recognizer/setup.py
+++ b/libraries/botbuilder-community-middleware-text-recognizer/setup.py
@@ -26,12 +26,12 @@
     url=package_info["__uri__"],
     author=package_info["__author__"],
     description=package_info["__description__"],
-    keywords="botbuilder bots ai botframework middleware text-recognizer",
+    keywords="botbuilder bots ai botframework middleware text recognizer",
     long_description=long_description,
     long_description_content_type="text/markdown",
     license=package_info["__license__"],
     packages=[
-        "botbuilder-community-middleware-text-recognizer",
+        "botbuilder.community.middleware.text.recognizer",
     ],
     install_requires=REQUIRES + TESTS_REQUIRES,
     tests_require=TESTS_REQUIRES,


Test patch:
diff --git a/libraries/botbuilder-community-middleware-activity-type/test/test_activity_type_middleware.py b/libraries/botbuilder-community-middleware-activity-type/test/test_activity_type_middleware.py
new file mode 100644
index 0000000..53f3ce6
--- /dev/null
+++ b/libraries/botbuilder-community-middleware-activity-type/test/test_activity_type_middleware.py
@@ -0,0 +1,30 @@
+import asyncio
+import pathlib
+import sys
+import aiounittest
+import pytest
+
+current = pathlib.Path(__file__).parent.parent
+libpath = current.joinpath("botbuilder").joinpath("community").joinpath("middleware").joinpath("activity").joinpath("type")
+sys.path.append(str(libpath))
+
+
+from botbuilder.core import MessageFactory, TurnContext
+from botbuilder.core.adapters import TestAdapter
+from botbuilder.schema import ActivityTypes
+from activity_type_middleware import ActivityTypeMiddleware
+
+class TestActivityMiddleware(aiounittest.AsyncTestCase):
+    async def test_adapter_middleware(self):
+
+        async def turn_adapter_callback(turn_context:TurnContext):
+              await turn_context.send_activity("Hey activity Middlware")      
+
+        async def exec_test(turn_context:TurnContext):
+                await turn_context.send_activity("Test activity Middleware")   
+
+        activity_adapter = TestAdapter(exec_test)
+        activity_adapter.use(ActivityTypeMiddleware(ActivityTypes.message,turn_adapter_callback))
+        await activity_adapter.test('Hello, activity type bot!', 'Hey activity Middlware')
+
+    
\ No newline at end of file