Skip to content

Conversation

@jotaen4tinypilot
Copy link
Contributor

@jotaen4tinypilot jotaen4tinypilot commented Sep 3, 2025

Resolves #1690.
(Successor of https://github.com/tiny-pilot/tinypilot-pro/pull/1602.)

This PR introduces a new, internal Flask-less CLI entrypoint to our app, for programmatic access of certain features (mainly DB-related).

As a first use-case, it migrates the streaming-mode CLI command, mainly to demonstrate how this is intended to be used. We’ll soon add another command for retrieving the serial settings. In a subsequent step, we can also migrate the last remaining command for activating a license and thereby sunset the Flask CLI entrypoint altogether. (I’d create a separate ticket for that.)

Notes

  • Although the footprint of the CLI functionality is still quite small (and is unlikely to grow substantially in the near-to-mid future), I thought that a separate Python module (directory) was warranted (app/cli). That way, we hopefully have a clearer separation from the web app, and we are also a bit more flexible to structure the code nicely.
  • I introduced a @command annotation to make it convenient to register commands. My thinking is not to go overboard with this, though – e.g., I’d not expand this mechanism to include arg-parsing etc., as it would then probably make more sense to rather keep the Flask CLI or introduce another framework. The main intention of @command is to have all command-related code closely together, as opposed to having to define the function in one place and then “register” it in a second. Since the whole CLI is more of an internal helper utility, I think it’s fair to keep the whole structure basic.

Review on CodeApprove

Copy link
Contributor Author

Automated comment from CodeApprove ➜

@jdeanwallace please review this Pull Request

Copy link
Contributor

@jdeanwallace jdeanwallace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated comment from CodeApprove ➜

Approved on CodeApprove
✔️ Approved

LGTM!


👀 @jotaen4tinypilot it's your turn please take a look

@jotaen4tinypilot jotaen4tinypilot merged commit 7520fc9 into master Sep 3, 2025
14 checks passed
@jotaen4tinypilot jotaen4tinypilot deleted the internal-cli branch September 3, 2025 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Find way for accessing SQlite DB programmatically

4 participants