diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2019-10-21 19:59:01 -0400 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2019-10-21 19:59:01 -0400 |
| commit | eb59201397e15d6de33b4aa741d04ae27da3317d (patch) | |
| tree | b0b47fcd9f7818ca723f7cdaaec63d983948ee66 /src | |
| parent | d1e6c60414f99aab601342f77f312599ebd4cd53 (diff) | |
| download | setuptools-scm-feature/declarative-config.tar.gz | |
Illustrate how reading the config from a file might operate.feature/declarative-config
Diffstat (limited to 'src')
| -rw-r--r-- | src/setuptools_scm/config.py | 8 |
1 files changed, 6 insertions, 2 deletions
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 |
