From db17b9c74c41b1921256832254d18d9ddfa0ec44 Mon Sep 17 00:00:00 2001 From: Pat O'Connor Date: Sat, 15 Mar 2025 11:58:36 +0000 Subject: [PATCH] task(GUIDEFRAME-40): reconfigure project for pypi Signed-off-by: Pat O'Connor --- .DS_Store | Bin 8196 -> 8196 bytes .gitignore | 6 +++-- .vscode/settings.json | 6 ----- README.md | 10 +++++++ __pycache__/assembly.cpython-313.pyc | Bin 4739 -> 0 bytes __pycache__/audio.cpython-313.pyc | Bin 2005 -> 0 bytes __pycache__/video.cpython-313.pyc | Bin 1085 -> 0 bytes guideframe/__init__.py | 5 ++++ .../assembly.py | 2 +- guideframe_audio.py => guideframe/audio.py | 0 guideframe/scripts/install_dependencies.sh | 16 +++++++++++ .../selenium.py | 0 guideframe_utils.py => guideframe/utils.py | 4 +-- guideframe_video.py => guideframe/video.py | 0 pyproject.toml | 25 ++++++++++++++++++ selenium_demos/selenium_automation_tests.py | 24 ++++++++++------- selenium_demos/selenium_function_demo.py | 6 ++--- tutors_test.py | 6 ++--- 18 files changed, 84 insertions(+), 26 deletions(-) delete mode 100644 .vscode/settings.json delete mode 100644 __pycache__/assembly.cpython-313.pyc delete mode 100644 __pycache__/audio.cpython-313.pyc delete mode 100644 __pycache__/video.cpython-313.pyc create mode 100644 guideframe/__init__.py rename guideframe_assembly.py => guideframe/assembly.py (98%) rename guideframe_audio.py => guideframe/audio.py (100%) create mode 100644 guideframe/scripts/install_dependencies.sh rename guideframe_selenium.py => guideframe/selenium.py (100%) rename guideframe_utils.py => guideframe/utils.py (95%) rename guideframe_video.py => guideframe/video.py (100%) create mode 100644 pyproject.toml diff --git a/.DS_Store b/.DS_Store index a11574ac4227cc30722be7b63ce31bc058595f1d..5c2610ff07018b5e5659e711563c782aae1cdd01 100644 GIT binary patch delta 133 zcmZp1XmOa}&nUDpU^hRb&}1F~%gNOOQKDQ7=?tX|nG7imsSIfhMGT1yxeTe3Jp|<^ z=L+#}_7jq2vgBhZV5kJ*B8Gg1ETFPvh7txnAkGIW&GF31Pfp6oPhwzT5CG!!Ks@h1 a7%(tw&JdZ;ys^Q6aWlKbH5Ku`XLopDhGUPHOG2}2*PF4^QnXDx&$S4d_zynrL%8hKy{*m qvbdC$0TrbH4Fy>)$_jG+yv-*B%$YV@3(sNR%r5bbW%F5Kc4h$0xJHHm diff --git a/.gitignore b/.gitignore index 42a3862..f376a88 100644 --- a/.gitignore +++ b/.gitignore @@ -3,9 +3,11 @@ .venv *.mp4 *.mp3 +*.tar.gz +*.whl tts_audio lib bin include -__pycache__ -.vscode \ No newline at end of file +__pycache__/ +.vscode/ \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 7df5345..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "python.experiments.optOutFrom": [ - "pythonTerminalEnvVarActivation" - ], - "python.terminal.activateEnvironment": false -} \ No newline at end of file diff --git a/README.md b/README.md index bfcbe11..7269c08 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,13 @@ # GuideFrame A walkthrough video generation tool created for the final project module on the HDip in Computer Science SETU + +## Installation + +GuideFrame is packaged and available on pypi. It can be installed using: + +```pip install guideframe``` + +Once installed, you will need to install the non-python dependencies. A setup script is packaged with GuideFrame for this. You can simply copy it from the GuideFrame repo and run it locally or you can run the following: + +```bash $(python -c "import guideframe, os; print(os.path.join(os.path.dirname(guideframe.__file__), 'setup_env.sh'))")``` diff --git a/__pycache__/assembly.cpython-313.pyc b/__pycache__/assembly.cpython-313.pyc deleted file mode 100644 index 2094871c36529e66a33fe99ac781a6e76ea979f4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4739 zcmbVP&2tk+7VnwSNTY9A{@~k;jjm|Sd9MImyDl1){dn{W8ATSWqYz$h3@4c@BViuaHkiCvXlxa{kZMv{fMl1i)8 zAFtoM_qzM_@4a4kI&BCFH-0biHxEKTkbzO?N@sltIyaDj1Zo7~a!X-KAJdrDTLv@G z(j%s`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c893ca7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1085 zcmZWoTWb?R6rN2c$u_sP=}j%xQ0iqLVq&XeMSKuMidagAJQWGs&1{&O?5s1J+O9A0 zN%1K!1^b?EUl&7=Csi1cYcLS%e7 z;o&-7KvroroV`a|%=4JnDhujx(bO7u%TAm5D($)*pSHq8#SL?nZPui`Az4V($hGCg z+RnAwty-9^xWevGVFy$tmTC~o!c1k`;Z5qOOq*@)Kpx!qf=U`F?AkI2ab@%Nwn{D4 zYPBb!S@GFU!|enrv)kRizF6}uL#1Q@tyoy4e8IdxWo38M7u=yzs?-|ysi*MT%G!M^ zrE7sI6Pe@vWzB9zX0e}%%u;_PGA9nEa--?qgFk1` z=-IEuxzEM9H_zT}z2|TFr{dk-gD6+(tq$M;0H*)| diff --git a/guideframe/__init__.py b/guideframe/__init__.py new file mode 100644 index 0000000..d0f255e --- /dev/null +++ b/guideframe/__init__.py @@ -0,0 +1,5 @@ +from . import assembly +from . import audio +from . import selenium +from . import utils +from . import video diff --git a/guideframe_assembly.py b/guideframe/assembly.py similarity index 98% rename from guideframe_assembly.py rename to guideframe/assembly.py index 66081d5..561305a 100644 --- a/guideframe_assembly.py +++ b/guideframe/assembly.py @@ -1,7 +1,7 @@ import ffmpeg import os import uuid -from guideframe_utils import extract_script_name +from guideframe.utils import extract_script_name ''' The assembly.py file contains the functions to combine the audio and video files into a single video file diff --git a/guideframe_audio.py b/guideframe/audio.py similarity index 100% rename from guideframe_audio.py rename to guideframe/audio.py diff --git a/guideframe/scripts/install_dependencies.sh b/guideframe/scripts/install_dependencies.sh new file mode 100644 index 0000000..bd50ffd --- /dev/null +++ b/guideframe/scripts/install_dependencies.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -e # Exit immediately if a command exits with a non-zero status +set -x # Print each command before executing it (for debugging) + +# Update package list +sudo apt-get update + +# Install system dependencies +sudo apt-get install -y \ + ffmpeg \ + xvfb \ + chromium-driver \ + chromium-browser + +echo "Guideframe setup completed successfully!" diff --git a/guideframe_selenium.py b/guideframe/selenium.py similarity index 100% rename from guideframe_selenium.py rename to guideframe/selenium.py diff --git a/guideframe_utils.py b/guideframe/utils.py similarity index 95% rename from guideframe_utils.py rename to guideframe/utils.py index fe56cdc..e2b218c 100644 --- a/guideframe_utils.py +++ b/guideframe/utils.py @@ -1,5 +1,5 @@ -from guideframe_audio import generate_voicover -from guideframe_video import start_ffmpeg_recording, stop_ffmpeg_recording +from guideframe.audio import generate_voicover +from guideframe.video import start_ffmpeg_recording, stop_ffmpeg_recording import time import sys diff --git a/guideframe_video.py b/guideframe/video.py similarity index 100% rename from guideframe_video.py rename to guideframe/video.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..387f5ed --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,25 @@ +[project] +name = "guideframe" +version = "0.5.0" +description = "A tool to generate reusable software walkthrough videos via code." +authors = [ + {name = "Pat O'Connor"} +] +license = {text = "MIT"} +readme = "README.md" +requires-python = ">=3.11" +dependencies = [ + "selenium (==4.27.1)", + "ffmpeg-python (==0.2.0)", + "mutagen (==1.47.0)", + "gtts (==2.5.4)" +] + + +[build-system] +requires = ["poetry-core>=2.0.0,<3.0.0"] +build-backend = "poetry.core.masonry.api" + + +[tool.poetry] +include = ["guideframe/scripts/install_dependencies.sh"] diff --git a/selenium_demos/selenium_automation_tests.py b/selenium_demos/selenium_automation_tests.py index 8e5eec6..0422e4c 100644 --- a/selenium_demos/selenium_automation_tests.py +++ b/selenium_demos/selenium_automation_tests.py @@ -1,5 +1,5 @@ -from guideframe_selenium import * -from guideframe_utils import get_env_settings # Importing the guide_step and get_env_settings functions from guideframe_utils.py +from guideframe.selenium import * +from guideframe.utils import get_env_settings # Importing the guide_step and get_env_settings functions from guideframe_utils.py import time # Setup the driver and perform automation tests @@ -13,9 +13,13 @@ def selenium_automation_tests(): # Set window size and navigate to URL set_window_size(driver) open_url(driver, "https://magento.softwaretestingboard.com/") - - # Clicking the agree button for the privacy policy + time.sleep(2) + + ''' + # Removing this as cookie is not present in github runner environment click_button_by_span_text(driver, "AGREE") + time.sleep(2) + ''' # Click on the 'Sign In' link click_element(driver, ".authorization-link > a") @@ -74,17 +78,19 @@ def selenium_automation_tests(): # Click the "Sign Out" button click_element(driver, "a[href='https://magento.softwaretestingboard.com/customer/account/logout/']") time.sleep(2) - - # Print the success message - print("Test Passed ✅") + + print("Test Passed ✅") # Print the success message + exit_code = 0 # Set the exit code to 0 except Exception as e: # print the failure message print(f"Test Failed ❌: {str(e)}") - + exit_code = 1 # Set the exit code to 1 + raise + finally: - # Close the browser driver.quit() + exit(exit_code) # Run the automation test if __name__ == "__main__": diff --git a/selenium_demos/selenium_function_demo.py b/selenium_demos/selenium_function_demo.py index b801d54..ce11b5c 100644 --- a/selenium_demos/selenium_function_demo.py +++ b/selenium_demos/selenium_function_demo.py @@ -1,6 +1,6 @@ -from guideframe_selenium import * # Importing all functions from selenium_functions.py -from guideframe_assembly import assemble # Importing the assemble_clips function from assembly.py -from guideframe_utils import get_env_settings, guide_step # Importing the guide_step and get_env_settings functions from guideframe_utils.py +from guideframe.selenium import * # Importing all functions from selenium_functions.py +from guideframe.assembly import assemble # Importing the assemble_clips function from assembly.py +from guideframe.utils import get_env_settings, guide_step # Importing the guide_step and get_env_settings functions from guideframe_utils.py # This function will run the full script diff --git a/tutors_test.py b/tutors_test.py index e7fead1..434be80 100644 --- a/tutors_test.py +++ b/tutors_test.py @@ -1,6 +1,6 @@ -from guideframe_selenium import * # Moved all selenium functions to external file -from guideframe_assembly import assemble # Importing the assemble_clips function from assembly.py -from guideframe_utils import guide_step, get_env_settings # Importing the guide_step and get_env_settings functions from guideframe_utils.py +from guideframe.selenium import * # Moved all selenium functions to external file +from guideframe.assembly import assemble # Importing the assemble_clips function from assembly.py +from guideframe.utils import guide_step, get_env_settings # Importing the guide_step and get_env_settings functions from guideframe_utils.py '''