Skip to content

refactor: unify CLI, kill Settings hack, dedup queue init - #28

Merged
janbjorge merged 9 commits into
mainfrom
refactor/unified-cli
Apr 19, 2026
Merged

janbjorge merged 9 commits into
mainfrom
refactor/unified-cli

Conversation

@janbjorge

Copy link
Copy Markdown
Owner
  • Add pipegate/cli.py: single typer entry point with token/client/server subcommands. Replaces three separate python -m invocations.
  • auth.py: replace make_jwt_bearer() + Settings(_cli_parse_args=True) hack with pure generate_token(connection_id, settings) -> tuple[str, str].
  • client.py: strip typer app wiring; keep handle_request/main as pure async.
  • server.py: extract _get_or_create_queue() to remove duplicated init logic in handle_http_request and handle_websocket; drop main block.
  • pyproject.toml: add [project.scripts] pipegate = "pipegate.cli:app".
  • Tests: add TestGenerateToken (5 cases) and test_cli.py (7 cases); remove all Settings(_cli_parse_args=False) noise from fixtures.
  • README: update all python -m pipegate.* to pipegate token/client/server.

- Add pipegate/cli.py: single typer entry point with token/client/server
  subcommands. Replaces three separate python -m invocations.
- auth.py: replace make_jwt_bearer() + Settings(_cli_parse_args=True) hack
  with pure generate_token(connection_id, settings) -> tuple[str, str].
- client.py: strip typer app wiring; keep handle_request/main as pure async.
- server.py: extract _get_or_create_queue() to remove duplicated init logic
  in handle_http_request and handle_websocket; drop __main__ block.
- pyproject.toml: add [project.scripts] pipegate = "pipegate.cli:app".
- Tests: add TestGenerateToken (5 cases) and test_cli.py (7 cases);
  remove all Settings(_cli_parse_args=False) noise from fixtures.
- README: update all python -m pipegate.* to pipegate token/client/server.
… setdefault

- generate_token(settings, connection_id=None): explicit arg > env var > random UUID.
  Removes the Settings(_cli_parse_args=True) hack while keeping the UX.
- token_cmd: add --connection-id / -c Typer option.
- server.py: revert setdefault back to explicit check — setdefault eagerly
  constructs asyncio.Queue on every request even when key exists (hot path).
- README: document both --connection-id flag and PIPEGATE_CONNECTION_ID env var.
- Tests: cover flag, env var, and flag-over-env precedence.
@janbjorge
janbjorge merged commit 773cfbf into main Apr 19, 2026
4 checks passed
@janbjorge
janbjorge deleted the refactor/unified-cli branch April 19, 2026 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant