Skip to content

fastflowtransform.cli.deps_cmd

deps

deps(project='.')

Inspect packages declared in packages.yml and show their resolved status.

For the given project it will:

  • Resolve the project directory.
  • Run the full package resolver (path + git packages):
    • locate or clone/fetch each package
    • load its project.yml manifest (name/version/etc.)
    • enforce version / FFT compatibility / inter-package deps
    • write packages.lock.yml with pinned sources
  • For each resolved package, print:
    • name + version
    • source kind (path | git) and concrete location
    • models_dir and resolved models root
  • Exit with non-zero status if any package's models_dir is missing.
Source code in src/fastflowtransform/cli/deps_cmd.py
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
def deps(project: ProjectArg = ".") -> None:
    """
    Inspect packages declared in packages.yml and show their resolved status.

    For the given project it will:

      - Resolve the project directory.
      - Run the full package resolver (path + git packages):
          * locate or clone/fetch each package
          * load its project.yml manifest (name/version/etc.)
          * enforce version / FFT compatibility / inter-package deps
          * write packages.lock.yml with pinned sources
      - For each resolved package, print:
          * name + version
          * source kind (path | git) and concrete location
          * models_dir and resolved models root
      - Exit with non-zero status if any package's models_dir is missing.
    """
    proj = _resolve_project_path(project)

    try:
        pkgs = resolve_packages(proj)
    except Exception as exc:  # pragma: no cover - resolution error path
        # Keep this as a single, clear error line; resolve_packages already
        # does step-by-step validation (git, refs, manifest, versions, etc.).
        raise typer.BadParameter(f"Failed to resolve packages: {exc}") from exc

    echo(f"Project: {proj}")

    if not pkgs:
        echo("No packages configured (packages.yml not found or empty).")
        raise typer.Exit(0)

    echo("Packages:")
    missing = 0

    for pkg in pkgs:
        models_root = pkg.root / pkg.models_dir
        status = "OK"
        if not models_root.exists():
            status = "MISSING: models_dir not found"
            missing += 1

        echo(f"  - {pkg.name} ({pkg.version})")
        echo(f"      kind:       {pkg.source.kind}")
        if pkg.source.kind == "path":
            echo(f"      path:       {pkg.root}")
        else:
            echo(f"      git:        {pkg.source.git}")
            echo(f"      rev:        {pkg.source.rev}")
            if pkg.source.subdir:
                echo(f"      subdir:     {pkg.source.subdir}")
        echo(f"      models_dir: {pkg.models_dir}  -> {models_root}")
        echo(f"      status:     {status}")

    # Non-zero exit if any package is structurally broken
    raise typer.Exit(1 if missing else 0)