mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 13:01:38 +00:00
Hotfix/Windows-CLI (#4087)
* init * Update windows10_build.yml * Update windows10_build.yml * Update windows10_build.yml * Update windows10_build.yml * Update windows10_build.yml * Update windows10_build.yml * oops --------- Co-authored-by: James Maslek <jmaslek11@gmail.com>
This commit is contained in:
91
.github/workflows/windows10_build.yml
vendored
91
.github/workflows/windows10_build.yml
vendored
@@ -16,47 +16,62 @@ concurrency:
|
||||
|
||||
jobs:
|
||||
Windows-Build:
|
||||
name: Windows10 Build
|
||||
runs-on: [self-hosted, Windows, x64]
|
||||
name: Windows10 Build ENV
|
||||
runs-on: windows-latest
|
||||
# Configuring -------------
|
||||
steps:
|
||||
- name: Setup Windows Git Configuration # This is under the assumption that git is already installed on the system
|
||||
run: |
|
||||
Set-ItemProperty 'HKLM:\System\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -value 1
|
||||
git config --system core.longpaths true
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2.4.2
|
||||
- name: Activate Base & Create OpenBB Environment
|
||||
|
||||
- name: Set up Python & Create OpenBB Environment
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.9'
|
||||
|
||||
- name: Create and start virtual environment
|
||||
run: |
|
||||
conda activate base
|
||||
conda env create -n obb --file build/conda/conda-3-9-env-full.yaml
|
||||
conda init
|
||||
conda activate obb
|
||||
conda env list
|
||||
- name: Poetry Install
|
||||
# Conda activate needs to be run every time because of the way that the workflow steps work
|
||||
# on powershell where it creates a new shell every time for every step
|
||||
python -m venv venv
|
||||
source venv/Scripts/activate
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install poetry==1.1.13
|
||||
python -m pip install setuptools==64.0.2 wheel
|
||||
python -m pip install charset_normalizer==2.1.1
|
||||
python -m poetry install -E installer -E all
|
||||
python -m pip uninstall papermill -y
|
||||
python -m pip install git+https://github.com/nteract/papermill.git@main
|
||||
python -m PyInstaller build/pyinstaller/terminal.spec --clean
|
||||
|
||||
shell: bash
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: OpenBB-Windows10-ENV
|
||||
path: dist
|
||||
|
||||
|
||||
Build-Exe:
|
||||
name: Windows10 Build-Exe
|
||||
runs-on: [self-hosted, Windows, x64]
|
||||
needs: Windows-Build
|
||||
# Configuring -------------
|
||||
steps:
|
||||
- name: Setup Windows Git Configuration # This is under the assumption that git is already installed on the system
|
||||
run: |
|
||||
conda activate obb
|
||||
poetry install
|
||||
- name: Poetry Install Portfolio Optimization and Forecasting Toolkits
|
||||
run: |
|
||||
conda activate obb
|
||||
poetry install -E all
|
||||
- name: Poetry Install Installer
|
||||
run: |
|
||||
conda activate obb
|
||||
poetry install -E installer
|
||||
- name: Install Specific Papermill
|
||||
run: |
|
||||
conda activate obb
|
||||
pip uninstall papermill -y
|
||||
pip install git+https://github.com/nteract/papermill.git@main
|
||||
# Building ------------
|
||||
- name: Build Terminal.spec file
|
||||
run: |
|
||||
conda activate obb
|
||||
pyinstaller build/pyinstaller/terminal.spec --clean
|
||||
Set-ItemProperty 'HKLM:\System\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -value 1
|
||||
git config --system core.longpaths true
|
||||
|
||||
- name: Download Artifact
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: OpenBB-Windows10-ENV
|
||||
path: dist
|
||||
|
||||
- name: Move Files into App Folder
|
||||
run: cp -r .\dist\OpenBBTerminal\ .\build\nsis\app\
|
||||
# don't need this because log collection is turned off
|
||||
@@ -64,16 +79,18 @@ jobs:
|
||||
# run: Remove-Item .\build\nsis\app\openbb_terminal\logs\ -Recurse
|
||||
- name: Build Exe File
|
||||
run: |
|
||||
conda activate obb
|
||||
C:\'.\Program Files (x86)\'\nsis\makensis.exe .\build\nsis\setup.nsi
|
||||
|
||||
- name: Save Build Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Windows EXE Artifact
|
||||
path: '.\build\nsis\OpenBB Terminal Setup.exe'
|
||||
|
||||
- name: Run Integration Tests
|
||||
run: |
|
||||
dist\OpenBBTerminal\OpenBBTerminal.exe C:\Users\Administrator\actions-runner\_work\OpenBBTerminal\OpenBBTerminal\openbb_terminal\miscellaneous\integration_tests_scripts -t
|
||||
dist\OpenBBTerminal\OpenBBTerminal.exe -t
|
||||
|
||||
# Cleaning ------------------------
|
||||
# Make sure to add Remove-Item C:\Users\Administrator\Desktop\OPENBB-exports -Recurse whenever integration tests get fixed
|
||||
- name: Remove Previous Build
|
||||
@@ -81,10 +98,4 @@ jobs:
|
||||
Remove-Item '.\build\nsis\OpenBB Terminal Setup.exe' -Recurse
|
||||
Remove-Item .\build\nsis\app\ -Recurse
|
||||
Remove-Item .\dist\ -Recurse
|
||||
Remove-Item .\build\terminal\ -Recurse
|
||||
- name: Deactivate & Remove Conda Environment
|
||||
run: |
|
||||
conda deactivate obb
|
||||
conda deactivate base
|
||||
conda env remove -n obb
|
||||
Remove-Item C:\Users\Administrator\miniconda3\envs\obb\ -Recurse
|
||||
|
||||
|
||||
42
build/pyinstaller/terminal.spec
vendored
42
build/pyinstaller/terminal.spec
vendored
@@ -1,18 +1,15 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
import os
|
||||
import pathlib
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import scipy
|
||||
|
||||
from dotenv import set_key
|
||||
|
||||
from PyInstaller.compat import is_darwin, is_win
|
||||
from PyInstaller.building.api import PYZ, EXE, COLLECT
|
||||
from PyInstaller.building.splash import Splash
|
||||
from PyInstaller.building.api import COLLECT, EXE, PYZ
|
||||
from PyInstaller.building.build_main import Analysis
|
||||
|
||||
|
||||
# import subprocess
|
||||
from PyInstaller.building.splash import Splash
|
||||
from PyInstaller.compat import is_darwin, is_win
|
||||
|
||||
from openbb_terminal.loggers import get_commit_hash
|
||||
|
||||
@@ -23,21 +20,30 @@ build_type = (
|
||||
)
|
||||
|
||||
# Local python environment packages folder
|
||||
pathex = os.path.join(os.path.dirname(os.__file__), "site-packages")
|
||||
venv_path = Path(sys.executable).parent.parent.resolve()
|
||||
|
||||
# Check if we are running in a conda environment
|
||||
if is_darwin:
|
||||
pathex = os.path.join(os.path.dirname(os.__file__), "site-packages")
|
||||
else:
|
||||
if "site-packages" in list(venv_path.iterdir()):
|
||||
pathex = str(venv_path / "site-packages")
|
||||
else:
|
||||
pathex = str(venv_path / "lib" / "site-packages")
|
||||
|
||||
|
||||
# Removing unused ARM64 binary
|
||||
binary_to_remove = pathlib.Path(
|
||||
os.path.join(pathex, "_scs_direct.cpython-39-darwin.so")
|
||||
)
|
||||
binary_to_remove = Path(os.path.join(pathex, "_scs_direct.cpython-39-darwin.so"))
|
||||
print("Removing ARM64 Binary: _scs_direct.cpython-39-darwin.so")
|
||||
binary_to_remove.unlink(missing_ok=True)
|
||||
build_assets_folder = os.path.join(os.getcwd(), "build", "pyinstaller")
|
||||
|
||||
# Removing inspect hook
|
||||
destination = pathlib.Path(
|
||||
destination = Path(
|
||||
os.path.join(pathex, "pyinstaller/hooks/rthooks", "pyi_rth_inspect.py")
|
||||
)
|
||||
print("Replacing Pyinstaller Hook: pyi_rth_inspect.py")
|
||||
source = "build/pyinstaller/hooks/pyi_rth_inspect.py"
|
||||
source = os.path.join(build_assets_folder, "hooks", "pyi_rth_inspect.py")
|
||||
subprocess.run(["cp", source, str(destination)], check=True)
|
||||
|
||||
|
||||
@@ -77,8 +83,8 @@ added_files = [
|
||||
]
|
||||
if is_win:
|
||||
added_files.append(
|
||||
(os.path.join(f"{os.path.dirname(scipy.__file__)}.libs"), "scipy.libs/"),
|
||||
)
|
||||
(os.path.join(f"{os.path.dirname(scipy.__file__)}.libs"), "scipy.libs/"),
|
||||
)
|
||||
# Python libraries that are explicitly pulled into the bundle
|
||||
hidden_imports = [
|
||||
"sklearn.utils._cython_blas",
|
||||
@@ -103,7 +109,7 @@ hidden_imports = [
|
||||
"_sysconfigdata__darwin_darwin",
|
||||
"prophet",
|
||||
"debugpy",
|
||||
"scipy.sparse.linalg._isolve._iterative"
|
||||
"scipy.sparse.linalg._isolve._iterative",
|
||||
]
|
||||
|
||||
|
||||
|
||||
@@ -2,35 +2,32 @@
|
||||
"""Main Testing Module"""
|
||||
__docformat__ = "numpy"
|
||||
|
||||
from functools import partial
|
||||
from multiprocessing.pool import Pool
|
||||
from multiprocessing import cpu_count
|
||||
from pathlib import Path
|
||||
import re
|
||||
import time
|
||||
from typing import Any, List, Dict, Optional, Tuple
|
||||
from traceback import FrameSummary, format_list, extract_tb
|
||||
import argparse
|
||||
import logging
|
||||
import sys
|
||||
import os
|
||||
from openbb_terminal.helper_funcs import check_positive
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
from functools import partial
|
||||
from multiprocessing import cpu_count
|
||||
from multiprocessing.pool import Pool
|
||||
from pathlib import Path
|
||||
from traceback import FrameSummary, extract_tb, format_list
|
||||
from typing import Any, Dict, List, Optional, Tuple
|
||||
|
||||
from openbb_terminal.rich_config import console
|
||||
from openbb_terminal.core.config.paths import (
|
||||
MISCELLANEOUS_DIRECTORY,
|
||||
REPOSITORY_DIRECTORY,
|
||||
)
|
||||
from openbb_terminal.helper_funcs import check_positive
|
||||
from openbb_terminal.rich_config import console
|
||||
from openbb_terminal.terminal_controller import (
|
||||
insert_start_slash,
|
||||
terminal,
|
||||
replace_dynamic,
|
||||
obbff,
|
||||
replace_dynamic,
|
||||
terminal,
|
||||
)
|
||||
from openbb_terminal.terminal_helper import (
|
||||
is_reset,
|
||||
suppress_stdout,
|
||||
)
|
||||
from openbb_terminal.terminal_helper import is_reset, suppress_stdout
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
special_arguments_values = [
|
||||
@@ -697,6 +694,11 @@ def main():
|
||||
if "--test" in sys.argv:
|
||||
sys.argv.remove("--test")
|
||||
|
||||
os.environ["OPENBB_ENABLE_QUICK_EXIT"] = "True"
|
||||
os.environ["OPENBB_LOG_COLLECT"] = "False"
|
||||
os.environ["OPENBB_USE_ION"] = "False"
|
||||
os.environ["OPENBB_USE_PROMPT_TOOLKIT"] = "False"
|
||||
|
||||
parse_args_and_run()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user