Skip to content
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
12 changes: 11 additions & 1 deletion pkg/boldi-cli/boldi/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,18 @@ def error_handler(ctx: CliCtx):

exit(2)

except KeyboardInterrupt as exc:
ctx.msg_FAIL("KeyboardInterrupt")

def _rich_traceback_from_exception(exc: Exception) -> Traceback:
if ctx.verbose:
ctx.console.print(_rich_traceback_from_exception(exc))
else:
ctx.msg_info("Use [bold]--verbose[/] or [bold]-v[/] for more info.")

exit(130)


def _rich_traceback_from_exception(exc: BaseException) -> Traceback:
"""Get rich Traceback from an exception caught by `error_handler`."""
tb = exc.__traceback__.tb_next if exc.__traceback__ else None
return Traceback.from_exception(exc.__class__, exc, tb, extra_lines=2, width=None)
29 changes: 29 additions & 0 deletions pkg/boldi-webalbum-app/boldi/webalbum/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from argparse import ArgumentParser
from functools import partial

from fastapi import FastAPI

from boldi.cli import CliCtx


def app():
fastapi_app = FastAPI(title="boldi webalbum app")

@fastapi_app.get("/")
def index():
return {"message": "Hello, World!"}

return fastapi_app


def cli_webalbum_app(ctx: CliCtx, subparser: ArgumentParser):
subparser.usage = "run a webalbum-app command"
webalbum_app_subparsers = subparser.add_subparsers()

subparser_run = webalbum_app_subparsers.add_parser("run")
subparser_run.set_defaults(action=partial(cli_webalbum_app_run, ctx))
subparser_run.add_argument("args", nargs="*", default=[], help="uvicorn arguments")


def cli_webalbum_app_run(ctx: CliCtx, args: list[str]):
ctx.run("uvicorn --factory", args, f"{__name__}:app")
Empty file.
16 changes: 0 additions & 16 deletions pkg/boldi-webalbum-app/boldi/webalbum/app/asgi.py

This file was deleted.

18 changes: 0 additions & 18 deletions pkg/boldi-webalbum-app/boldi/webalbum/app/cli.py

This file was deleted.

123 changes: 0 additions & 123 deletions pkg/boldi-webalbum-app/boldi/webalbum/app/settings.py

This file was deleted.

23 changes: 0 additions & 23 deletions pkg/boldi-webalbum-app/boldi/webalbum/app/urls.py

This file was deleted.

16 changes: 0 additions & 16 deletions pkg/boldi-webalbum-app/boldi/webalbum/app/wsgi.py

This file was deleted.

10 changes: 4 additions & 6 deletions pkg/boldi-webalbum-app/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ license = { text = "MIT" }
dynamic = ["version"]

dependencies = [
# boldi:
"Django>=5.1",
"boldi-cli",
"fastapi",
"uvicorn[standard]"
]

[project.optional-dependencies]
dev = ["django-stubs"]

[project.entry-points."boldi.cli.action"]
webalbum-app = "boldi.webalbum.app.cli:cli_webalbum_app"
webalbum-app = "boldi.webalbum.app:cli_webalbum_app"

[build-system]
requires = ["hatchling", "hatch-vcs"]
Expand Down
4 changes: 0 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@ packages = [
]
mypy_path = "pkg/boldi:pkg/boldi-backup:pkg/boldi-build:pkg/boldi-cli:pkg/boldi-ctx:pkg/boldi-githooks:pkg/boldi-plugins:pkg/boldi-proc:pkg/boldi-sitebuilder:pkg/boldi-webalbum:pkg/boldi-webalbum-app"
check_untyped_defs = true
plugins = ["mypy_django_plugin.main"]

[tool.django-stubs]
django_settings_module = "boldi.webalbum.app.settings"

[tool.pyright]
venvPath = "."
Expand Down
Loading