delete some more stuff

This commit is contained in:
James Maslek
2023-04-13 10:46:27 -04:00
parent 1c9ecb688e
commit 196242d774
4 changed files with 1 additions and 144 deletions

View File

@@ -45,7 +45,7 @@ jobs:
with:
workflow: docker-build.yml
token: ${{ secrets.GITHUB_TOKEN }}
trigger-pypi-build:
runs-on: ubuntu-latest
steps:
@@ -54,12 +54,3 @@ jobs:
with:
workflow: pypi-nightly.yml
token: ${{ secrets.GITHUB_TOKEN }}
trigger-pypi-build:
runs-on: ubuntu-latest
steps:
- name: Trigger PyPI Build
uses: aurelien-baudet/workflow-dispatch@v2
with:
workflow: nightly-pypi.yml
token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,48 +0,0 @@
name: Deploy to PyPI - Nightly
on: workflow_dispatch
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy-nightly-pypi:
name: Build and publish nightly distributions 📦 to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python 3.9
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Update version in pyproject.toml and Edit docs
run: |
sed -i 's/name = ".*"/name = "openbb-nightly"/' pyproject.toml
sed -i "3s/version = \"\(.*\)\"/version = \"\1.dev$(date +%Y%m%d)\"/" pyproject.toml
head pyproject.toml
sed -i 's/pip install openbb/pip install openbb-nightly/g; s/from openbb_terminal.sdk import openbb/from openbb_terminal.sdk import openbb-nightly/g' ./website/pypi.md
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.NIGHTLY_PYPI_API_TOKEN }}

View File

@@ -1,85 +0,0 @@
import atexit
import json
import os
from pathlib import Path
from pydantic.json import pydantic_encoder
from openbb_terminal.core.config.paths import (
SETTINGS_DIRECTORY,
)
from openbb_terminal.core.models import SystemModel
from openbb_terminal.core.session.env_handler import load_env_to_model, reading_env
SYSTEM_FILE_PATH = SETTINGS_DIRECTORY / "system.json"
def handle_system(file_path: Path = SYSTEM_FILE_PATH) -> SystemModel:
"""
Handle the system.
Reads system data from file if it exists, else reads environment variable data.
Returns a system model built from the loaded data.
Parameters
----------
file_path (Path): The file path.
Returns
-------
SystemModel: The system model.
"""
try:
if os.path.isfile(file_path):
system_data = {}
with open(file_path) as f:
system_data = json.load(f)
if system_data:
return load_env_to_model(system_data, SystemModel)
except Exception:
pass
__env_dict = reading_env()
system = load_env_to_model(__env_dict, SystemModel)
save_system(system=system, file_path=file_path)
subscribe_delete_system_on_exit(file_path=file_path)
return system
def save_system(system: SystemModel, file_path: Path = SYSTEM_FILE_PATH):
"""
Write system to file.
Parameters
----------
system (SystemModel): The system model.
file_path (Path): The file path.
Returns
-------
system (SystemModel): The system model.
"""
try:
with open(file_path, "w") as f:
json_content = json.dumps(system, default=pydantic_encoder)
f.write(json_content)
except Exception:
pass
def subscribe_delete_system_on_exit(file_path: Path):
"""
Deletes the system file on exiting the application.
Parameters
----------
file_path (Path): The file path.
"""
def delete_file(file_path: Path):
if os.path.isfile(file_path):
os.remove(file_path)
atexit.register(delete_file, file_path=file_path)

View File

@@ -1 +0,0 @@
{"src": "rgb(255,255,255)", "cmds": "rgb(102,232,95)", "help": "rgb(98,79,0)", "info": "rgb(224,131,48)", "menu": "rgb(77,236,231)", "param": "rgb(103,80,5)"}