From 27e1bc33c6cfc0f2e2ea28a307511abf4117c4b2 Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Mon, 2 Oct 2023 14:17:36 +0200 Subject: [PATCH] chore: version_from_entrypoint - use kwonly args --- src/setuptools_scm/_entrypoints.py | 2 +- src/setuptools_scm/_get_version_impl.py | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/setuptools_scm/_entrypoints.py b/src/setuptools_scm/_entrypoints.py index be6fdddd..50c91829 100644 --- a/src/setuptools_scm/_entrypoints.py +++ b/src/setuptools_scm/_entrypoints.py @@ -45,7 +45,7 @@ def entry_points(group: str) -> EntryPoints: def version_from_entrypoint( - config: Configuration, entrypoint: str, root: _t.PathT + config: Configuration, *, entrypoint: str, root: _t.PathT ) -> version.ScmVersion | None: from .discover import iter_matching_entrypoints diff --git a/src/setuptools_scm/_get_version_impl.py b/src/setuptools_scm/_get_version_impl.py index 8be513aa..2d9d9478 100644 --- a/src/setuptools_scm/_get_version_impl.py +++ b/src/setuptools_scm/_get_version_impl.py @@ -32,18 +32,22 @@ def parse_scm_version(config: Configuration) -> ScmVersion | None: ) return parse_result else: - entrypoint = "setuptools_scm.parse_scm" - root = config.absolute_root - return _entrypoints.version_from_entrypoint(config, entrypoint, root) + return _entrypoints.version_from_entrypoint( + config, + entrypoint="setuptools_scm.parse_scm", + root=config.absolute_root, + ) except _run_cmd.CommandNotFoundError as e: _log.exception("command %s not found while parsing the scm, using fallbacks", e) return None def parse_fallback_version(config: Configuration) -> ScmVersion | None: - entrypoint = "setuptools_scm.parse_scm_fallback" - root = config.fallback_root - return _entrypoints.version_from_entrypoint(config, entrypoint, root) + return _entrypoints.version_from_entrypoint( + config, + entrypoint="setuptools_scm.parse_scm_fallback", + root=config.fallback_root, + ) def parse_version(config: Configuration) -> ScmVersion | None: