From 69ecbbd3901b6823ece2580c5f16700bb3cfc377 Mon Sep 17 00:00:00 2001 From: Lucas-CE Date: Fri, 1 Mar 2024 13:15:44 -0300 Subject: [PATCH 1/3] feat: :sparkles: Add run-dev.py script for initializing the application --- run-dev.py | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 run-dev.py diff --git a/run-dev.py b/run-dev.py new file mode 100644 index 000000000..08d7b3ace --- /dev/null +++ b/run-dev.py @@ -0,0 +1,52 @@ +import os +import pathlib +import subprocess +from subprocess import Popen + + +def init_dev(): + """ + Función principal para iniciar la aplicación dashai. + """ + venv_name = "env" + local_path = pathlib.Path("~/.DashAI").expanduser() + venv_path = os.path.join(local_path, venv_name) + + if not os.path.exists(local_path): + os.mkdir(local_path) + + if not os.path.exists(venv_path): + subprocess.run(["python", "-m", "venv", venv_path]) + + scripts_path = os.path.join(venv_path, "Scripts") # ~/.DashAI/venv/Scripts + pip_path = os.path.join(scripts_path, "pip") + + subprocess.run([pip_path, "install", "-r", "requirements.txt"]) + subprocess.run([pip_path, "install", "-r", "requirements-dev.txt"]) + + # Comando para abrir terminal y correr el comandos + full_command = "start cmd /c " + + actual_path = pathlib.Path(__file__).parent.absolute() + front_path = pathlib.Path(actual_path, "DashAI/front") + + # Comando para ejecutar yarn + yarn_command = full_command + f"yarn --cwd {front_path} start" + + # Comando para ejecutar el backend + python_command = ( + full_command + f"{os.path.join(scripts_path, 'python.exe')} -m DashAI" + ) + + try: + # Ejecutar el comando para iniciar el front + Popen(yarn_command, shell=True) + + # Ejecutar el comando para iniciar el backend + Popen(python_command, shell=True) + + except KeyboardInterrupt: + pass + + +init_dev() From d28f565fa9429db63c8fac8dba2096c526175edc Mon Sep 17 00:00:00 2001 From: Lucas-CE Date: Tue, 30 Apr 2024 18:16:08 -0400 Subject: [PATCH 2/3] docs: :memo: Refactor run-dev.py script for better readability and maintainability --- run-dev.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/run-dev.py b/run-dev.py index 08d7b3ace..ed6cf40bd 100644 --- a/run-dev.py +++ b/run-dev.py @@ -6,7 +6,10 @@ def init_dev(): """ - Función principal para iniciar la aplicación dashai. + Main function to start the dashai application. + + This only works if the PATH environment variable has python as + the python 3.8 executable. """ venv_name = "env" local_path = pathlib.Path("~/.DashAI").expanduser() @@ -24,25 +27,25 @@ def init_dev(): subprocess.run([pip_path, "install", "-r", "requirements.txt"]) subprocess.run([pip_path, "install", "-r", "requirements-dev.txt"]) - # Comando para abrir terminal y correr el comandos + # Command to open terminal and run the commands full_command = "start cmd /c " actual_path = pathlib.Path(__file__).parent.absolute() front_path = pathlib.Path(actual_path, "DashAI/front") - # Comando para ejecutar yarn + # Command to start the front yarn_command = full_command + f"yarn --cwd {front_path} start" - # Comando para ejecutar el backend + # Command to start the backend python_command = ( full_command + f"{os.path.join(scripts_path, 'python.exe')} -m DashAI" ) try: - # Ejecutar el comando para iniciar el front + # Execute the command to start the front Popen(yarn_command, shell=True) - # Ejecutar el comando para iniciar el backend + # Execute the command to start the backend Popen(python_command, shell=True) except KeyboardInterrupt: From 4d03a63399530ac323703c1f86b4b7c95b928fb4 Mon Sep 17 00:00:00 2001 From: Lucas-CE Date: Sat, 11 May 2024 15:58:09 -0400 Subject: [PATCH 3/3] Update documentation for 'init_dev' --- run-dev.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run-dev.py b/run-dev.py index ed6cf40bd..9728bd0e0 100644 --- a/run-dev.py +++ b/run-dev.py @@ -8,7 +8,7 @@ def init_dev(): """ Main function to start the dashai application. - This only works if the PATH environment variable has python as + The function only works if the PATH environment variable has python as the python 3.8 executable. """ venv_name = "env"