Skip to content

Commit c972f45

Browse files
committed
Check that pyproject.toml has required fields
1 parent ddd6d2f commit c972f45

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

repo2docker/buildpacks/pyproject/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,5 +135,14 @@ def detect(self):
135135
return False
136136

137137
pyproject_file = self.binder_path("pyproject.toml")
138+
with open(pyproject_file, "rb") as _pyproject_file:
139+
pyproject_toml = tomllib.load(_pyproject_file)
140+
141+
if (
142+
("project" in pyproject_toml)
143+
and ("build-system" in pyproject_toml)
144+
and ("requires" in pyproject_toml["build-system"])
145+
):
146+
return os.path.exists(pyproject_file)
138147

139-
return os.path.exists(pyproject_file)
148+
return False

0 commit comments

Comments
 (0)