import streamlit as st import os import subprocess import sys st.set_page_config( page_title="Vnstock - Giải pháp phân tích chứng khoán toàn diện", page_icon="📊", layout="wide", ) secure_repo = st.secrets["private_repo"] git_user = st.secrets["git_usr"] git_token = st.secrets["MCGtk"] def core_engine_setup(): repo_url = "https://:@github.com//.git" # Replace with the environment variable for your GitHub PAT secure_url = repo_url.replace("", git_token).replace("", git_user).replace("", secure_repo) # subprocess.run(f"pip install git+{secure_url}", shell=True, check=True) if not os.path.isdir(secure_repo): subprocess.run(["git", "clone", secure_url], check=True) os.chdir(secure_repo) try: # subprocess.run(f"ls -l", shell=True, check=True) if not os.path.isfile("requirements_installed.txt"): core_engine_setup() print('The core engine initialized successfully!') subprocess.run(["pip", "install", "-r", "requirements.txt"], check=True) # Create a file indicating requirements have been installed with open("requirements_installed.txt", "w") as f: f.write("Requirements installed.") # from datetime import datetime, timedelta import main main.render() except Exception as e: st.warning('Something went wrong! Please try again!') print(f'Error details: {e}')