diff --git a/src/poetry/layouts/layout.py b/src/poetry/layouts/layout.py index f5dfd28e950..e81d201ebb8 100644 --- a/src/poetry/layouts/layout.py +++ b/src/poetry/layouts/layout.py @@ -90,7 +90,11 @@ def package_path(self) -> Path: def get_package_include(self) -> InlineTable | None: package = inline_table() - include = self._package_path_relative.parts[0] + parts = self._package_path_relative.parts + if not parts: + return None + + include = parts[0] package.append("include", include) # type: ignore[no-untyped-call] if self.basedir != Path():