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

Moved db and server imports to their appropriate cli commands #271

Merged
merged 1 commit into from
Jun 21, 2024
Merged
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
13 changes: 7 additions & 6 deletions autotx/cli.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import uuid
from dotenv import load_dotenv

from autotx import db
from autotx.wallets.safe_smart_wallet import SafeSmartWallet
load_dotenv()
import uvicorn

import uuid
import uvicorn
from typing import cast
import click

from autotx.wallets.safe_smart_wallet import SafeSmartWallet
from autotx.utils.configuration import AppConfig
from autotx.utils.is_dev_env import is_dev_env
from autotx.setup import print_agent_address, setup_agents
from autotx.server import setup_server
from autotx.AutoTx import AutoTx, Config
from autotx.utils.ethereum.helpers.show_address_balances import show_address_balances

Expand Down Expand Up @@ -80,6 +77,8 @@ def run(prompt: str | None, non_interactive: bool, verbose: bool, logs: str | No
@click.option("-p", "--port", type=int, help="Port to run the server on")
@click.option("-d", "--dev", is_flag=True, help="Run the server in development mode")
def serve(verbose: bool, logs: str | None, max_rounds: int | None, cache: bool, port: int | None, dev: bool) -> None:
from autotx.server import setup_server

print_autotx_info()

setup_server(verbose, logs, max_rounds, cache, dev, check_valid_safe=True)
Expand All @@ -88,6 +87,8 @@ def serve(verbose: bool, logs: str | None, max_rounds: int | None, cache: bool,
@main.command()
@click.option("-n", "--name", type=str, help="Name of the application to create")
def new_app(name: str) -> None:
from autotx import db

print(f"Creating new application: {name}")

app = db.create_app(name, uuid.uuid4().hex)
Expand Down
Loading