From 94eb40e00fd7f043eb219a992d36b5bf6083c297 Mon Sep 17 00:00:00 2001 From: Hugo Slepicka Date: Fri, 19 Aug 2022 15:35:20 -0700 Subject: [PATCH 1/5] WIP: Adding new method script. --- cookiecutter.json | 2 +- hooks/post_gen_project.py | 31 +++++++++--- .../script_build.bat | 1 + .../script_build.sh | 3 ++ .../requirements.txt | 3 ++ .../scriptbot.py | 48 +++++++++++++++++++ 6 files changed, 81 insertions(+), 7 deletions(-) create mode 100755 {{ cookiecutter.bot_id.replace(' ', '_') }}/script_build.bat create mode 100755 {{ cookiecutter.bot_id.replace(' ', '_') }}/script_build.sh create mode 100644 {{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/requirements.txt create mode 100644 {{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/scriptbot.py diff --git a/cookiecutter.json b/cookiecutter.json index c37df86..2d65026 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -1,5 +1,5 @@ { - "project_type": ["Desktop", "Web", "Both", "Custom"], + "project_type": ["Desktop", "Web", "Both", "Custom", "Script"], "bot_id": "botPython", "project_name": "Python Bot", "project_short_description": "Python package for a BotCity bot." diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 11e374b..7b95fe7 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -1,12 +1,15 @@ import os +import shutil project_type = "{{cookiecutter.project_type | lower}}" +bot_id = "{{ cookiecutter.bot_id|replace(' ', '_') }}" proj_files = { - "desktop": {"remove": ["webbot.py", "bothbot.py", "custombot.py"], "use": None}, - "web": {"remove": ["bot.py", "bothbot.py", "custombot.py"], "use": "webbot.py"}, - "both": {"remove": ["bot.py", "webbot.py", "custombot.py"], "use": "bothbot.py"}, - "custom": {"remove": ["bot.py", "webbot.py", "bothbot.py"], "use": "custombot.py"} + "desktop": {"remove": ["webbot.py", "bothbot.py", "custombot.py", "scriptbot.py", "requirements.txt"], "use": None}, + "web": {"remove": ["bot.py", "bothbot.py", "custombot.py", "scriptbot.py", "requirements.txt"], "use": "webbot.py"}, + "both": {"remove": ["bot.py", "webbot.py", "custombot.py", "scriptbot.py", "requirements.txt"], "use": "bothbot.py"}, + "custom": {"remove": ["bot.py", "webbot.py", "bothbot.py", "scriptbot.py", "requirements.txt"], "use": "custombot.py"}, + "script": {"remove": ["__init__.py", "__main__.py", "bot.py", "bothbot.py", "webbot.py", "custombot.py"], "use": "scriptbot.py"} } config = proj_files.get(project_type) @@ -15,7 +18,23 @@ raise ValueError(f"Invalid project type: {project_type}") for f in config["remove"]: - os.remove(os.path.join("{{cookiecutter.bot_id}}", f)) + os.remove(os.path.join(bot_id, f)) if config["use"]: - os.rename(os.path.join("{{cookiecutter.bot_id}}", config["use"]), os.path.join("{{cookiecutter.bot_id}}", "bot.py")) + os.rename(os.path.join(bot_id, config["use"]), os.path.join(bot_id, "bot.py")) + +if project_type == "script": + root_files = [ + "MANIFEST.in", + "setup.py", + "VERSION", + "requirements.txt" + ] + + for f in root_files: + os.remove(f) + os.rename("script_build.sh", "build.sh") + os.rename("script_build.bat", "build.bat") +else: + os.remove("script_build.sh") + os.remove("script_build.bat") diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/script_build.bat b/{{ cookiecutter.bot_id.replace(' ', '_') }}/script_build.bat new file mode 100755 index 0000000..98e8760 --- /dev/null +++ b/{{ cookiecutter.bot_id.replace(' ', '_') }}/script_build.bat @@ -0,0 +1 @@ +powershell Compress-Archive -LiteralPath "{{ cookiecutter.bot_id|replace(' ', '_') }}" -DestinationPath "{{ cookiecutter.bot_id|replace(' ', '_') }}.zip" diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/script_build.sh b/{{ cookiecutter.bot_id.replace(' ', '_') }}/script_build.sh new file mode 100755 index 0000000..3d36e64 --- /dev/null +++ b/{{ cookiecutter.bot_id.replace(' ', '_') }}/script_build.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +zip -r "{{ cookiecutter.bot_id|replace(' ', '_') }}.zip" "{{ cookiecutter.bot_id|replace(' ', '_') }}"/* \ No newline at end of file diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/requirements.txt b/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/requirements.txt new file mode 100644 index 0000000..14bca17 --- /dev/null +++ b/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/requirements.txt @@ -0,0 +1,3 @@ +# botcity-framework-core +# botcity-framework-web +# botcity-maestro-sdk \ No newline at end of file diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/scriptbot.py b/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/scriptbot.py new file mode 100644 index 0000000..4e9c0e8 --- /dev/null +++ b/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/scriptbot.py @@ -0,0 +1,48 @@ +""" +This is a template for a custom script bot. + +Make sure to add your dependencies to the requirements.txt file. +""" + +""" +Example Desktop Bot +""" +# from botcity.core import DesktopBot +# bot = DesktopBot() + +# if not bot.find( "visual_element", matching=0.97, waiting_time=60000): +# print("visual_element was not found") +# bot.click_relative(20, -35) + + +""" +Example Web Bot +""" +# from botcity.web import WebBot, Browser, By +# webbot = WebBot() +# # Configure whether or not to run on headless mode +# webbot.headless = False + +# # Uncomment to change the default Browser to Firefox +# # webbot.browser = Browser.FIREFOX + +# # Uncomment to set the WebDriver path +# # webbot.driver_path = "" + +# # Opens the BotCity website. +# webbot.browse("https://www.botcity.dev") + +# # Stop the browser and clean up +# webbot.stop_browser() + + +""" +BotCity Maestro Integration +""" +# from botcity.maestro import * + +# # Instantiate BotCity Maestro SDK +# maestro = BotMaestroSDK() +# # Login with BotCity Maestro using workspace credentials +# maestro.login(server="", login="", key="") + From cb5538d47a08b0e471524a621bac52d8664f15b3 Mon Sep 17 00:00:00 2001 From: Hugo Slepicka Date: Sun, 11 Dec 2022 17:39:41 -0600 Subject: [PATCH 2/5] ENH: Switching from class based to scripts for Python. --- cookiecutter.json | 2 +- hooks/post_gen_project.py | 30 ++----- hooks/pre_gen_project.py | 12 --- .../MANIFEST.in | 11 --- .../README.md | 4 - .../VERSION | 1 - .../bot.py | 54 +++++++++++++ .../bothbot.py | 76 ++++++++++++++++++ .../build.bat | 3 +- .../build.ps1 | 2 + .../build.sh | 2 +- .../custombot.py | 36 +++++---- .../requirements.txt | 10 ++- .../resources/start.png | Bin .../script_build.bat | 1 - .../script_build.sh | 3 - .../setup.py | 37 --------- .../webbot.py | 68 ++++++++++++++++ .../__init__.py | 0 .../__main__.py | 5 -- .../bot.py | 50 ------------ .../bothbot.py | 73 ----------------- .../requirements.txt | 3 - .../scriptbot.py | 48 ----------- .../webbot.py | 65 --------------- 25 files changed, 235 insertions(+), 361 deletions(-) delete mode 100644 hooks/pre_gen_project.py delete mode 100644 {{ cookiecutter.bot_id.replace(' ', '_') }}/MANIFEST.in delete mode 100644 {{ cookiecutter.bot_id.replace(' ', '_') }}/README.md delete mode 100644 {{ cookiecutter.bot_id.replace(' ', '_') }}/VERSION create mode 100644 {{ cookiecutter.bot_id.replace(' ', '_') }}/bot.py create mode 100644 {{ cookiecutter.bot_id.replace(' ', '_') }}/bothbot.py create mode 100644 {{ cookiecutter.bot_id.replace(' ', '_') }}/build.ps1 rename {{ cookiecutter.bot_id.replace(' ', '_') }}/{{{ cookiecutter.bot_id.replace(' ', '_') }} => }/custombot.py (50%) rename {{ cookiecutter.bot_id.replace(' ', '_') }}/{{{ cookiecutter.bot_id.replace(' ', '_') }} => }/resources/start.png (100%) delete mode 100755 {{ cookiecutter.bot_id.replace(' ', '_') }}/script_build.bat delete mode 100755 {{ cookiecutter.bot_id.replace(' ', '_') }}/script_build.sh delete mode 100644 {{ cookiecutter.bot_id.replace(' ', '_') }}/setup.py create mode 100644 {{ cookiecutter.bot_id.replace(' ', '_') }}/webbot.py delete mode 100644 {{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/__init__.py delete mode 100644 {{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/__main__.py delete mode 100644 {{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/bot.py delete mode 100644 {{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/bothbot.py delete mode 100644 {{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/requirements.txt delete mode 100644 {{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/scriptbot.py delete mode 100644 {{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/webbot.py diff --git a/cookiecutter.json b/cookiecutter.json index 2d65026..c37df86 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -1,5 +1,5 @@ { - "project_type": ["Desktop", "Web", "Both", "Custom", "Script"], + "project_type": ["Desktop", "Web", "Both", "Custom"], "bot_id": "botPython", "project_name": "Python Bot", "project_short_description": "Python package for a BotCity bot." diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 7b95fe7..4e9156c 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -1,15 +1,13 @@ import os -import shutil project_type = "{{cookiecutter.project_type | lower}}" bot_id = "{{ cookiecutter.bot_id|replace(' ', '_') }}" proj_files = { - "desktop": {"remove": ["webbot.py", "bothbot.py", "custombot.py", "scriptbot.py", "requirements.txt"], "use": None}, - "web": {"remove": ["bot.py", "bothbot.py", "custombot.py", "scriptbot.py", "requirements.txt"], "use": "webbot.py"}, - "both": {"remove": ["bot.py", "webbot.py", "custombot.py", "scriptbot.py", "requirements.txt"], "use": "bothbot.py"}, - "custom": {"remove": ["bot.py", "webbot.py", "bothbot.py", "scriptbot.py", "requirements.txt"], "use": "custombot.py"}, - "script": {"remove": ["__init__.py", "__main__.py", "bot.py", "bothbot.py", "webbot.py", "custombot.py"], "use": "scriptbot.py"} + "desktop": {"remove": ["webbot.py", "bothbot.py", "custombot.py"], "use": None}, + "web": {"remove": ["bot.py", "bothbot.py", "custombot.py"], "use": "webbot.py"}, + "both": {"remove": ["bot.py", "webbot.py", "custombot.py"], "use": "bothbot.py"}, + "custom": {"remove": ["bot.py", "webbot.py", "bothbot.py"], "use": "custombot.py"} } config = proj_files.get(project_type) @@ -18,23 +16,7 @@ raise ValueError(f"Invalid project type: {project_type}") for f in config["remove"]: - os.remove(os.path.join(bot_id, f)) + os.remove(f) if config["use"]: - os.rename(os.path.join(bot_id, config["use"]), os.path.join(bot_id, "bot.py")) - -if project_type == "script": - root_files = [ - "MANIFEST.in", - "setup.py", - "VERSION", - "requirements.txt" - ] - - for f in root_files: - os.remove(f) - os.rename("script_build.sh", "build.sh") - os.rename("script_build.bat", "build.bat") -else: - os.remove("script_build.sh") - os.remove("script_build.bat") + os.rename(config["use"], "bot.py") diff --git a/hooks/pre_gen_project.py b/hooks/pre_gen_project.py deleted file mode 100644 index 06e0a64..0000000 --- a/hooks/pre_gen_project.py +++ /dev/null @@ -1,12 +0,0 @@ -import re -import sys - -bot_id = '{{ cookiecutter.bot_id }}' - -pattern = re.compile("^[a-z|A-Z]+[a-z|A-Z|_]*[a-z|A-Z]$") - -if not pattern.match(bot_id): - print('ERROR: bot_id can only contain letters [a-z or A-Z], underscore (_) and must end with a letter [a-z or A-Z].') - - # exits with status 1 to indicate failure - sys.exit(1) \ No newline at end of file diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/MANIFEST.in b/{{ cookiecutter.bot_id.replace(' ', '_') }}/MANIFEST.in deleted file mode 100644 index 20b602a..0000000 --- a/{{ cookiecutter.bot_id.replace(' ', '_') }}/MANIFEST.in +++ /dev/null @@ -1,11 +0,0 @@ -include README.rst -include VERSION -include requirements.txt - -recursive-exclude * __pycache__ -recursive-exclude * *.py[co] - -recursive-include {{ cookiecutter.bot_id|replace(' ', '_') }}/resources * - -# If including data files in the package, add them like: -# include path/to/data_file diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/README.md b/{{ cookiecutter.bot_id.replace(' ', '_') }}/README.md deleted file mode 100644 index b2e1afb..0000000 --- a/{{ cookiecutter.bot_id.replace(' ', '_') }}/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# {{ cookiecutter.project_name }} - -{{ cookiecutter.project_short_description}} - diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/VERSION b/{{ cookiecutter.bot_id.replace(' ', '_') }}/VERSION deleted file mode 100644 index 9f8e9b6..0000000 --- a/{{ cookiecutter.bot_id.replace(' ', '_') }}/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.0 \ No newline at end of file diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/bot.py b/{{ cookiecutter.bot_id.replace(' ', '_') }}/bot.py new file mode 100644 index 0000000..4682474 --- /dev/null +++ b/{{ cookiecutter.bot_id.replace(' ', '_') }}/bot.py @@ -0,0 +1,54 @@ +""" +WARNING: + +Please make sure you install the bot with `pip install -e .` in order to get all the dependencies +on your Python environment. + +Also, if you are using PyCharm or another IDE, make sure that you use the SAME Python interpreter +as your IDE. + +If you get an error like: +``` +ModuleNotFoundError: No module named 'botcity' +``` + +This means that you are likely using a different Python interpreter than the one used to install the bot. +To fix this, you can either: +- Use the same interpreter as your IDE and install your bot with `pip install -e .` +- Use the same interpreter as the one used to install the bot (`pip install -e .`) + +Please refer to the documentation for more information at https://documentation.botcity.dev/ +""" + +# Import for the Desktop Bot +from botcity.core import DesktopBot + +# Import for integration with BotCity Maestro SDK +from botcity.maestro import * + +# Disable errors if we are not connected to Maestro +BotMaestroSDK.RAISE_NOT_CONNECTED = False + +def main(): + # Runner passes the server url, the id of the task being executed, + # the access token and the parameters that this task receives (when applicable). + maestro = BotMaestroSDK.from_sys_args() + ## Fetch the BotExecution with details from the task, including parameters + execution = maestro.get_execution() + + bot = DesktopBot() + bot.browse("http://www.botcity.dev") + + # Uncomment to mark this task as finished on BotMaestro + # maestro.finish_task( + # task_id=execution.task_id, + # status=AutomationTaskFinishStatus.SUCCESS, + # message="Task Finished OK." + # ) + +def not_found(label): + print(f"Element not found: {label}") + + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/bothbot.py b/{{ cookiecutter.bot_id.replace(' ', '_') }}/bothbot.py new file mode 100644 index 0000000..e6cba86 --- /dev/null +++ b/{{ cookiecutter.bot_id.replace(' ', '_') }}/bothbot.py @@ -0,0 +1,76 @@ +""" +WARNING: + +Please make sure you install the bot with `pip install -e .` in order to get all the dependencies +on your Python environment. + +Also, if you are using PyCharm or another IDE, make sure that you use the SAME Python interpreter +as your IDE. + +If you get an error like: +``` +ModuleNotFoundError: No module named 'botcity' +``` + +This means that you are likely using a different Python interpreter than the one used to install the bot. +To fix this, you can either: +- Use the same interpreter as your IDE and install your bot with `pip install -e .` +- Use the same interpreter as the one used to install the bot (`pip install -e .`) + +Please refer to the documentation for more information at https://documentation.botcity.dev/ +""" + + +# Import for the Desktop Bot +from botcity.core import DesktopBot + +# Import for the Web Bot +from botcity.web import WebBot, Browser, By + +# Import for integration with BotCity Maestro SDK +from botcity.maestro import * + +# Disable errors if we are not connected to Maestro +BotMaestroSDK.RAISE_NOT_CONNECTED = False + +def main(): + # Runner passes the server url, the id of the task being executed, + # the access token and the parameters that this task receives (when applicable). + maestro = BotMaestroSDK.from_sys_args() + ## Fetch the BotExecution with details from the task, including parameters + execution = maestro.get_execution() + + desktop_bot = DesktopBot() + + # Execute operations with the DesktopBot as desired + # desktop_bot.control_a() + # desktop_bot.control_c() + # value = desktop_bot.get_clipboard() + + webbot = WebBot() + + # Configure whether or not to run on headless mode + webbot.headless = False + + # Uncomment to change the default Browser to Firefox + # webbot.browser = Browser.FIREFOX + + # Uncomment to set the WebDriver path + # webbot.driver_path = "" + + # Opens the BotCity website. + webbot.browse("https://www.botcity.dev") + + # Uncomment to mark this task as finished on BotMaestro + # maestro.finish_task( + # task_id=execution.task_id, + # status=AutomationTaskFinishStatus.SUCCESS, + # message="Task Finished OK." + # ) + +def not_found(label): + print(f"Element not found: {label}") + + +if __name__ == '__main__': + main() diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/build.bat b/{{ cookiecutter.bot_id.replace(' ', '_') }}/build.bat index 302aff9..a5b9f39 100755 --- a/{{ cookiecutter.bot_id.replace(' ', '_') }}/build.bat +++ b/{{ cookiecutter.bot_id.replace(' ', '_') }}/build.bat @@ -1 +1,2 @@ -call python setup.py sdist +@ECHO OFF +Powershell.exe -executionpolicy bypass -File build.ps1 \ No newline at end of file diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/build.ps1 b/{{ cookiecutter.bot_id.replace(' ', '_') }}/build.ps1 new file mode 100644 index 0000000..551f536 --- /dev/null +++ b/{{ cookiecutter.bot_id.replace(' ', '_') }}/build.ps1 @@ -0,0 +1,2 @@ +Get-ChildItem -Path . -Recurse -Exclude "{{ cookiecutter.bot_id|replace(' ', '_') }}.zip" | + Compress-Archive -DestinationPath "{{ cookiecutter.bot_id|replace(' ', '_') }}.zip" -Force \ No newline at end of file diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/build.sh b/{{ cookiecutter.bot_id.replace(' ', '_') }}/build.sh index 3d43210..db63954 100755 --- a/{{ cookiecutter.bot_id.replace(' ', '_') }}/build.sh +++ b/{{ cookiecutter.bot_id.replace(' ', '_') }}/build.sh @@ -1,3 +1,3 @@ #!/bin/bash -python setup.py sdist +zip -r "{{ cookiecutter.bot_id|replace(' ', '_') }}.zip" * -x "{{ cookiecutter.bot_id|replace(' ', '_') }}.zip" \ No newline at end of file diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/custombot.py b/{{ cookiecutter.bot_id.replace(' ', '_') }}/custombot.py similarity index 50% rename from {{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/custombot.py rename to {{ cookiecutter.bot_id.replace(' ', '_') }}/custombot.py index 16292ac..6b2d08b 100644 --- a/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/custombot.py +++ b/{{ cookiecutter.bot_id.replace(' ', '_') }}/custombot.py @@ -20,27 +20,29 @@ Please refer to the documentation for more information at https://documentation.botcity.dev/ """ -from botcity.base import BaseBot -# Uncomment the line below for integrations with BotMaestro -# Using the Maestro SDK -# from botcity.maestro import * +# Import for integration with BotCity Maestro SDK +from botcity.maestro import * +# Disable errors if we are not connected to Maestro +BotMaestroSDK.RAISE_NOT_CONNECTED = False -class Bot(BaseBot): - def action(self, execution=None): - # Fetch the Activity ID from the task: - # task = self.maestro.get_task(execution.task_id) - # activity_id = task.activity_id - ... +def main(): + # Runner passes the server url, the id of the task being executed, + # the access token and the parameters that this task receives (when applicable). + maestro = BotMaestroSDK.from_sys_args() + ## Fetch the BotExecution with details from the task, including parameters + execution = maestro.get_execution() - # Uncomment to mark this task as finished on BotMaestro - # self.maestro.finish_task( - # task_id=execution.task_id, - # status=AutomationTaskFinishStatus.SUCCESS, - # message="Task Finished OK." - # ) + ... + + # Uncomment to mark this task as finished on BotMaestro + # maestro.finish_task( + # task_id=execution.task_id, + # status=AutomationTaskFinishStatus.SUCCESS, + # message="Task Finished OK." + # ) if __name__ == '__main__': - Bot.main() + main() diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/requirements.txt b/{{ cookiecutter.bot_id.replace(' ', '_') }}/requirements.txt index 68a0a5a..98ac599 100644 --- a/{{ cookiecutter.bot_id.replace(' ', '_') }}/requirements.txt +++ b/{{ cookiecutter.bot_id.replace(' ', '_') }}/requirements.txt @@ -5,11 +5,13 @@ botcity-framework-web>=0.5.2,<1.0 {%- elif cookiecutter.project_type == "Both" -%} botcity-framework-core>=0.2.9,<1.0 botcity-framework-web>=0.5.2,<1.0 -{%- elif cookiecutter.project_type == "Custom" -%} -botcity-framework-base {% endif %} botcity-maestro-sdk>=0.1.5,<1.0 # Uncomment to use botcity-utils -#botcity-utils>=0.1.2 +# botcity-utils>=0.1.2 + # Uncomment to use botcity-crawler-plugin -#botcity-crawler-plugin +# botcity-crawler-plugin + +# Uncomment to use Pandas +# pandas \ No newline at end of file diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/resources/start.png b/{{ cookiecutter.bot_id.replace(' ', '_') }}/resources/start.png similarity index 100% rename from {{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/resources/start.png rename to {{ cookiecutter.bot_id.replace(' ', '_') }}/resources/start.png diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/script_build.bat b/{{ cookiecutter.bot_id.replace(' ', '_') }}/script_build.bat deleted file mode 100755 index 98e8760..0000000 --- a/{{ cookiecutter.bot_id.replace(' ', '_') }}/script_build.bat +++ /dev/null @@ -1 +0,0 @@ -powershell Compress-Archive -LiteralPath "{{ cookiecutter.bot_id|replace(' ', '_') }}" -DestinationPath "{{ cookiecutter.bot_id|replace(' ', '_') }}.zip" diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/script_build.sh b/{{ cookiecutter.bot_id.replace(' ', '_') }}/script_build.sh deleted file mode 100755 index 3d36e64..0000000 --- a/{{ cookiecutter.bot_id.replace(' ', '_') }}/script_build.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -zip -r "{{ cookiecutter.bot_id|replace(' ', '_') }}.zip" "{{ cookiecutter.bot_id|replace(' ', '_') }}"/* \ No newline at end of file diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/setup.py b/{{ cookiecutter.bot_id.replace(' ', '_') }}/setup.py deleted file mode 100644 index 34f30f4..0000000 --- a/{{ cookiecutter.bot_id.replace(' ', '_') }}/setup.py +++ /dev/null @@ -1,37 +0,0 @@ -from os import path -from setuptools import setup, find_packages - - -here = path.abspath(path.dirname(__file__)) - -with open(path.join(here, 'README.md'), encoding='utf-8') as readme_file: - readme = readme_file.read() - - -with open(path.join(here, 'VERSION'), encoding='utf-8') as version_file: - version = version_file.read() - -with open(path.join(here, 'requirements.txt')) as requirements_file: - # Parse requirements.txt, ignoring any commented-out lines. - requirements = [line for line in requirements_file.read().splitlines() - if not line.startswith('#')] - - -setup( - name="{{ cookiecutter.bot_id|replace(' ', '_') }}", - version=version, - description="{{ cookiecutter.project_short_description }}", - long_description=readme, - long_description_content_type='text/markdown', - packages=find_packages(exclude=['docs', 'tests']), - include_package_data=True, - package_data={ - "{{ cookiecutter.bot_id|replace(' ', '_') }}": [ - # When adding files here, remember to update MANIFEST.in as well, - # or else they will not be included in the distribution on PyPI! - # 'path/to/data_file', - 'resources', - ] - }, - install_requires=requirements, -) diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/webbot.py b/{{ cookiecutter.bot_id.replace(' ', '_') }}/webbot.py new file mode 100644 index 0000000..1f737fb --- /dev/null +++ b/{{ cookiecutter.bot_id.replace(' ', '_') }}/webbot.py @@ -0,0 +1,68 @@ +""" +WARNING: + +Please make sure you install the bot with `pip install -e .` in order to get all the dependencies +on your Python environment. + +Also, if you are using PyCharm or another IDE, make sure that you use the SAME Python interpreter +as your IDE. + +If you get an error like: +``` +ModuleNotFoundError: No module named 'botcity' +``` + +This means that you are likely using a different Python interpreter than the one used to install the bot. +To fix this, you can either: +- Use the same interpreter as your IDE and install your bot with `pip install -e .` +- Use the same interpreter as the one used to install the bot (`pip install -e .`) + +Please refer to the documentation for more information at https://documentation.botcity.dev/ +""" + + +# Import for the Web Bot +from botcity.web import WebBot, Browser, By + +# Import for integration with BotCity Maestro SDK +from botcity.maestro import * + +# Disable errors if we are not connected to Maestro +BotMaestroSDK.RAISE_NOT_CONNECTED = False + + +def main(): + # Runner passes the server url, the id of the task being executed, + # the access token and the parameters that this task receives (when applicable). + maestro = BotMaestroSDK.from_sys_args() + ## Fetch the BotExecution with details from the task, including parameters + execution = maestro.get_execution() + + bot = WebBot() + + # Configure whether or not to run on headless mode + bot.headless = False + + # Uncomment to change the default Browser to Firefox + # bot.browser = Browser.FIREFOX + + # Uncomment to set the WebDriver path + # bot.driver_path = "" + + # Opens the BotCity website. + bot.browse("https://www.botcity.dev") + + # Uncomment to mark this task as finished on BotMaestro + # maestro.finish_task( + # task_id=execution.task_id, + # status=AutomationTaskFinishStatus.SUCCESS, + # message="Task Finished OK." + # ) + + +def not_found(label): + print(f"Element not found: {label}") + + +if __name__ == '__main__': + main() diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/__init__.py b/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/__main__.py b/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/__main__.py deleted file mode 100644 index 128d422..0000000 --- a/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/__main__.py +++ /dev/null @@ -1,5 +0,0 @@ -from botcity.base.utils import find_bot_class -from . import bot - -klass = find_bot_class(bot)[0] -klass.main() diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/bot.py b/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/bot.py deleted file mode 100644 index 261859c..0000000 --- a/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/bot.py +++ /dev/null @@ -1,50 +0,0 @@ -""" -WARNING: - -Please make sure you install the bot with `pip install -e .` in order to get all the dependencies -on your Python environment. - -Also, if you are using PyCharm or another IDE, make sure that you use the SAME Python interpreter -as your IDE. - -If you get an error like: -``` -ModuleNotFoundError: No module named 'botcity' -``` - -This means that you are likely using a different Python interpreter than the one used to install the bot. -To fix this, you can either: -- Use the same interpreter as your IDE and install your bot with `pip install -e .` -- Use the same interpreter as the one used to install the bot (`pip install -e .`) - -Please refer to the documentation for more information at https://documentation.botcity.dev/ -""" - -from botcity.core import DesktopBot -# Uncomment the line below for integrations with BotMaestro -# Using the Maestro SDK -# from botcity.maestro import * - - -class Bot(DesktopBot): - def action(self, execution=None): - # Fetch the Activity ID from the task: - # task = self.maestro.get_task(execution.task_id) - # activity_id = task.activity_id - - # Opens the BotCity website. - self.browse("http://www.botcity.dev") - - # Uncomment to mark this task as finished on BotMaestro - # self.maestro.finish_task( - # task_id=execution.task_id, - # status=AutomationTaskFinishStatus.SUCCESS, - # message="Task Finished OK." - # ) - - def not_found(self, label): - print(f"Element not found: {label}") - - -if __name__ == '__main__': - Bot.main() diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/bothbot.py b/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/bothbot.py deleted file mode 100644 index 7c416c6..0000000 --- a/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/bothbot.py +++ /dev/null @@ -1,73 +0,0 @@ -""" -WARNING: - -Please make sure you install the bot with `pip install -e .` in order to get all the dependencies -on your Python environment. - -Also, if you are using PyCharm or another IDE, make sure that you use the SAME Python interpreter -as your IDE. - -If you get an error like: -``` -ModuleNotFoundError: No module named 'botcity' -``` - -This means that you are likely using a different Python interpreter than the one used to install the bot. -To fix this, you can either: -- Use the same interpreter as your IDE and install your bot with `pip install -e .` -- Use the same interpreter as the one used to install the bot (`pip install -e .`) - -Please refer to the documentation for more information at https://documentation.botcity.dev/ -""" - -from botcity.web import WebBot, Browser -from botcity.core import DesktopBot -# Uncomment the line below for integrations with BotMaestro -# Using the Maestro SDK -# from botcity.maestro import * - - -class Bot(WebBot): - def action(self, execution=None): - # Configure whether or not to run on headless mode - self.headless = False - - # Instantiate a DesktopBot - desktop_bot = DesktopBot() - # Execute operations with the DesktopBot as desired - # desktop_bot.control_a() - # desktop_bot.control_c() - # desktop_bot.get_clipboard() - - # Uncomment to change the default Browser to Firefox - # self.browser = Browser.FIREFOX - - # Uncomment to set the WebDriver path - # self.driver_path = "" - - # Fetch the Activity ID from the task: - # task = self.maestro.get_task(execution.task_id) - # activity_id = task.activity_id - - # Opens the BotCity website. - self.browse("https://www.botcity.dev") - - # Uncomment to mark this task as finished on BotMaestro - # self.maestro.finish_task( - # task_id=execution.task_id, - # status=AutomationTaskFinishStatus.SUCCESS, - # message="Task Finished OK." - # ) - - # Wait for 10 seconds before closing - self.wait(10000) - - # Stop the browser and clean up - self.stop_browser() - - def not_found(self, label): - print(f"Element not found: {label}") - - -if __name__ == '__main__': - Bot.main() diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/requirements.txt b/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/requirements.txt deleted file mode 100644 index 14bca17..0000000 --- a/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -# botcity-framework-core -# botcity-framework-web -# botcity-maestro-sdk \ No newline at end of file diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/scriptbot.py b/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/scriptbot.py deleted file mode 100644 index 4e9c0e8..0000000 --- a/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/scriptbot.py +++ /dev/null @@ -1,48 +0,0 @@ -""" -This is a template for a custom script bot. - -Make sure to add your dependencies to the requirements.txt file. -""" - -""" -Example Desktop Bot -""" -# from botcity.core import DesktopBot -# bot = DesktopBot() - -# if not bot.find( "visual_element", matching=0.97, waiting_time=60000): -# print("visual_element was not found") -# bot.click_relative(20, -35) - - -""" -Example Web Bot -""" -# from botcity.web import WebBot, Browser, By -# webbot = WebBot() -# # Configure whether or not to run on headless mode -# webbot.headless = False - -# # Uncomment to change the default Browser to Firefox -# # webbot.browser = Browser.FIREFOX - -# # Uncomment to set the WebDriver path -# # webbot.driver_path = "" - -# # Opens the BotCity website. -# webbot.browse("https://www.botcity.dev") - -# # Stop the browser and clean up -# webbot.stop_browser() - - -""" -BotCity Maestro Integration -""" -# from botcity.maestro import * - -# # Instantiate BotCity Maestro SDK -# maestro = BotMaestroSDK() -# # Login with BotCity Maestro using workspace credentials -# maestro.login(server="", login="", key="") - diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/webbot.py b/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/webbot.py deleted file mode 100644 index 7e04dfb..0000000 --- a/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}/webbot.py +++ /dev/null @@ -1,65 +0,0 @@ -""" -WARNING: - -Please make sure you install the bot with `pip install -e .` in order to get all the dependencies -on your Python environment. - -Also, if you are using PyCharm or another IDE, make sure that you use the SAME Python interpreter -as your IDE. - -If you get an error like: -``` -ModuleNotFoundError: No module named 'botcity' -``` - -This means that you are likely using a different Python interpreter than the one used to install the bot. -To fix this, you can either: -- Use the same interpreter as your IDE and install your bot with `pip install -e .` -- Use the same interpreter as the one used to install the bot (`pip install -e .`) - -Please refer to the documentation for more information at https://documentation.botcity.dev/ -""" - -from botcity.web import WebBot, Browser -# Uncomment the line below for integrations with BotMaestro -# Using the Maestro SDK -# from botcity.maestro import * - - -class Bot(WebBot): - def action(self, execution=None): - # Configure whether or not to run on headless mode - self.headless = False - - # Uncomment to change the default Browser to Firefox - # self.browser = Browser.FIREFOX - - # Uncomment to set the WebDriver path - # self.driver_path = "" - - # Fetch the Activity ID from the task: - # task = self.maestro.get_task(execution.task_id) - # activity_id = task.activity_id - - # Opens the BotCity website. - self.browse("https://www.botcity.dev") - - # Uncomment to mark this task as finished on BotMaestro - # self.maestro.finish_task( - # task_id=execution.task_id, - # status=AutomationTaskFinishStatus.SUCCESS, - # message="Task Finished OK." - # ) - - # Wait for 10 seconds before closing - self.wait(10000) - - # Stop the browser and clean up - self.stop_browser() - - def not_found(self, label): - print(f"Element not found: {label}") - - -if __name__ == '__main__': - Bot.main() From 21769714644fd13e64a84937e890b3ca003912e9 Mon Sep 17 00:00:00 2001 From: Hugo Slepicka Date: Sun, 11 Dec 2022 19:18:10 -0600 Subject: [PATCH 3/5] FIX: Adjust botproj. MNT: Remove docs and workflow. --- .github/workflows/gh-pages.yml | 38 ------- README.md | 8 +- cookiecutter.json | 4 +- docs-requirements.txt | 5 - docs/assets/favicon.ico | Bin 4286 -> 0 bytes docs/assets/logo.png | Bin 4956 -> 0 bytes docs/building.md | 43 ------- docs/creating.md | 25 ---- docs/index.md | 10 -- docs/next.md | 12 -- docs/project.md | 107 ------------------ docs/running.md | 46 -------- mkdocs.yml | 71 ------------ ...cutter.bot_id.replace(' ', '_') }}.botproj | 2 +- 14 files changed, 3 insertions(+), 368 deletions(-) delete mode 100644 .github/workflows/gh-pages.yml delete mode 100644 docs-requirements.txt delete mode 100644 docs/assets/favicon.ico delete mode 100644 docs/assets/logo.png delete mode 100644 docs/building.md delete mode 100644 docs/creating.md delete mode 100644 docs/index.md delete mode 100644 docs/next.md delete mode 100644 docs/project.md delete mode 100644 docs/running.md delete mode 100644 mkdocs.yml diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml deleted file mode 100644 index 8ed8e50..0000000 --- a/.github/workflows/gh-pages.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Publish Documentation - -on: - push: - pull_request: - branches: - - '**' - -jobs: - deploy: - if: ${{ github.repository == 'botcity-dev/bot-python-template' }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest] - python-version: [3.7] - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - sudo apt install python3-testresources - pip install -U setuptools wheel - pip install -U -r docs-requirements.txt - - name: Build Docs - run: | - mkdocs build - - name: Deploy to gh-pages - uses: peaceiris/actions-gh-pages@v3 - if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags') - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./site/ diff --git a/README.md b/README.md index d20faa4..f7cd296 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@

Template Bot Project - Python

- « Explore Project docs »

Report bug @@ -21,7 +20,7 @@ # Getting Started -This repository contains a cookiecutter template for generating a Bot using +This repository contains a cookiecutter template for generating a Bot using BotCity's Python Framework. To create a templated project all you need to do is: @@ -43,8 +42,3 @@ mkdocs build This will generate the HTML documentation in the `<>/site` folder. Look for the `index.html` file and open it with your browser. - -# Online Documentation - -More information about cookiecutter and how to organize your Bot project can be found -at https://botcity-dev.github.io/bot-python-template/. diff --git a/cookiecutter.json b/cookiecutter.json index c37df86..d2da37f 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -1,6 +1,4 @@ { "project_type": ["Desktop", "Web", "Both", "Custom"], - "bot_id": "botPython", - "project_name": "Python Bot", - "project_short_description": "Python package for a BotCity bot." + "bot_id": "botPython" } diff --git a/docs-requirements.txt b/docs-requirements.txt deleted file mode 100644 index 4794cd4..0000000 --- a/docs-requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -mkdocs -mkdocstrings -mkdocs-material -livereload -pygments \ No newline at end of file diff --git a/docs/assets/favicon.ico b/docs/assets/favicon.ico deleted file mode 100644 index 1645eec3248a1142764b713c6e51722307bb0577..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4286 zcmeH@u?@p83Y;Cuo$yzS_(u4TH1HD|7 z?%m_OsAbI=QTMB+&(E5UeM_%yOG{17ubv2qfCz|y2>d$%YmZN!u6>@CXa3%sr>vDt B?ZW^7 diff --git a/docs/assets/logo.png b/docs/assets/logo.png deleted file mode 100644 index 516117df11e461153352c9ca0b72ac3d0d6c16e3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4956 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 diff --git a/docs/building.md b/docs/building.md deleted file mode 100644 index 9c05379..0000000 --- a/docs/building.md +++ /dev/null @@ -1,43 +0,0 @@ -# Building the Package - -Since the bot is a python package, it is recommended to generate a source distribution. - -For that we provide build scripts (`build.bat` and `build.bat`) which just do the following: - -```shell -python setup.py sdist -``` - -This process will generate a `dist` folder with the compressed project source code. - - -# Installing - -After that is done you can install the package generated with: - -```shell -pip install dist/botPython-1.0.tar.gz # or .zip if running on Windows -``` - -Or simply using the following command: - -```shell -pip install -e . -``` - -!!! tip - If you are using the BotCity Maestro server, the BotRunner will take care of installing - your package into a virtual environment for execution in your automation machine. - All you need to do is use the BotCLI command line interface to deploy and release your - package. - - ```shell - # For deploy: - java -jar botCLI.jar bot deploy -botId "botPython" -version 1.0 -file "./dist/botPython-1.0.tar.gz" -python - - # For update of an existing version file: - java -jar botCLI.jar bot update -botId "botPython" -version 1.0 -file "./dist/botPython-1.0.tar.gz" -python - - # For release: - java -jar botCLI.jar bot release -botId "botPython" -version 1.0 - ``` diff --git a/docs/creating.md b/docs/creating.md deleted file mode 100644 index 0bf1558..0000000 --- a/docs/creating.md +++ /dev/null @@ -1,25 +0,0 @@ -# Creating a new Project using Cookiecutter - -```bash -python -m cookiecutter https://github.com/botcity-dev/bot-python-template/archive/main.zip -``` - -When running this command you will be prompted for the following information: - -!!! warning inline end - **bot_id** value **must** match the Bot label configured on BotMaestro if using the integration. - -- **project_type**: This will define which bot template is generated. - The options are **Desktop**, **Web**, **Both** or **Custom**. - - Select **Desktop** for general Desktop or non-headless Web automations. - - Select **Web** if your automation involve only websites. - - Select **Both** if your automation involves a mix. - - Select **Custom** if you would like to add your own libraries or create an automation using only BotCity plugins. - -- **bot_id**: This will be the name of your Python module. It can only contain letters (a-z or A-Z), underscore (_) and must end with a letter (a-z or A-Z). - -- **project_name**: This is the name of the project. You can pick any name you would like. - -- **project_short_description**: This is a short description of the bot. - -Over the next chapter we will explore the package and guide you on the most common operations to be executed. \ No newline at end of file diff --git a/docs/index.md b/docs/index.md deleted file mode 100644 index bd666e5..0000000 --- a/docs/index.md +++ /dev/null @@ -1,10 +0,0 @@ -# Dependencies - -This project assumes that you have [Python](https://www.python.org/) and [pip](https://pip.pypa.io/en/stable/) installed. - -## Cookiecutter - -Here is how to install cookiecutter: -```bash -python -m pip install --upgrade cookiecutter -``` diff --git a/docs/next.md b/docs/next.md deleted file mode 100644 index ce0e395..0000000 --- a/docs/next.md +++ /dev/null @@ -1,12 +0,0 @@ -# Next Steps - -Congratulations! By now you should have created your first bot and executed it a couple of times. - -If you do have questions or suggestions feel free to reach out via one of the following channels: - -- [BotCity Community](http://community.botcity.dev/) -- [BotCity Core Framework - Python](https://github.com/botcity-dev/botcity-framework-core-python) -- [BotCity Web Framework - Python](https://github.com/botcity-dev/botcity-framework-web-python) -- [BotCity Template Project - Python](https://github.com/botcity-dev/bot-python-template) - -Have fun automating! \ No newline at end of file diff --git a/docs/project.md b/docs/project.md deleted file mode 100644 index 0fd6880..0000000 --- a/docs/project.md +++ /dev/null @@ -1,107 +0,0 @@ -# Exploring the project - -If you execute the cookiecutter command above and select the default values, you will end up -with the following structure: -``` - botPython - ├── MANIFEST.in <- This file defines the content of the package such as images. - ├── README.md <- Simple README file for your bot project. - ├── VERSION <- This file defines the Bot package version. - ├── botPython <- Main module for your Bot package. - │   ├── __init__.py - │   ├── __main__.py <- Entrypoint for the module. You don't need to bother with this file. - │   ├── bot.py <- Module for your bot code. Here is where you will develop your bot. - │   └── resources <- Folder containing resources useful for the Bot. - ├── build.bat <- Batch script to generate the package - ├── build.sh <- Shell script to generate the package - ├── requirements.txt <- File describing the python dependencies for your Bot. - └── setup.py <- Setup file for the package. -``` - -The main files to be modified are: - -- **bot.py**: Change this file and add here the code for your bot. - -- **resources**: Add into this folder files to be used with your bot such as images, spreadsheets and etc. - -- **VERSION**: Change the content of this file when updating the version of your bot. -It is recommended to use versions in the format X.Y. E.g. 1.0, 1.1, 2.5, 3.10. - -## Resources - -By default this project is configured to add into the package all files and subfolders that -are added under the `resources` folder. - -The bot base class offers an utility method to handle files taking into consideration the package path. -Please refer to the BotCity Framework documentation under the Bot API for the `get_resource_abspath` method. - -Here is an example: - -```python -class Bot(DesktopBot): - def action(self, execution): - # Add the resource start.png. - # Note the self.get_resource_abspath call to handle - # the package path - self.add_image("start", self.get_resource_abspath("start.png")) -``` - -!!! warning - If adding **new** resource folders parallel to the existing `resources` folder, - make sure to change the `MANIFEST.in` file and also add the folder name - under `package_data` at `setup.py`. - -## Additional Dependencies - -If you need to add additional Python packages for use with your bot project, make sure to add them into the `requirements.txt`. - -This is required for the BotRunner to be able to install and run your bot. - -## Bot Code - -This template project contains a skeleton class under `bot.py` with an initial example -which opens up the browser with the BotCity website. - -Depending on your selection of the Project Type, the template will either use as base class the `DesktopBot` or `WebBot`. -In both cases, the base class contains all the functions of the BotCity Python Core Framework -as methods so please keep in mind to use `self.` when invoking the methods. - -### Example of a Desktop Bot skeleton: -```python -class Bot(DesktopBot): - def action(self, execution): - # using browse from browser module - self.browse(...) - # using find from display module - self.find(...) - # using mouse_move from mouse module - self.mouse_move(x=100, y=200) - # using enter from keyboard module - self.enter() -``` - -### Example of a Web Bot skeleton: -```python -class Bot(WebBot): - def action(self, execution): - # Configure whether or not to run on headless mode - self.headless = False - - # using browse from browser module - self.browse(...) - # using find from display module - self.find(...) - # using mouse_move from mouse module - self.mouse_move(x=100, y=200) - # using enter from keyboard module - self.enter() - - # Stop the browser and clean up - self.stop_browser() - -``` - - -!!! warning - In case you use a different module for your main bot (instead of the default `bot.py`), - make sure to change the `__main__.py` file to load the proper module. diff --git a/docs/running.md b/docs/running.md deleted file mode 100644 index b819d71..0000000 --- a/docs/running.md +++ /dev/null @@ -1,46 +0,0 @@ -# Running Your Code - -This chapter will cover a couple different ways in which you can run your code for testing -and production. - -## Installing dependencies - -Before running for the first time we need to install the dependencies required by the project. -From the project main folder, execute the following command on the command line: -```bash -python -m pip install -e . -``` - -This will install your package on development mode and also take care of installing the dependencies. -After that you are ready to proceed and run your code. - -## Direct execution via IDE or Command Line - -The `bot.py` file inside of the package has special code which invokes the `main` method -on the bot class. This allow for direct execution of the bot via your favorite IDE or the -command line. -```python -if __name__ == '__main__': - Bot.main() -``` - -Here is how to start the code via the command line. -```shell -python bot.py -``` - -## Using the Module Entry Point - -The package has a module entry point `__main__.py` which imports the `bot.py` module and -dynamically identify the Bot class for execution. - -To start your bot via the entry point do: - -```shell -# Assuming your bot_id used during creation of the package -# is botPython. Adjust as needed for your case. -python -m botPython -``` - -!!! note - This is the method used by the BotCity BotRunner when using the Bot Maestro orchestration. diff --git a/mkdocs.yml b/mkdocs.yml deleted file mode 100644 index b8a5d1f..0000000 --- a/mkdocs.yml +++ /dev/null @@ -1,71 +0,0 @@ -site_name: Template Bot Project - Python -repo_url: https://github.com/botcity-dev/bot-python-template -repo_name: "" -copyright: BotCity © - All rights reserved - -nav: - - Home: index.md - - Creating a Bot: creating.md - - Exploring the Project: project.md - - Building the Package: building.md - - Running your Code: running.md - - Next Steps: next.md - -theme: - icon: - repo: fontawesome/brands/github - name: material - favicon: assets/favicon.ico - logo: assets/logo.png - features: - - navigation.top - palette: - - media: "(prefers-color-scheme: light)" - scheme: default - primary: white - toggle: - icon: material/toggle-switch-off-outline - name: Switch to dark mode - - media: "(prefers-color-scheme: dark)" - scheme: slate - primary: black - toggle: - icon: material/toggle-switch - name: Switch to light mode - -extra: - generator: false - social: - - icon: fontawesome/brands/github - link: https://github.com/botcity-dev/bot-python-template - name: BotCity Maestro SDK - Python -> GitHub - - icon: fontawesome/brands/twitter - link: https://twitter.com/botcitydev - name: BotCity on Twitter - analytics: - provider: google - property: UA-203228041-1 - -markdown_extensions: - - attr_list - - admonition - - pymdownx.highlight - - pymdownx.superfences - -plugins: - - search - - mkdocstrings: - default_handler: python - watch: - - botcity/maestro - handlers: - python: - selection: - inherited_members: false - filters: - - "!^_" # exclude all members starting with _ - - "^__init__$" # but always include __init__ modules and methods - - "!([a-z])*([A-Z])" # exclude camelCase elements - rendering: - show_source: false - show_root_heading: true diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}.botproj b/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}.botproj index ab6f6d1..15bc65c 100644 --- a/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}.botproj +++ b/{{ cookiecutter.bot_id.replace(' ', '_') }}/{{ cookiecutter.bot_id.replace(' ', '_') }}.botproj @@ -1 +1 @@ -{"name":"{{ cookiecutter.bot_id.replace(' ', '_') }}","sourceDirPath":"/{{ cookiecutter.bot_id.replace(' ', '_') }}/","resourceDirPath":"/{{ cookiecutter.bot_id.replace(' ', '_') }}/resources/","sourceDirRelative":true,"resourceDirRelative":true} \ No newline at end of file +{"name":"{{ cookiecutter.bot_id.replace(' ', '_') }}","sourceDirPath":"/","resourceDirPath":"/resources/","sourceDirRelative":true,"resourceDirRelative":true} \ No newline at end of file From 681e0fb3bb0f931f8ab84ca17c8a1a11c775a5ca Mon Sep 17 00:00:00 2001 From: Hugo Slepicka Date: Mon, 12 Dec 2022 18:58:21 -0600 Subject: [PATCH 4/5] FIX: Use compress-archive for build.ps1. FIX: Make sure we call stop_browser for webbot examples. --- {{ cookiecutter.bot_id.replace(' ', '_') }}/bothbot.py | 8 ++++++++ {{ cookiecutter.bot_id.replace(' ', '_') }}/build.ps1 | 3 +-- {{ cookiecutter.bot_id.replace(' ', '_') }}/webbot.py | 8 ++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/bothbot.py b/{{ cookiecutter.bot_id.replace(' ', '_') }}/bothbot.py index e6cba86..5ef01b2 100644 --- a/{{ cookiecutter.bot_id.replace(' ', '_') }}/bothbot.py +++ b/{{ cookiecutter.bot_id.replace(' ', '_') }}/bothbot.py @@ -61,6 +61,14 @@ def main(): # Opens the BotCity website. webbot.browse("https://www.botcity.dev") + # Wait 3 seconds before closing + bot.wait(3000) + + # Finish and clean up the Web Browser + # You MUST invoke the stop_browser to avoid + # leaving instances of the webdriver open + webbot.stop_browser() + # Uncomment to mark this task as finished on BotMaestro # maestro.finish_task( # task_id=execution.task_id, diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/build.ps1 b/{{ cookiecutter.bot_id.replace(' ', '_') }}/build.ps1 index 551f536..6b65765 100644 --- a/{{ cookiecutter.bot_id.replace(' ', '_') }}/build.ps1 +++ b/{{ cookiecutter.bot_id.replace(' ', '_') }}/build.ps1 @@ -1,2 +1 @@ -Get-ChildItem -Path . -Recurse -Exclude "{{ cookiecutter.bot_id|replace(' ', '_') }}.zip" | - Compress-Archive -DestinationPath "{{ cookiecutter.bot_id|replace(' ', '_') }}.zip" -Force \ No newline at end of file +Compress-Archive -LiteralPath . -DestinationPath "{{ cookiecutter.bot_id|replace(' ', '_') }}.zip" -Force \ No newline at end of file diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/webbot.py b/{{ cookiecutter.bot_id.replace(' ', '_') }}/webbot.py index 1f737fb..ace4cf5 100644 --- a/{{ cookiecutter.bot_id.replace(' ', '_') }}/webbot.py +++ b/{{ cookiecutter.bot_id.replace(' ', '_') }}/webbot.py @@ -52,6 +52,14 @@ def main(): # Opens the BotCity website. bot.browse("https://www.botcity.dev") + # Wait 3 seconds before closing + bot.wait(3000) + + # Finish and clean up the Web Browser + # You MUST invoke the stop_browser to avoid + # leaving instances of the webdriver open + bot.stop_browser() + # Uncomment to mark this task as finished on BotMaestro # maestro.finish_task( # task_id=execution.task_id, From 3677524b1e2e17b3490e1c4362e1c94195cf4588 Mon Sep 17 00:00:00 2001 From: Hugo Slepicka Date: Wed, 1 Mar 2023 20:35:33 -0800 Subject: [PATCH 5/5] ENH: Add some helpers and useful print information. --- {{ cookiecutter.bot_id.replace(' ', '_') }}/bot.py | 6 ++++++ .../bothbot.py | 8 +++++++- .../custombot.py | 4 ++++ .../requirements.txt | 12 ++++++------ .../webbot.py | 6 ++++++ 5 files changed, 29 insertions(+), 7 deletions(-) diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/bot.py b/{{ cookiecutter.bot_id.replace(' ', '_') }}/bot.py index 4682474..003e575 100644 --- a/{{ cookiecutter.bot_id.replace(' ', '_') }}/bot.py +++ b/{{ cookiecutter.bot_id.replace(' ', '_') }}/bot.py @@ -36,9 +36,15 @@ def main(): ## Fetch the BotExecution with details from the task, including parameters execution = maestro.get_execution() + print(f"Task ID is: {execution.task_id}") + print(f"Task Parameters are: {execution.parameters}") + bot = DesktopBot() bot.browse("http://www.botcity.dev") + # Implement here your logic... + ... + # Uncomment to mark this task as finished on BotMaestro # maestro.finish_task( # task_id=execution.task_id, diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/bothbot.py b/{{ cookiecutter.bot_id.replace(' ', '_') }}/bothbot.py index 5ef01b2..d862e72 100644 --- a/{{ cookiecutter.bot_id.replace(' ', '_') }}/bothbot.py +++ b/{{ cookiecutter.bot_id.replace(' ', '_') }}/bothbot.py @@ -40,6 +40,9 @@ def main(): ## Fetch the BotExecution with details from the task, including parameters execution = maestro.get_execution() + print(f"Task ID is: {execution.task_id}") + print(f"Task Parameters are: {execution.parameters}") + desktop_bot = DesktopBot() # Execute operations with the DesktopBot as desired @@ -61,8 +64,11 @@ def main(): # Opens the BotCity website. webbot.browse("https://www.botcity.dev") + # Implement here your logic... + ... + # Wait 3 seconds before closing - bot.wait(3000) + webbot.wait(3000) # Finish and clean up the Web Browser # You MUST invoke the stop_browser to avoid diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/custombot.py b/{{ cookiecutter.bot_id.replace(' ', '_') }}/custombot.py index 6b2d08b..744e536 100644 --- a/{{ cookiecutter.bot_id.replace(' ', '_') }}/custombot.py +++ b/{{ cookiecutter.bot_id.replace(' ', '_') }}/custombot.py @@ -34,6 +34,10 @@ def main(): ## Fetch the BotExecution with details from the task, including parameters execution = maestro.get_execution() + print(f"Task ID is: {execution.task_id}") + print(f"Task Parameters are: {execution.parameters}") + + # Implement here your logic... ... # Uncomment to mark this task as finished on BotMaestro diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/requirements.txt b/{{ cookiecutter.bot_id.replace(' ', '_') }}/requirements.txt index 98ac599..88ac8c4 100644 --- a/{{ cookiecutter.bot_id.replace(' ', '_') }}/requirements.txt +++ b/{{ cookiecutter.bot_id.replace(' ', '_') }}/requirements.txt @@ -1,12 +1,12 @@ {%- if cookiecutter.project_type == "Desktop" -%} -botcity-framework-core>=0.2.9,<1.0 +botcity-framework-core>=0.4.0,<1.0 {%- elif cookiecutter.project_type == "Web" -%} -botcity-framework-web>=0.5.2,<1.0 +botcity-framework-web>=0.7.0,<1.0 {%- elif cookiecutter.project_type == "Both" -%} -botcity-framework-core>=0.2.9,<1.0 -botcity-framework-web>=0.5.2,<1.0 +botcity-framework-core>=0.4.0,<1.0 +botcity-framework-web>=0.7.0,<1.0 {% endif %} -botcity-maestro-sdk>=0.1.5,<1.0 +botcity-maestro-sdk>=0.2.0,<1.0 # Uncomment to use botcity-utils # botcity-utils>=0.1.2 @@ -14,4 +14,4 @@ botcity-maestro-sdk>=0.1.5,<1.0 # botcity-crawler-plugin # Uncomment to use Pandas -# pandas \ No newline at end of file +# pandas diff --git a/{{ cookiecutter.bot_id.replace(' ', '_') }}/webbot.py b/{{ cookiecutter.bot_id.replace(' ', '_') }}/webbot.py index ace4cf5..5eb7714 100644 --- a/{{ cookiecutter.bot_id.replace(' ', '_') }}/webbot.py +++ b/{{ cookiecutter.bot_id.replace(' ', '_') }}/webbot.py @@ -38,6 +38,9 @@ def main(): ## Fetch the BotExecution with details from the task, including parameters execution = maestro.get_execution() + print(f"Task ID is: {execution.task_id}") + print(f"Task Parameters are: {execution.parameters}") + bot = WebBot() # Configure whether or not to run on headless mode @@ -52,6 +55,9 @@ def main(): # Opens the BotCity website. bot.browse("https://www.botcity.dev") + # Implement here your logic... + ... + # Wait 3 seconds before closing bot.wait(3000)