diff --git a/sdkbuild/python.go b/sdkbuild/python.go index 6147112e..67c4d0a0 100644 --- a/sdkbuild/python.go +++ b/sdkbuild/python.go @@ -120,14 +120,16 @@ requires-python = "~=3.10" if err := executeCommand("uv", "add", "--dev", "mypy"); err != nil { return nil, fmt.Errorf("failed installing mypy: %w", err) } - + // Create __init__.py files in feature directories to make them proper Python packages - if err := executeCommand("find", "../features", "-type", "d", "-exec", "touch", "{}/__init__.py", ";"); err != nil { - return nil, fmt.Errorf("failed creating __init__.py files: %w", err) - } - - if err := executeCommand("uv", "run", "mypy", "--explicit-package-bases", "../features"); err != nil { - return nil, fmt.Errorf("failed type checking: %w", err) + if _, err := os.Stat(filepath.Join(dir, "../features")); err == nil { + if err := executeCommand("find", "../features", "-type", "d", "-exec", "touch", "{}/__init__.py", ";"); err != nil { + return nil, fmt.Errorf("failed creating __init__.py files: %w", err) + } + + if err := executeCommand("uv", "run", "mypy", "--explicit-package-bases", "../features"); err != nil { + return nil, fmt.Errorf("failed type checking: %w", err) + } } success = true