Skip to content

Get app names from infra dir

Get apps based on names in infra/.

Parameters:

Name Type Description Default
dir Path

Should be a location of template-infra or an instance of it

required
Source code in nava/platform/projects/get_app_names_from_infra_dir.py
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
def get_app_names_from_infra_dir(dir: Path) -> list[str]:
    """Get apps based on names in infra/.

    Args:
        dir: Should be a location of `template-infra` or an instance of it
    """
    excluded_dirs = [
        "accounts",
        "modules",
        "networks",
        "project-config",
        "test",
    ]
    infra_dir = dir / "infra"
    if not infra_dir.exists():
        return []
    if not infra_dir.is_dir():
        return []

    return sorted(
        [dir.name for dir in infra_dir.iterdir() if dir.is_dir() and dir.name not in excluded_dirs]
    )