mirror of
https://github.com/fusion44/blitz_api.git
synced 2026-08-14 12:02:46 +02:00
The project switched from poetry to uv in 44385ca, but the flake still
built everything through poetry2nix (an undeclared input resolved via
the flake registry) and no longer evaluated against the uv-based
pyproject.toml.
- build packages.blitz-api as a uv2nix virtualenv from uv.lock
(wheels preferred), keeping the bin/api entry point the NixOS
module expects
- replace the poetry dev shell with a uv-based tooling shell that
mirrors devenv.nix
- move click to the main dependencies: the api console script
imports it at runtime, so a production install without the dev
group would crash on startup
- update the nixpkgs pin so the dev shell ships a uv that
understands the current lockfile revision
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
33 lines
818 B
Python
33 lines
818 B
Python
import uvicorn
|
|
|
|
from app.api.config import config
|
|
|
|
import click # isort:skip
|
|
|
|
|
|
@click.command()
|
|
@click.option("--port", default="5000", help="Port to run Blitz API on")
|
|
@click.option("--host", default="127.0.0.1", help="Host to run Blitz API on")
|
|
@click.option(
|
|
"--root_path",
|
|
default=None,
|
|
help="Set the ASGI 'root_path' for applications submounted below a given URL path.",
|
|
)
|
|
def main(port, host, root_path):
|
|
"""Launched with `uv run api` at root level"""
|
|
|
|
p = ""
|
|
if root_path is not None and root_path != "":
|
|
p = root_path
|
|
else:
|
|
p = str(config("BAPI_ROOT_PATH", default=""))
|
|
|
|
if p == "/":
|
|
root_path = ""
|
|
|
|
print(f"launching with {host}:{port}{p}")
|
|
uvicorn.run("app.main:app", port=port, host=host, root_path=p)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|