Add minor changes found during onboarding (#37)
* Add new tool to the arithmetic toolkit for summation of a range. * Add ability to attach debugger to cli. Use `.vscode/launch.json`'s "Debug arcade dev" to do so. * Fix issue in cli's main that used the incorrect url.
This commit is contained in:
parent
5726778f11
commit
ce4a9b28a9
5 changed files with 48 additions and 2 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -169,6 +169,7 @@ cython_debug/
|
|||
|
||||
# Vscode config files
|
||||
.vscode/
|
||||
!.vscode/launch.json # Exception: allow launch.json
|
||||
|
||||
# PyCharm
|
||||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||
|
|
|
|||
26
.vscode/launch.json
vendored
Normal file
26
.vscode/launch.json
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Debug examples/fastapi",
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"module": "uvicorn",
|
||||
"args": ["main:app", "--app-dir", "${workspaceFolder}/examples/fastapi/arcade_example_fastapi"],
|
||||
"jinja": true,
|
||||
"justMyCode": true,
|
||||
"cwd": "${workspaceFolder}/examples/fastapi/arcade_example_fastapi"
|
||||
},
|
||||
{
|
||||
"name": "Debug arcade dev",
|
||||
"type": "python",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/arcade/run_cli.py",
|
||||
"args": ["dev"],
|
||||
"console": "integratedTerminal",
|
||||
"jinja": true,
|
||||
"justMyCode": true,
|
||||
"cwd": "${workspaceFolder}"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -34,7 +34,7 @@ console = Console()
|
|||
@cli.command(help="Log in to Arcade Cloud")
|
||||
def login(
|
||||
host: str = typer.Option(
|
||||
"https://cloud.arcade-ai.com",
|
||||
"cloud.arcade-ai.com",
|
||||
"-h",
|
||||
"--host",
|
||||
help="The Arcade Cloud host to log in to.",
|
||||
|
|
@ -261,7 +261,7 @@ def dev(
|
|||
"127.0.0.1", help="Host for the app, from settings by default.", show_default=True
|
||||
),
|
||||
port: int = typer.Option(
|
||||
"8000", "-p", "--port", help="Port for the app, defaults to ", show_default=True
|
||||
"8002", "-p", "--port", help="Port for the app, defaults to ", show_default=True
|
||||
),
|
||||
disable_auth: bool = typer.Option(
|
||||
False,
|
||||
|
|
|
|||
8
arcade/run_cli.py
Normal file
8
arcade/run_cli.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import sys
|
||||
|
||||
from arcade.cli.main import cli
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Support attaching debugger to cli
|
||||
mode = sys.argv[1] if len(sys.argv) > 1 else "dev"
|
||||
cli([mode])
|
||||
|
|
@ -62,3 +62,14 @@ def sum_list(
|
|||
Sum all numbers in a list
|
||||
"""
|
||||
return sum(numbers)
|
||||
|
||||
|
||||
@tool
|
||||
def sum_range(
|
||||
start: Annotated[int, "The start of the range to sum"],
|
||||
end: Annotated[int, "The end of the range to sum"],
|
||||
) -> Annotated[int, "The sum of the numbers in the list"]:
|
||||
"""
|
||||
Sum all numbers from start through end
|
||||
"""
|
||||
return sum([i for i in range(start, end + 1)])
|
||||
|
|
|
|||
Loading…
Reference in a new issue