Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes to python package for 0.4.2 #262

Merged
merged 2 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zetaforge",
"version": "0.4.1",
"version": "0.4.2",
"main": "dist-electron/main/index.js",
"description": "ZetaForge",
"author": "Zetane <[email protected]>",
Expand Down
32 changes: 13 additions & 19 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,34 +1,28 @@
[build-system]
requires = [
"setuptools>=42",
"wheel"
]
requires = ["setuptools>=42", "wheel"]
build-backend = "setuptools.build_meta"



[project]
name = "zetaforge"
authors = [
{name="Zetane", email="[email protected]"}
]
authors = [{ name = "Zetane", email = "[email protected]" }]
dynamic = ["version"]
description = "zetaforge installer"
readme = "README_PYPI.md"
dependencies = [
"setuptools==69.0.2",
"requests==2.31.0",
"boto3==1.34.79",
"colorama==0.4.6",
"mixpanel==4.10.1",
"langchain==0.1.15",
"langchain-openai==0.1.2",
"sentry-sdk===2.0.1",
"yaspin"
]
"setuptools==69.0.2",
"requests==2.31.0",
"boto3==1.34.79",
"colorama==0.4.6",
"mixpanel==4.10.1",
"langchain==0.1.15",
"langchain-openai==0.1.2",
"sentry-sdk===2.0.1",
"yaspin",
"rich",
]

requires-python = ">=3.10"

[project.scripts]
zetaforge = "zetaforge.forge_cli:main"

71 changes: 70 additions & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion zetaforge/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = '0.4.1'
__version__ = '0.4.2'
from .block_maker.zetahelper import block_maker
from .Zetaforge import Zetaforge
17 changes: 10 additions & 7 deletions zetaforge/check_forge_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,23 @@
import platform
from pathlib import Path
import os
from zetaforge.logger import CliLogger

EXECUTABLES_PATH = os.path.join(Path(__file__).parent, 'executables')

logger = CliLogger()

def check_kubectl():
check_ctl = subprocess.run(["kubectl", "version", "--client"], capture_output=True, text=True)
return check_ctl.returncode == 0

def check_running_kube(context):
check_kube = subprocess.run(["kubectl", f"--context={context}", "get", "pods"], capture_output=True, text=True)
if check_kube.returncode == 0:
print("Kubernetes is running, continuing..")
logger.success("Kubernetes is running, continuing..")
return True
else:
print("Kubernetes is not running! ", check_kube.returncode)
print(check_kube.stderr)
logger.error(f"Kubernetes is not running! {check_kube.stderr}")
return False

def check_kube_pod(name):
Expand All @@ -25,7 +28,7 @@ def check_kube_pod(name):
parts = line.split("-")
if parts[0] == name:
return True

return False

def check_kube_svc(name, namespace="default"):
Expand All @@ -37,9 +40,9 @@ def check_kube_svc(name, namespace="default"):
parts = line.split(" ")
if parts[0].strip() == name:
return True

return False

def check_minikube():
check_ctl = subprocess.run(["minikube", "version"], capture_output=True, text=True)
return check_ctl.returncode == 0
Expand All @@ -55,4 +58,4 @@ def check_docker_installed():
else:
print("https://docs.docker.com/desktop/install/linux-install/")
return -1
return 0
return 0
32 changes: 19 additions & 13 deletions zetaforge/forge_cli.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from zetaforge.logger import CliLogger
from .forge_runner import run_forge, teardown, purge, setup, uninstall
from .install_forge_dependencies import check_version, get_launch_paths, remove_running_services
from .install_forge_dependencies import check_version_exists, install_new_version, get_launch_paths, remove_running_services
import argparse, os, json
from pathlib import Path
from .__init__ import __version__
Expand All @@ -9,6 +10,8 @@
EXECUTABLES_PATH = os.path.join(Path(__file__).parent, 'executables')
FRONT_END = os.path.join(EXECUTABLES_PATH, "frontend")

logger = CliLogger()

def main():
help_ = """launch:\t sets up containers for zetaforge, and launches the application
teardown:\tTears down your docker containers for zetaforge. Use this once you're done using zetaforge, in case your containers are not deleted.
Expand All @@ -24,29 +27,29 @@ def main():
args = parser.parse_args()

init() # Initialize colorama

server_versions = [__version__]
client_versions =[__version__]
client_path, server_path = get_launch_paths(server_versions[-1], client_versions[-1])
if args.s2_path is not None:
server_path = args.s2_path
mixpanel_client.set_env(args.is_dev)
print(server_path)
server_dir = os.path.dirname(server_path)
print(server_dir)
config_file = os.path.join(server_dir, "config.json")

if args.command == "launch":
check_version(server_versions[-1], client_versions[-1])
remove_running_services()
print(f"Checking for config in {config_file}")
logger.show_banner(client_versions[-1])
success = install_new_version(client_versions[-1], EXECUTABLES_PATH)

logger.info(f"Checking for config in {config_file}")
config = load_config(config_file)
#remove_running_services()
if config is None:
print("Config not found! Running setup..")
logger.warning("Config not found! Running setup..")
config_file = setup(server_versions[-1], client_versions[-1], args.driver, server_path=args.s2_path, is_dev=args.is_dev)
config = load_config(config_file)

if config is not None:
if config is not None and success:
run_forge(server_version=server_versions[-1], client_version=client_versions[-1], server_path=args.s2_path, client_path=args.app_path, is_dev=args.is_dev)
else:
raise Exception("Config failed to load, please re-run `zetaforge setup`.")
Expand All @@ -55,13 +58,16 @@ def main():
elif args.command == 'purge':
purge()
elif args.command == 'setup':
current_version_exists = check_version_exists(EXECUTABLES_PATH, client_versions[-1])
if not current_version_exists:
install_new_version(client_versions[-1], EXECUTABLES_PATH)
setup(server_versions[-1], client_versions[-1], args.driver, is_dev=args.is_dev)
elif args.command == 'uninstall':
uninstall(server_versions[-1], server_path=args.s2_path)
else:
print('zetaforge:\t' + __version__)
print("client:\t" + client_versions[-1])
print('server:\t' + server_versions[-1])
print("client:\t" + client_versions[-1])
print('server:\t' + server_versions[-1])

def load_config(config_file):
if os.path.exists(config_file):
Expand All @@ -74,4 +80,4 @@ def load_config(config_file):
return None

if __name__ == "__main__":
main()
main()
Loading