From eb59201397e15d6de33b4aa741d04ae27da3317d Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 21 Oct 2019 19:59:01 -0400 Subject: Illustrate how reading the config from a file might operate. --- src/setuptools_scm/config.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/setuptools_scm/config.py b/src/setuptools_scm/config.py index e69d8fe..20e97b3 100644 --- a/src/setuptools_scm/config.py +++ b/src/setuptools_scm/config.py @@ -107,8 +107,12 @@ class Configuration(object): self._tag_regex = _check_tag_regex(value) @classmethod - def from_file(cls): + def from_file(cls, name='pyproject.toml'): """ Read Configuration from pyproject.toml (or similar) """ - # stubbed + with open(name) as strm: + defn = __import__('toml').load(strm) + config = cls() + vars(config).update(defn.get('setuptools_scm', {})) + return config -- cgit v1.2.1