Skip to content

Commit

Permalink
CLI Source Option (#11)
Browse files Browse the repository at this point in the history
* option to source custom code in CLI

* removed empty dicts

* [Automated] Updated coverage badge

---------

Co-authored-by: GitHub Actions <[email protected]>
  • Loading branch information
kozlov721 and actions-user committed Oct 9, 2024
1 parent 2c654a5 commit 92fd295
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 239 deletions.
17 changes: 11 additions & 6 deletions luxonis_train/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,18 @@ def common(
"--version", callback=version_callback, help="Show version and exit."
),
] = False,
source: Annotated[
Optional[Path],
typer.Option(
help="Path to a python file with custom components. "
"Will be sourced before running the command.",
metavar="FILE",
),
] = None,
):
...


def main():
app()
if source:
exec(source.read_text())


if __name__ == "__main__":
main()
app()
5 changes: 1 addition & 4 deletions luxonis_train/core/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,12 @@


class Exporter(Core):
"""Main API which is used to create the model, setup pytorch lightning environment
and perform training based on provided arguments and config."""

def __init__(
self,
cfg: str | dict[str, Any] | Config,
opts: list[str] | tuple[str, ...] | dict[str, Any] | None = None,
):
"""Constructs a new Exporter instance.
"""Provides an interface for exporting models to .onnx and .blob formats.
@type cfg: str | dict[str, Any] | Config
@param cfg: Path to config file or config dict used to setup training.
Expand Down
4 changes: 2 additions & 2 deletions media/coverage_badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ classifiers = [
]

[project.scripts]
luxonis_train = "tools.main:main"
luxonis_train = "luxonis_train.__main__:app"

[project.urls]
repository = "https://github.com/luxonis/luxonis-train"
Expand Down
226 changes: 0 additions & 226 deletions tools/main.py

This file was deleted.

0 comments on commit 92fd295

Please sign in to comment.