@@ -271,6 +271,7 @@ def from_file(
271
271
name : str | os .PathLike [str ] = "pyproject.toml" ,
272
272
dist_name : str | None = None ,
273
273
missing_file_ok : bool = False ,
274
+ missing_section_ok : bool = False ,
274
275
** kwargs : Any ,
275
276
) -> Configuration :
276
277
"""
@@ -279,10 +280,20 @@ def from_file(
279
280
not installed or the file has invalid format or does
280
281
not contain setuptools_scm configuration (either via
281
282
_ [tool.setuptools_scm] section or build-system.requires).
283
+
284
+ Parameters:
285
+ - name: path to pyproject.toml
286
+ - dist_name: name of the distribution
287
+ - missing_file_ok: if True, do not raise an error if the file is not found
288
+ - missing_section_ok: if True, do not raise an error if the section is not found
289
+ (workaround for not walking the dependency graph when figuring out if setuptools_scm is a dependency)
290
+ - **kwargs: additional keyword arguments to pass to the Configuration constructor
282
291
"""
283
292
284
293
try :
285
- pyproject_data = _read_pyproject (Path (name ))
294
+ pyproject_data = _read_pyproject (
295
+ Path (name ), missing_section_ok = missing_section_ok
296
+ )
286
297
except FileNotFoundError :
287
298
if missing_file_ok :
288
299
log .warning ("File %s not found, using empty configuration" , name )
0 commit comments