From 3faa5226eb4c70b0682c07409ae9714a73422edf Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sat, 22 Feb 2025 21:09:34 +0100 Subject: [PATCH 01/32] Apply ruff/flake8-pie rule PIE790 PIE790 Unnecessary `pass` statement --- src/setuptools_scm/git.py | 2 -- src/setuptools_scm/hg.py | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/setuptools_scm/git.py b/src/setuptools_scm/git.py index 246df477..5ccea89f 100644 --- a/src/setuptools_scm/git.py +++ b/src/setuptools_scm/git.py @@ -224,8 +224,6 @@ def version_from_describe( config: Configuration, describe_command: _t.CMD_TYPE | None, ) -> ScmVersion | None: - pass - if config.git_describe_command is not None: describe_command = config.git_describe_command diff --git a/src/setuptools_scm/hg.py b/src/setuptools_scm/hg.py index 43fb295b..d8307c78 100644 --- a/src/setuptools_scm/hg.py +++ b/src/setuptools_scm/hg.py @@ -102,8 +102,8 @@ def get_meta(self, config: Configuration) -> ScmVersion | None: return meta(tag, config=config, node_date=node_date) except ValueError: + # unpacking failed, old hg log.exception("error") - pass # unpacking failed, old hg return None From 46e5b2f6d2e443f33e4de7126c3bc5cccebbfde2 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sat, 22 Feb 2025 21:13:38 +0100 Subject: [PATCH 02/32] Apply ruff/flake8-logging rule LOG009 LOG009 Use of undocumented `logging.WARN` constant --- src/setuptools_scm/_log.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/setuptools_scm/_log.py b/src/setuptools_scm/_log.py index 7e4b7db7..5dd2964e 100644 --- a/src/setuptools_scm/_log.py +++ b/src/setuptools_scm/_log.py @@ -51,7 +51,7 @@ def make_default_handler() -> logging.Handler: def _default_log_level(_env: Mapping[str, str] = os.environ) -> int: val: str | None = _env.get("SETUPTOOLS_SCM_DEBUG") - return logging.WARN if val is None else logging.DEBUG + return logging.WARNING if val is None else logging.DEBUG log.setLevel(_default_log_level()) From 62121f2fc547be0634055b3683e463d5964730af Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sat, 22 Feb 2025 21:32:48 +0100 Subject: [PATCH 03/32] Apply ruff/pygrep-hooks rule PGH003 PGH003 Use specific rule codes when ignoring type issues --- src/setuptools_scm/_version_cls.py | 8 ++++++-- testing/test_file_finder.py | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/setuptools_scm/_version_cls.py b/src/setuptools_scm/_version_cls.py index bb89bbb1..05dac6c0 100644 --- a/src/setuptools_scm/_version_cls.py +++ b/src/setuptools_scm/_version_cls.py @@ -8,8 +8,12 @@ from packaging.version import InvalidVersion from packaging.version import Version as Version except ImportError: - from setuptools.extern.packaging.version import InvalidVersion # type: ignore - from setuptools.extern.packaging.version import Version as Version # type: ignore + from setuptools.extern.packaging.version import ( # type: ignore[import-untyped, no-redef] + InvalidVersion, + ) + from setuptools.extern.packaging.version import ( # type: ignore[no-redef] + Version as Version, + ) from . import _log log = _log.log.getChild("version_cls") diff --git a/testing/test_file_finder.py b/testing/test_file_finder.py index cc1a08fd..5902d8e5 100644 --- a/testing/test_file_finder.py +++ b/testing/test_file_finder.py @@ -16,7 +16,7 @@ def inwd( request: pytest.FixtureRequest, wd: WorkDir, monkeypatch: pytest.MonkeyPatch ) -> WorkDir: - param: str = request.param # type: ignore + param: str = request.param # type: ignore[attr-defined] if param == "git": try: wd("git init") From f3e8c7887e04255fa3ec6bb30c850a3744e0df62 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sat, 22 Feb 2025 21:23:01 +0100 Subject: [PATCH 04/32] Apply ruff/pygrep-hooks rule PGH004 PGH004 Use specific rule codes when using `noqa` --- src/setuptools_scm/_version_cls.py | 2 +- testing/test_cli.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/setuptools_scm/_version_cls.py b/src/setuptools_scm/_version_cls.py index 05dac6c0..493ed836 100644 --- a/src/setuptools_scm/_version_cls.py +++ b/src/setuptools_scm/_version_cls.py @@ -87,7 +87,7 @@ def _validate_version_cls( elif isinstance(version_cls, str): try: return cast(Type[_VersionT], import_name(version_cls)) - except: # noqa + except Exception: raise ValueError( f"Unable to import version_cls='{version_cls}'" ) from None diff --git a/testing/test_cli.py b/testing/test_cli.py index 7bb87f4a..050fe031 100644 --- a/testing/test_cli.py +++ b/testing/test_cli.py @@ -9,7 +9,7 @@ from setuptools_scm._cli import main from .conftest import DebugMode -from .test_git import wd as wd_fixture # NOQA evil fixture reuse +from .test_git import wd as wd_fixture # noqa: F401 (evil fixture reuse) from .wd_wrapper import WorkDir PYPROJECT_TOML = "pyproject.toml" From 21af19b99f6f656686ba36785645919637b8d5f6 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sat, 22 Feb 2025 21:49:52 +0100 Subject: [PATCH 05/32] Apply ruff/Pylint PLR5501 PLR5501 Use `elif` instead of `else` then `if`, to reduce indentation --- src/setuptools_scm/_version_cls.py | 21 +++++++++------------ src/setuptools_scm/version.py | 15 +++++++-------- 2 files changed, 16 insertions(+), 20 deletions(-) diff --git a/src/setuptools_scm/_version_cls.py b/src/setuptools_scm/_version_cls.py index 493ed836..be178f28 100644 --- a/src/setuptools_scm/_version_cls.py +++ b/src/setuptools_scm/_version_cls.py @@ -80,16 +80,13 @@ def _validate_version_cls( "`normalize=False`" ) return NonNormalizedVersion + # Use `version_cls` if provided, default to packaging or pkg_resources + elif version_cls is None: + return Version + elif isinstance(version_cls, str): + try: + return cast(Type[_VersionT], import_name(version_cls)) + except Exception: + raise ValueError(f"Unable to import version_cls='{version_cls}'") from None else: - # Use `version_cls` if provided, default to packaging or pkg_resources - if version_cls is None: - return Version - elif isinstance(version_cls, str): - try: - return cast(Type[_VersionT], import_name(version_cls)) - except Exception: - raise ValueError( - f"Unable to import version_cls='{version_cls}'" - ) from None - else: - return version_cls + return version_cls diff --git a/src/setuptools_scm/version.py b/src/setuptools_scm/version.py index ef36be4f..633351c9 100644 --- a/src/setuptools_scm/version.py +++ b/src/setuptools_scm/version.py @@ -263,15 +263,14 @@ def guess_next_simple_semver( def simplified_semver_version(version: ScmVersion) -> str: if version.exact: return guess_next_simple_semver(version, retain=SEMVER_LEN, increment=False) + elif version.branch is not None and "feature" in version.branch: + return version.format_next_version( + guess_next_simple_semver, retain=SEMVER_MINOR + ) else: - if version.branch is not None and "feature" in version.branch: - return version.format_next_version( - guess_next_simple_semver, retain=SEMVER_MINOR - ) - else: - return version.format_next_version( - guess_next_simple_semver, retain=SEMVER_PATCH - ) + return version.format_next_version( + guess_next_simple_semver, retain=SEMVER_PATCH + ) def release_branch_semver_version(version: ScmVersion) -> str: From 1cb6a805884c4113b7269ab951a2c4de3dd3a046 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sat, 22 Feb 2025 21:52:19 +0100 Subject: [PATCH 06/32] Apply ruff/Pylint rule PLW0120 PLW0120 `else` clause on loop without a `break` statement; remove the `else` and dedent its contents --- _own_version_helper.py | 3 +-- src/setuptools_scm/_entrypoints.py | 3 +-- src/setuptools_scm/git.py | 15 +++++++-------- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/_own_version_helper.py b/_own_version_helper.py index da7484fe..d0d7433c 100644 --- a/_own_version_helper.py +++ b/_own_version_helper.py @@ -44,8 +44,7 @@ def parse(root: str, config: Configuration) -> ScmVersion | None: else: if parsed is not None: return parsed - else: - return None + return None def scm_version() -> str: diff --git a/src/setuptools_scm/_entrypoints.py b/src/setuptools_scm/_entrypoints.py index 5eab1ed2..811fb5f5 100644 --- a/src/setuptools_scm/_entrypoints.py +++ b/src/setuptools_scm/_entrypoints.py @@ -72,8 +72,7 @@ def _get_ep(group: str, name: str) -> Any | None: for ep in iter_entry_points(group, name): log.debug("ep found: %s", ep.name) return ep.load() - else: - return None + return None def _get_from_object_reference_str(path: str, group: str) -> Any | None: diff --git a/src/setuptools_scm/git.py b/src/setuptools_scm/git.py index 5ccea89f..5be2f89d 100644 --- a/src/setuptools_scm/git.py +++ b/src/setuptools_scm/git.py @@ -321,15 +321,14 @@ def archival_to_version( version = tag_to_version(ref, config) if version is not None: return meta(version, config=config) + node = data.get("node") + if node is None: + return None + elif "$FORMAT" in node.upper(): + warnings.warn("unprocessed git archival found (no export subst applied)") + return None else: - node = data.get("node") - if node is None: - return None - elif "$FORMAT" in node.upper(): - warnings.warn("unprocessed git archival found (no export subst applied)") - return None - else: - return meta("0.0", node=node, config=config) + return meta("0.0", node=node, config=config) def parse_archival(root: _t.PathT, config: Configuration) -> ScmVersion | None: From 46db47bbd84716ae9ce6cd35d0a9497276916c52 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sat, 22 Feb 2025 21:53:13 +0100 Subject: [PATCH 07/32] Apply ruff/Pylint rule PLW3201 PLW3201 Dunder method `__init___` has no special meaning in Python 3 --- src/setuptools_scm/_log.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/setuptools_scm/_log.py b/src/setuptools_scm/_log.py index 5dd2964e..f25a9130 100644 --- a/src/setuptools_scm/_log.py +++ b/src/setuptools_scm/_log.py @@ -18,7 +18,7 @@ class AlwaysStdErrHandler(logging.StreamHandler): # type: ignore[type-arg] - def __init___(self) -> None: + def __init__(self) -> None: super().__init__(sys.stderr) @property # type: ignore [override] From a7bedd5f09f3ca67d8b130bfc8197b3136f74148 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Wed, 15 Jan 2025 18:02:16 +0100 Subject: [PATCH 08/32] pre-commit autoupdate --- .pre-commit-config.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a9397bcf..113121b1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,26 +1,26 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v5.0.0 hooks: - id: trailing-whitespace - id: check-yaml - id: debug-statements - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.9.1 + rev: v0.9.7 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix, --show-fixes] - id: ruff-format - repo: https://github.com/tox-dev/pyproject-fmt - rev: 1.7.0 + rev: v1.8.0 hooks: - id: pyproject-fmt exclude: docs/examples/ - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.9.0 + rev: v1.15.0 hooks: - id: mypy args: [--strict] @@ -34,6 +34,6 @@ repos: - rich - repo: https://github.com/scientific-python/cookie - rev: 2024.04.23 + rev: 2025.01.22 hooks: - id: sp-repo-review From 09e8aa0115d1b38d091c26b18a8b98b3b6e8bb58 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sat, 22 Feb 2025 20:49:24 +0100 Subject: [PATCH 09/32] Fix mypy [unused-ignore] error Unused "type: ignore" comment --- src/setuptools_scm/_log.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/setuptools_scm/_log.py b/src/setuptools_scm/_log.py index 7e4b7db7..edab1e79 100644 --- a/src/setuptools_scm/_log.py +++ b/src/setuptools_scm/_log.py @@ -21,7 +21,7 @@ class AlwaysStdErrHandler(logging.StreamHandler): # type: ignore[type-arg] def __init___(self) -> None: super().__init__(sys.stderr) - @property # type: ignore [override] + @property def stream(self) -> IO[str]: return sys.stderr From 5ed40fd7485fb7526bd699d59dc0a3782849d953 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sat, 22 Feb 2025 20:58:10 +0100 Subject: [PATCH 10/32] Apply sp-repo-review rule RF003 src directory doesn't need to be specified anymore (0.6+) --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index acb04a3b..2ab35e75 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -117,7 +117,6 @@ version = { attr = "_own_version_helper.version"} [tool.setuptools_scm] [tool.ruff] -src = ["src"] lint.select = ["E", "F", "B", "UP", "YTT", "C", "DTZ", "PYI", "PT", "I", "FURB", "RUF"] lint.ignore = ["B028"] lint.preview = true From fcbd08dbb8cc94c606d9305ada12bd77a439dc58 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sat, 22 Feb 2025 21:07:01 +0100 Subject: [PATCH 11/32] Python 3.13 --- nextgen/vcs-versioning/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nextgen/vcs-versioning/pyproject.toml b/nextgen/vcs-versioning/pyproject.toml index f71b85a5..6d1d2368 100644 --- a/nextgen/vcs-versioning/pyproject.toml +++ b/nextgen/vcs-versioning/pyproject.toml @@ -48,7 +48,7 @@ cov = "pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=vcs_ve no-cov = "cov --no-cov {args}" [[tool.hatch.envs.test.matrix]] -python = ["38", "39", "310", "311"] +python = [ "38", "39", "310", "311", "312", "313" ] [tool.coverage.run] branch = true From c5d444ed290819cfdcf9ffca1556b320478cb686 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sat, 22 Feb 2025 22:19:24 +0100 Subject: [PATCH 12/32] Ignore ruff/flake8-pytest-style rule PT030 PT030 `pytest.warns(UserWarning)` is too broad, set the `match` parameter or use a more specific warning --- testing/test_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/test_version.py b/testing/test_version.py index edbb9dae..32a65c0d 100644 --- a/testing/test_version.py +++ b/testing/test_version.py @@ -213,7 +213,7 @@ def test_only_version(version: str) -> None: def test_tag_regex1(tag: str, expected: str) -> None: if "+" in tag: # pytest bug wrt cardinality - with pytest.warns(UserWarning): + with pytest.warns(UserWarning): # noqa: PT030 result = meta(tag, config=c) else: result = meta(tag, config=c) From 80fcf3216a6f93b7fc5570a63af41fbbb8b3ef37 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Sun, 23 Feb 2025 16:35:32 +0000 Subject: [PATCH 13/32] Update changelog and show it to documentation --- CHANGELOG.md | 239 +++++++++++++++++++++++----------------------- docs/changelog.md | 3 + mkdocs.yml | 2 + pyproject.toml | 1 + 4 files changed, 125 insertions(+), 120 deletions(-) create mode 100644 docs/changelog.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 0182fed7..184f62c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,33 +1,33 @@ +# Changelog -# v8.2.0 +## v8.2.0 -## Added +### Added - fix #960: add a ``--force-write-version-files`` flag for the cli -## Changed +### Changed - fix #950: ensure to pass encodings to io usage -- fix #957 - add subprocess timeout control env var +- fix #957: add subprocess timeout control env var - add sp-repo-review pre-commit hook -## Fixed +### Fixed - fix #1018: allow non-normalized versions for semver - fix #1103: respect GIT_CEILING_DIRECTORIES when trying to find git toplevels - fix #1081: add name normalized pipx entrypoint - fix #1080: clean pdm from PYTHONPATH to protect mercurial -- -# 8.1.0 +## v8.1.0 -## Changed +### Changed - inclusion of `__all__` in autogenerated `version.py` files to aid IDE autoimports -# v8.0.4 +## v8.0.4 -## Changed +### Changed - introduce scriv for changelog management - reconfigure local build backend to use an attribute instead of star imports from setuptools @@ -36,24 +36,23 @@ - add build and wheel to the test requirements for regression testing - move internal toml handling to own module -## Fixed +### Fixed - fix #925: allow `write_to` to be an absolute path when it's a subdirectory of the root - fix #932: ensure type annotations in version file don't cause linter issues - fix #930: temporary restore `DEFAULT_VERSION_SCHEME` and `DEFAULT_LOCAL_SCHEME` on the `setuptools-scm` package +## v8.0.3 -# v8.0.3 - -## bugfix +### Fixed - fix #918 for good - remove external importlib-metadata to avoid source only loop - fix #926: ensure mypy on python3.8 works with the version file -# v8.0.2 +## v8.0.2 -## bugfix +### Fixed - fix #919: restore legacy version-file behaviour for external callers + add Deprecation warning - fix #918: use packaging from setuptools for self-build @@ -63,16 +62,16 @@ to account for large repos or slow connections -# v8.0.1 +## v8.0.1 -## bugfix +### Fixed - update version file template to work on older python versions by using type comments - ensure tag regex from setup.py is parsed into regex -# v8.0.0 +## v8.0.0 -## breaking +### breaking - remove legacy version parser api - config arg always required - turn Configuration into a dataclass @@ -88,7 +87,7 @@ - introduce `version_file` as replacement for `write_to` - renameed the project from `setuptools_scm` to `setuptools-scm` -## features +### Added - created a directory for the vcs-versioning package and added it to pypi - git: expect main as possible default branch @@ -109,48 +108,48 @@ - fix #527: type annotation in default version template - fix #549: use fallbacks when scm search raises CommandNotFoundError -## bugfixes +### Fixed - fix #883: use HeadersParser to ensure only mime metadata in headers is used - fix #884: parse calver dates from versions with the v prefix - don't use a C locale without UTF-8 support, when running commands. -# v7.1.0 +## v7.1.0 -- #748: use `tomllib` from stdlib +- \#748: use `tomllib` from stdlib - fix #762: handle non-ascii in setup.cfg -- #752: implement fallback file finders for archives -- #765: removed coding header in python template +- \#752: implement fallback file finders for archives +- \#765: removed coding header in python template - declared Python 3.11 support - fix #759: update .git_archival.txt templates match git-describe invocation - fix #772: fix handling of .git-archival.txt from tagged commit -# v7.0.5 +## v7.0.5 - fixes #742, #745: correctly handle accidentally released archival files -# v7.0.4 +## v7.0.4 - fix #727: correctly handle incomplete archival from setuptools_scm_git_archival - fix #691: correctly handle specifying root in pyproject.toml - correct root override check condition (to ensure absolute path matching) - allow root by the cli to be considered relative to the cli (using abspath) -# v7.0.3 +## v7.0.3 - fix mercurial usage when pip primes a isolated environment - fix regression for branch names on git + add a test -# v7.0.2 +## v7.0.2 - fix #723 and #722: remove bootstrap dependencies - ensure we read the distribution name from `setup.cfg` if needed even for `pyproject.toml` -# v7.0.1 +## v7.0.1 - fix #718: Avoid `ModuleNotFoundError` by requiring `importlib_metadata` in `python<3.8` -# v7.0.0 +## v7.0.0 - drop python 3.6 support - include git archival support @@ -158,18 +157,18 @@ (common with misconfigured containers, thanks @chrisburr ) - fix #548: correctly handle parsing the commit timestamp of HEAD when `log.showSignature` is set -# v6.4.2 +## v6.4.2 - fix #671: `NoReturn` is not available in painfully dead python 3.6 -# v6.4.1 +## v6.4.1 - fix regression #669: restore get_version signature - fix #668: harden the self-test for distribution extras -# 6.4.0 +## 6.4.0 -- compatibility adjustments for setuptools \>58 +- compatibility adjustments for setuptools \>58 - only put minimal setuptools version into toml extra to warn people with old strict pins - correctly handle hg-git self-use - better mercurial detection @@ -182,18 +181,18 @@ - ensure no-guess-dev will fail on bad tags instead of generating invalid versions - ensure we use utc everywhere to avoid confusion -# 6.3.2 +## v6.3.2 - fix #629: correctly convert Version data in tags_to_version parser to avoid errors -# 6.3.1 +## v6.3.1 - fix #625: restore tomli in install_requires after the regression changes in took it out and some users never added it even tho they have pyproject.toml files -# 6.3.0 +## v6.3.0 -## warning +### warning This release explicitly warns on unsupported setuptools. This unfortunately has to happen as the legacy `setup_requires` mechanism @@ -207,21 +206,21 @@ to `setup.py`, which would install the required version of setuptools. This mechanism has long since been deprecated and removed as most people haven\'t been using it -## bugfixes +### Fixed - fix #612: depend on packaging to ensure version parsing parts - fix #611: correct the typo that hid away the toml extra and add it in `setup.py` as well - fix #615: restore support for the git_archive plugin which doesn't pass over the config - restore the ability to run on old setuptools while to avoid breaking pipelines -# v6.2.0 +## v6.2.0 - fix #608: resolve tomli dependency issue by making it a hard dependency as all intended/supported install options use pip/wheel this is only a feature release - ensure python 3.10 works -# v6.1.1 +## v6.1.1 - fix #605: completely disallow bdist_egg - modern enough setuptools\>=45 uses pip @@ -232,7 +231,7 @@ haven\'t been using it [tool.setuptools_scm.dist_name]{.title-ref}) section or [setup.cfg]{.title-ref} ([metadata.name]{.title-ref}) -# v6.1.0 +## v6.1.0 - fix #587: don\'t fail file finders when distribution is not given - fix #524: new parameters `normalize` and `version_cls` to customize @@ -247,11 +246,11 @@ haven\'t been using it - fix #557: Use `packaging.version` for `version_tuple` - fix #544: enhance errors on unsupported python/setuptools versions -# v6.0.1 +## v6.0.1 - fix #537: drop node_date on old git to avoid errors on missing %cI -# v6.0.0 +## v6.0.0 - fix #517: drop dead python support \>3.6 required - drop dead setuptools support \> 45 required (can install wheels) @@ -261,18 +260,18 @@ haven\'t been using it schemes - support for calendar versioning (calver) by date -# v5.0.2 +## v5.0.2 - fix #415: use git for matching prefixes to support the windows situation -# v5.0.1 +## v5.0.1 - fix #509: support `SETUPTOOLS_SCM_PRETEND_VERSION_FOR_${DISTRIBUTION_NAME}` for `pyproject.toml` -# v5.0.0 +## v5.0.0 -Breaking changes: +### Breaking changes - fix #339: strict errors on missing scm when parsing a scm dir to avoid false version lookups @@ -280,7 +279,7 @@ Breaking changes: it as direct target instead of the containing folder and print a warning -Bugfixes: +### Fixed - fix #352: add support for generally ignoring specific vcs roots - fix #471: better error for version bump failing on complex but @@ -300,16 +299,16 @@ Bugfixes: - fix #213: better error message for non-zero dev numbers in tags - fix #356: add git branch to version on describe failure -# v4.1.2 +## v4.1.2 - disallow git tags without dots by default again - #449 -# v4.1.1 +## v4.1.1 - drop jaraco.windows from pyproject.toml, allows for wheel builds on python2 -# v4.1.0 +## v4.1.0 - include python 3.9 via the deadsnakes action - return release_branch_semver scheme (it got dropped in a bad rebase) @@ -321,7 +320,7 @@ Bugfixes: - correct the tox flake8 invocation - trigger builds on tags again -# v4.0.0 +## v4.0.0 - Add `parentdir_prefix_version` to support installs from GitHub release tarballs. @@ -340,35 +339,35 @@ Bugfixes: - make global configuration available to version metadata - drop official support for python 3.4 -# v3.5.0 +## v3.5.0 - add `no-local-version` local scheme and improve documentation for schemes -# v3.4.4 +## v3.4.4 - fix #403: also sort out resource warnings when dealing with git file finding -# v3.4.3 +## v3.4.3 - fix #399: ensure the git file finder terminates subprocess after reading archive -# v3.4.2 +## v3.4.2 - fix #395: correctly transfer tag regex in the Configuration constructor - rollback \--first-parent for git describe as it turns out to be a regression for some users -# v3.4.1 +## v3.4.1 - pull in #377 to fix #374: correctly set up the default version scheme for pyproject usage. this bugfix got missed when rushing the release. -# v3.4.0 +## v3.4.0 - fix #181 - add support for projects built under setuptools declarative config by way of the @@ -383,49 +382,49 @@ Bugfixes: - use \--first-parent for git describe -# v3.3.3 +## v3.3.3 - add eggs for python3.7 and 3.8 to the deploy -# v3.3.2 +## v3.3.2 - fix #335 - fix python3.8 support and add builds for up to python3.8 -# v3.3.1 +## v3.3.1 - fix #333 (regression from #198) - use a specific fallback root when calling fallbacks. Remove old hack that resets the root when fallback entrypoints are present. -# v3.3.0 +## v3.3.0 - fix #198 by adding the `fallback_version` option, which sets the version to be used when everything else fails. -# v3.2.0 +## v3.2.0 \* fix #303 and #283 by adding the option `git_describe_command` to allow the user to control the way that [git describe]{.title-ref} is called. -# v3.1.0 +## v3.1.0 - fix #297 - correct the invocation in version_from_scm and deprecate it as its exposed by accident - fix #298 - handle git file listing on empty repositories - fix #268 - deprecate ScmVersion.extra -# v3.0.6 +## v3.0.6 - fix #295 - correctly handle self install from tarballs -# v3.0.5 +## v3.0.5 - fix #292 - match leading `V` character as well -# v3.0.4 +## v3.0.4 - re-release of 3.0.3 after fixing the release process @@ -434,17 +433,17 @@ v3.0.3 (pulled from pypi due to a packaging issue) ====== - fix #286 - duo an oversight a helper function was returning a generator instead of a list -# v3.0.2 +## v3.0.2 - fix a regression from tag parsing - support for multi-dashed prefixes - #284 -# v3.0.1 +## v3.0.1 - fix a regression in setuptools_scm.git.parse - reorder arguments so the positional invocation from before works as expected #281 -# v3.0.0 +## v3.0.0 - introduce pre-commit and use black - print the origin module to help testing @@ -459,14 +458,14 @@ v3.0.3 (pulled from pypi due to a packaging issue) ====== tag parsing and prefixes (thanks to \@punkadiddle for introducing it and passing it through) -# v2.1.0 +## v2.1.0 - enhance docs for sphinx usage - add symlink support to file finder for git #247 (thanks Stéphane Bidoul) - enhance tests handling win32 (thanks Stéphane Bidoul) -# v2.0.0 +## v2.0.0 - fix #237 - correct imports in code examples - improve mercurial commit detection (thanks Aaron) @@ -477,7 +476,7 @@ v3.0.3 (pulled from pypi due to a packaging issue) ====== - introduce support for branch name in version metadata and support a opt-in simplified semver version scheme -# v1.17.0 +## v1.17.0 - fix regression in git support - use a function to ensure it works in egg installed mode @@ -487,17 +486,17 @@ v3.0.3 (pulled from pypi due to a packaging issue) ====== (thanks Mehdi ABAAKOUK for both) -# v1.16.2 +## v1.16.2 - fix regression in handling git export ignores (thanks Mehdi ABAAKOUK) -# v1.16.1 +## v1.16.1 - fix regression in support for old setuptools versions (thanks Marco Clemencic) -# v1.16.0 +## v1.16.0 - drop support for eol python versions - #214 - fix misuse in surrogate-escape api @@ -509,47 +508,47 @@ v3.0.3 (pulled from pypi due to a packaging issue) ====== - fix #223 - remove the dependency on the internal `SetuptoolsVersion` as it was removed after long-standing deprecation -v1.15.7 ====== +## v1.15.7 - Fix #174 with #207: Reuse samefile backport as developed in jaraco.windows, and only use the backport where samefile is not available. -# v1.15.6 +## v1.15.6 - fix #171 by unpinning the py version to allow a fixed one to get installed -# v1.15.5 +## v1.15.5 - fix #167 by correctly respecting preformatted version metadata from PKG-INFO/EGG-INFO -# v1.15.4 +## v1.15.4 - fix issue #164: iterate all found entry points to avoid errors when pip remakes egg-info - enhance self-use to enable pip install from github again -# v1.15.3 +## v1.15.3 - bring back correctly getting our version in the own sdist, finalizes #114 - fix issue #150: strip local components of tags -# v1.15.2 +## v1.15.2 - fix issue #128: return None when a scm specific parse fails in a worktree to ease parse reuse -# v1.15.1 +## v1.15.1 - fix issue #126: the local part of any tags is discarded when guessing new versions - minor performance optimization by doing fewer git calls in the usual cases -# v1.15.0 +## v1.15.0 - more sophisticated ignoring of mercurial tag commits when considering distance in commits (thanks Petre Mierlutiu) @@ -560,44 +559,44 @@ v1.15.7 ====== sphinx - fix issue #81: fail more gracious when git/hg are missing - address issue #93: provide an experimental api to customize - behaviour on shallow git repos a custom parse function may pick pre + behavior on shallow git repos a custom parse function may pick pre parse actions to do when using git -# v1.14.1 +## v1.14.1 - fix #109: when detecting a dirty git workdir don't consider untracked file (this was a regression due to #86 in v1.13.1) - consider the distance 0 when the git node is unknown (happens when you haven't committed anything) -# v1.14.0 +## v1.14.0 - publish bdist_egg for python 2.6, 2.7 and 3.3-3.5 - fix issue #107 - dont use node if it is None -# v1.13.1 +## v1.13.1 - fix issue #86 - detect dirty git workdir without tags -# v1.13.0 +## v1.13.0 - fix regression caused by the fix of #101 - assert types for version dumping - strictly pass all versions through parsed version metadata -# v1.12.0 +## v1.12.0 - fix issue #97 - add support for mercurial plugins - fix issue #101 - write version cache even for pretend version (thanks anarcat for reporting and fixing) -# v1.11.1 +## v1.11.1 - fix issue #88 - better docs for sphinx usage (thanks Jason) - fix issue #89 - use normpath to deal with windows (thanks Te-jé Rodgers for reporting and fixing) -# v1.11.0 +## v1.11.0 - always run tag_to_version so in order to handle prefixes on old setuptools (thanks to Brian May) @@ -606,12 +605,12 @@ v1.15.7 ====== Unterwaditzer) - fix bug when using callable version_scheme (thanks Esben Haabendal) -# v1.10.1 +## v1.10.1 - fix issue #73 - in hg pre commit merge, consider parent1 instead of failing -# v1.10.0 +## v1.10.0 - add support for overriding the version number via the environment variable SETUPTOOLS_SCM_PRETEND_VERSION @@ -626,22 +625,22 @@ v1.15.7 ====== this change also introduces the setuptools_scm.parse_scm_fallback entrypoint which can be used to register custom archive fallbacks -# v1.9.0 +## v1.9.0 - Add `relative_to` parameter to `get_version` function, fixes #44 per #45. -# v1.8.0 +## v1.8.0 - fix issue with setuptools wrong version warnings being printed to standard out. User is informed now by distutils-warnings. - restructure root finding, we now reliably ignore outer scm and prefer PKG-INFO over scm, fixes #43 and #45 -# v1.7.0 +## v1.7.0 - correct the url to github thanks David Szotten - enhance scm not found errors with a note on git tarballs thanks Markus - add support for `write_to_template` -# v1.6.0 +## v1.6.0 - bail out early if the scm is missing @@ -651,64 +650,64 @@ v1.15.7 ====== - properly raise errors on write_to misuse (thanks Te-jé Rodgers) -# v1.5.5 +## v1.5.5 - Fix bug on Python 2 on Windows when environment has unicode fields. -# v1.5.4 +## v1.5.4 - Fix bug on Python 2 when version is loaded from existing metadata. -# v1.5.3 +## v1.5.3 - #28: Fix decoding error when PKG-INFO contains non-ASCII. -# v1.5.2 +## v1.5.2 - add zip_safe flag -# v1.5.1 +## v1.5.1 - fix file access bug I missed in 1.5 -# v1.5.0 +## v1.5.0 - moved setuptools integration related code to own file - support storing version strings into a module/text file using the `write_to` configuration parameter -# v1.4.0 +## v1.4.0 - proper handling for sdist - fix file-finder failure from windows - reshuffle docs -# v1.3.0 +## v1.3.0 - support setuptools easy_install egg creation details by hardwire-ing the version in the sdist -# v1.2.0 +## v1.2.0 - enhance self-use -# v1.1.0 +## v1.1.0 - enable self-use -# v1.0.0 +## v1.0.0 - documentation enhancements -# v0.26 +## v0.26 - rename to setuptools_scm - split into package, add lots of entry points for extension - pluggable version schemes -# v0.25 +## v0.25 - fix pep440 support this reshuffles the complete code for version guessing -# v0.24 +## v0.24 - don't drop dirty flag on node finding - fix distance for dirty flagged versions @@ -717,25 +716,25 @@ v1.15.7 ====== - include file finding - handle edge cases around dirty tagged versions -# v0.23 +## v0.23 - windows compatibility fix (thanks stefan) drop samefile since it`s missing in some python2 versions on windows - add tests to the source tarballs -# v0.22 +## v0.22 - windows compatibility fix (thanks stefan) use samefile since it does path normalisation -# v0.21 +## v0.21 - fix the own version attribute (thanks stefan) -# v0.20 +## v0.20 - fix issue 11: always take git describe long format to avoid the source of the ambiguity - fix issue 12: add a `__version__` attribute via pkginfo -# v0.19 +## v0.19 - configurable next version guessing - fix distance guessing (thanks stefan) diff --git a/docs/changelog.md b/docs/changelog.md new file mode 100644 index 00000000..15fe40c9 --- /dev/null +++ b/docs/changelog.md @@ -0,0 +1,3 @@ +{% + include-markdown "../CHANGELOG.md" +%} diff --git a/mkdocs.yml b/mkdocs.yml index 79ad48a7..7d0553f8 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -7,6 +7,7 @@ nav: - config.md - extending.md - overrides.md + - changelog.md theme: name: material @@ -24,6 +25,7 @@ markdown_extensions: plugins: - entangled - search +- include-markdown - mkdocstrings: default_handler: python handlers: diff --git a/pyproject.toml b/pyproject.toml index acb04a3b..21051a0e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,6 +50,7 @@ docs = [ "entangled-cli~=2.0", "mkdocs", "mkdocs-entangled-plugin", + "mkdocs-include-markdown-plugin", "mkdocs-material", "mkdocstrings[python]", "pygments", From a77b42133d6a87ee71c0123bd0c1aac264e2b44c Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Mon, 24 Feb 2025 20:55:15 +0100 Subject: [PATCH 14/32] Enforce more ruff rules --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f696d33d..08ae1bdd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -118,8 +118,8 @@ version = { attr = "_own_version_helper.version"} [tool.setuptools_scm] [tool.ruff] -lint.select = ["E", "F", "B", "UP", "YTT", "C", "DTZ", "PYI", "PT", "I", "FURB", "RUF"] -lint.ignore = ["B028"] +lint.extend-select = ["YTT", "B", "C4", "DTZ", "ISC", "LOG", "G", "PIE", "PYI", "PT", "FLY", "I", "C90", "PERF", "W", "PGH", "PLE", "UP", "FURB", "RUF"] +lint.ignore = ["B028", "LOG015", "PERF203"] lint.preview = true [tool.ruff.lint.isort] From c4917e460eb4e1600b456b8aa15c8a1203367ac5 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Mon, 24 Feb 2025 20:57:42 +0100 Subject: [PATCH 15/32] Apply ruff/flake8-logging-format rule G004 G004 Logging statement uses f-string --- src/setuptools_scm/_run_cmd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/setuptools_scm/_run_cmd.py b/src/setuptools_scm/_run_cmd.py index ef669664..5d5ec15e 100644 --- a/src/setuptools_scm/_run_cmd.py +++ b/src/setuptools_scm/_run_cmd.py @@ -190,7 +190,7 @@ def has_command( try: p = run([name, *args], cwd=".") if p.returncode != 0: - log.error(f"Command '{name}' returned non-zero. This is stderr:") + log.error("Command '%s' returned non-zero. This is stderr:", name) log.error(p.stderr) except OSError as e: log.warning("command %s missing: %s", name, e) From 448838e3ece149623b38e8c5e36130ece2d7782d Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Mon, 24 Feb 2025 21:06:23 +0100 Subject: [PATCH 16/32] Ooops... Fix mypy error in CI --- src/setuptools_scm/_version_cls.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/setuptools_scm/_version_cls.py b/src/setuptools_scm/_version_cls.py index be178f28..0fe9426b 100644 --- a/src/setuptools_scm/_version_cls.py +++ b/src/setuptools_scm/_version_cls.py @@ -8,7 +8,7 @@ from packaging.version import InvalidVersion from packaging.version import Version as Version except ImportError: - from setuptools.extern.packaging.version import ( # type: ignore[import-untyped, no-redef] + from setuptools.extern.packaging.version import ( # type: ignore[import-not-found, no-redef] InvalidVersion, ) from setuptools.extern.packaging.version import ( # type: ignore[no-redef] From ee57b305102e4d7dbb6d5e651619fe5008949633 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Mon, 24 Feb 2025 21:11:03 +0100 Subject: [PATCH 17/32] Python 3.13 (more) --- .github/workflows/python-tests.yml | 2 +- nextgen/vcs-versioning/pyproject.toml | 1 + pyproject.toml | 1 + src/setuptools_scm/_version_cls.py | 2 +- tox.ini | 2 +- 5 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index c8818651..393511fd 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -34,7 +34,7 @@ jobs: strategy: fail-fast: false matrix: - python_version: [ '3.8', '3.9', '3.10', '3.11', '3.12', 'pypy-3.10' ] + python_version: [ '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.10' ] os: [windows-latest, ubuntu-latest] #, macos-latest] include: - os: windows-latest diff --git a/nextgen/vcs-versioning/pyproject.toml b/nextgen/vcs-versioning/pyproject.toml index 6d1d2368..c34c5dd1 100644 --- a/nextgen/vcs-versioning/pyproject.toml +++ b/nextgen/vcs-versioning/pyproject.toml @@ -24,6 +24,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", ] dynamic = [ "version", diff --git a/pyproject.toml b/pyproject.toml index f696d33d..a789d0f0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,6 +31,7 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Version Control", "Topic :: System :: Software Distribution", diff --git a/src/setuptools_scm/_version_cls.py b/src/setuptools_scm/_version_cls.py index be178f28..0fe9426b 100644 --- a/src/setuptools_scm/_version_cls.py +++ b/src/setuptools_scm/_version_cls.py @@ -8,7 +8,7 @@ from packaging.version import InvalidVersion from packaging.version import Version as Version except ImportError: - from setuptools.extern.packaging.version import ( # type: ignore[import-untyped, no-redef] + from setuptools.extern.packaging.version import ( # type: ignore[import-not-found, no-redef] InvalidVersion, ) from setuptools.extern.packaging.version import ( # type: ignore[no-redef] diff --git a/tox.ini b/tox.ini index 049f2a77..cdb25590 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist=py{38,39,310,311,312},check_readme,check-dist +envlist=py{38,39,310,311,312,313},check_readme,check-dist requires= tox>4 [flake8] From 0fc8aab263eb41fc4b60453be7fe717adcd344ae Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Mon, 24 Feb 2025 21:59:07 +0100 Subject: [PATCH 18/32] Disable outdated pyproject-fmt hook It does not like Python 3.13. --- .pre-commit-config.yaml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 113121b1..7a3479f1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,12 +13,6 @@ repos: args: [--fix, --exit-non-zero-on-fix, --show-fixes] - id: ruff-format -- repo: https://github.com/tox-dev/pyproject-fmt - rev: v1.8.0 - hooks: - - id: pyproject-fmt - exclude: docs/examples/ - - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.15.0 hooks: From 692395252c0eb0d9b3d70e593047f345ad61347d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 10 Mar 2025 18:13:46 +0000 Subject: [PATCH 19/32] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.9.7 → v0.9.10](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.7...v0.9.10) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7a3479f1..f82899b9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,7 @@ repos: - id: debug-statements - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.9.7 + rev: v0.9.10 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix, --show-fixes] From 2e6876ec681988b84d4b63d2a03600e468c10e64 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 17 Mar 2025 18:16:43 +0000 Subject: [PATCH 20/32] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.9.10 → v0.11.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.10...v0.11.0) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f82899b9..ced7fb31 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,7 @@ repos: - id: debug-statements - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.9.10 + rev: v0.11.0 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix, --show-fixes] From 0a783efea868623305bd827a389772971158dd4c Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Tue, 18 Mar 2025 21:38:25 +0100 Subject: [PATCH 21/32] fixes #1119: consider all version parts for version tuple --- CHANGELOG.md | 7 +++++++ pyproject.toml | 1 - src/setuptools_scm/_version_cls.py | 9 +++++++++ testing/test_regressions.py | 16 ++++++++++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 184f62c9..09330070 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## v8.2.1 + +### Fixed + +- fix #1119: also include pre/post release details in version_tuple + + ## v8.2.0 ### Added diff --git a/pyproject.toml b/pyproject.toml index bc93e064..60c53865 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -128,7 +128,6 @@ force-single-line = true from-first = false lines-between-types = 1 order-by-type = true - [tool.repo-review] ignore = ["PP305", "GH103", "GH212", "MY100", "PC111", "PC160", "PC170", "PC180", "PC901"] diff --git a/src/setuptools_scm/_version_cls.py b/src/setuptools_scm/_version_cls.py index 0fe9426b..e0fe387b 100644 --- a/src/setuptools_scm/_version_cls.py +++ b/src/setuptools_scm/_version_cls.py @@ -52,8 +52,17 @@ def _version_as_tuple(version_str: str) -> tuple[int | str, ...]: return (version_str,) else: version_fields: tuple[int | str, ...] = parsed_version.release + if parsed_version.epoch: + version_fields = (f"{parsed_version.epoch}!", *version_fields) + if parsed_version.pre is not None: + version_fields += (f"{parsed_version.pre[0]}{parsed_version.pre[1]}",) + + if parsed_version.post is not None: + version_fields += (f"post{parsed_version.post}",) + if parsed_version.dev is not None: version_fields += (f"dev{parsed_version.dev}",) + if parsed_version.local is not None: version_fields += (parsed_version.local,) return version_fields diff --git a/testing/test_regressions.py b/testing/test_regressions.py index 385549c2..21f52711 100644 --- a/testing/test_regressions.py +++ b/testing/test_regressions.py @@ -8,6 +8,7 @@ from importlib.metadata import EntryPoint from importlib.metadata import distribution from pathlib import Path +from typing import Sequence import pytest @@ -130,3 +131,18 @@ def test_write_to_absolute_path_passes_when_subdir_of_root(tmp_path: Path) -> No match=r".*VERSION.py' .* .*subdir.*", ): write_version_files(replace(c, root=subdir), "1.0", v) + + +@pytest.mark.parametrize( + ("input", "expected"), + [ + ("1.0", (1, 0)), + ("1.0a2", (1, 0, "a2")), + ("1.0.b2dev1", (1, 0, "b2", "dev1")), + ("1.0.dev1", (1, 0, "dev1")), + ], +) +def test_version_as_tuple(input: str, expected: Sequence[int | str]) -> None: + from setuptools_scm._version_cls import _version_as_tuple + + assert _version_as_tuple(input) == expected From af0ff982c242739d353905e3bd143c8bbbb99630 Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Tue, 18 Mar 2025 21:54:53 +0100 Subject: [PATCH 22/32] fix #1112: unpin setuptools for ubuntu lts - this re-adds pain --- CHANGELOG.md | 1 + pyproject.toml | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 09330070..817ffc37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Fixed - fix #1119: also include pre/post release details in version_tuple +- fix #1112: unpin setuptools for own dependencies due to ubuntu lts bugs ## v8.2.0 diff --git a/pyproject.toml b/pyproject.toml index 60c53865..8b927f15 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,7 +42,8 @@ dynamic = [ ] dependencies = [ "packaging>=20", - "setuptools>=61", + # https://github.com/pypa/setuptools-scm/issues/1112 - re-pin in a breaking release + "setuptools", # >=61", 'tomli>=1; python_version < "3.11"', 'typing-extensions; python_version < "3.10"', ] From 94f36a0035b4a1dfb31b5b34086ad8f0860f86aa Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Wed, 19 Mar 2025 09:18:03 +0100 Subject: [PATCH 23/32] complete changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 817ffc37..eff85d24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ - fix #1119: also include pre/post release details in version_tuple - fix #1112: unpin setuptools for own dependencies due to ubuntu lts bugs - +- add python 3.13 to the support matrix ## v8.2.0 From 449b1c1aa899f23f197f9ef00fdeaeffe2a05d97 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 24 Mar 2025 18:11:54 +0000 Subject: [PATCH 24/32] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.11.0 → v0.11.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.0...v0.11.2) --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ced7fb31..7a1d6c1b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,7 @@ repos: - id: debug-statements - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.0 + rev: v0.11.2 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix, --show-fixes] From bce5cfc46f9975bfc253f87b49a6dc7b3488520e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 14 Apr 2025 20:29:53 +0200 Subject: [PATCH 25/32] [pre-commit.ci] pre-commit autoupdate (#1126) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.11.2 → v0.11.5](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.2...v0.11.5) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7a1d6c1b..b1c97fac 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,7 @@ repos: - id: debug-statements - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.2 + rev: v0.11.5 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix, --show-fixes] From 1bd767db3246e81acb4300008832b4f68578c4e5 Mon Sep 17 00:00:00 2001 From: Andrew Murray <3112309+radarhere@users.noreply.github.com> Date: Sat, 19 Apr 2025 16:15:35 +1000 Subject: [PATCH 26/32] Fixed typo (#1128) --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eff85d24..ea477b8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -93,7 +93,7 @@ - use normalized dist names for the `SETUPTOOLS_SCM_PRETEND_VERSION_FOR_${DIST_NAME}` env var - drop support for python 3.7 - introduce `version_file` as replacement for `write_to` -- renameed the project from `setuptools_scm` to `setuptools-scm` +- renamed the project from `setuptools_scm` to `setuptools-scm` ### Added From fc2d84179c4e8bc7123ba0b34f692dd029e3d4bd Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Tue, 22 Apr 2025 08:59:50 +0200 Subject: [PATCH 27/32] use importlib_metadata on python <3.10 fixes #1013 by no longer reporting duplicate distributions the bugfix was included in python3.10 via importlib_metadata 4.6 --- pyproject.toml | 17 +++++++++++++++-- src/setuptools_scm/_entrypoints.py | 24 ++++-------------------- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8b927f15..b92fe15a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,6 +5,7 @@ build-backend = "_own_version_helper:build_meta" requires = [ "setuptools>=61", 'tomli<=2.0.2; python_version < "3.11"', + 'importlib-metadata>=4.6; python_version < "3.10"', ] backend-path = [ ".", @@ -43,9 +44,10 @@ dynamic = [ dependencies = [ "packaging>=20", # https://github.com/pypa/setuptools-scm/issues/1112 - re-pin in a breaking release - "setuptools", # >=61", + "setuptools >= 61", 'tomli>=1; python_version < "3.11"', 'typing-extensions; python_version < "3.10"', + 'importlib-metadata>=4.6; python_version < "3.10"', ] [project.optional-dependencies] docs = [ @@ -69,38 +71,49 @@ test = [ ] toml = [ ] + [project.urls] documentation = "https://setuptools-scm.readthedocs.io/" repository = "https://github.com/pypa/setuptools-scm/" + [project.entry-points."distutils.setup_keywords"] use_scm_version = "setuptools_scm._integration.setuptools:version_keyword" + [project.entry-points."pipx.run"] setuptools-scm = "setuptools_scm._cli:main" setuptools_scm = "setuptools_scm._cli:main" + [project.entry-points."setuptools.file_finders"] setuptools_scm = "setuptools_scm._file_finders:find_files" + [project.entry-points."setuptools.finalize_distribution_options"] setuptools_scm = "setuptools_scm._integration.setuptools:infer_version" + [project.entry-points."setuptools_scm.files_command"] ".git" = "setuptools_scm._file_finders.git:git_find_files" ".hg" = "setuptools_scm._file_finders.hg:hg_find_files" + [project.entry-points."setuptools_scm.files_command_fallback"] ".git_archival.txt" = "setuptools_scm._file_finders.git:git_archive_find_files" ".hg_archival.txt" = "setuptools_scm._file_finders.hg:hg_archive_find_files" + [project.entry-points."setuptools_scm.local_scheme"] dirty-tag = "setuptools_scm.version:get_local_dirty_tag" no-local-version = "setuptools_scm.version:get_no_local_node" node-and-date = "setuptools_scm.version:get_local_node_and_date" node-and-timestamp = "setuptools_scm.version:get_local_node_and_timestamp" + [project.entry-points."setuptools_scm.parse_scm"] ".git" = "setuptools_scm.git:parse" ".hg" = "setuptools_scm.hg:parse" + [project.entry-points."setuptools_scm.parse_scm_fallback"] ".git_archival.txt" = "setuptools_scm.git:parse_archival" ".hg_archival.txt" = "setuptools_scm.hg:parse_archival" PKG-INFO = "setuptools_scm.fallbacks:parse_pkginfo" "pyproject.toml" = "setuptools_scm.fallbacks:fallback_version" "setup.py" = "setuptools_scm.fallbacks:fallback_version" + [project.entry-points."setuptools_scm.version_scheme"] "calver-by-date" = "setuptools_scm.version:calver_by_date" "guess-next-dev" = "setuptools_scm.version:guess_next_dev_version" @@ -133,7 +146,7 @@ order-by-type = true ignore = ["PP305", "GH103", "GH212", "MY100", "PC111", "PC160", "PC170", "PC180", "PC901"] [tool.pytest.ini_options] -minversion = "7" +minversion = "8" testpaths = ["testing"] filterwarnings = [ "error", diff --git a/src/setuptools_scm/_entrypoints.py b/src/setuptools_scm/_entrypoints.py index 811fb5f5..95651491 100644 --- a/src/setuptools_scm/_entrypoints.py +++ b/src/setuptools_scm/_entrypoints.py @@ -17,28 +17,12 @@ from ._config import Configuration from ._config import ParseFunction - -from importlib.metadata import EntryPoint as EntryPoint - if sys.version_info[:2] < (3, 10): - from importlib.metadata import entry_points as legacy_entry_points - - class EntryPoints: - _groupdata: list[EntryPoint] - - def __init__(self, groupdata: list[EntryPoint]) -> None: - self._groupdata = groupdata - - def select(self, name: str) -> EntryPoints: - return EntryPoints([x for x in self._groupdata if x.name == name]) - - def __iter__(self) -> Iterator[EntryPoint]: - return iter(self._groupdata) - - def entry_points(group: str) -> EntryPoints: - return EntryPoints(legacy_entry_points()[group]) - + from importlib_metadata import EntryPoint as EntryPoint + from importlib_metadata import EntryPoints + from importlib_metadata import entry_points else: + from importlib.metadata import EntryPoint as EntryPoint from importlib.metadata import EntryPoints from importlib.metadata import entry_points From 9fcaffa84de3d749c78b6091724ee7f16e5795dd Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Tue, 22 Apr 2025 10:18:49 +0200 Subject: [PATCH 28/32] remove setuptools pin again - needs a breaking release --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b92fe15a..0d133f5c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,7 @@ dynamic = [ dependencies = [ "packaging>=20", # https://github.com/pypa/setuptools-scm/issues/1112 - re-pin in a breaking release - "setuptools >= 61", + "setuptools", # >= 61", 'tomli>=1; python_version < "3.11"', 'typing-extensions; python_version < "3.10"', 'importlib-metadata>=4.6; python_version < "3.10"', From e79a57a8d2302aa1ceb4a237f768d971796ec03f Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Tue, 22 Apr 2025 10:44:48 +0200 Subject: [PATCH 29/32] migrate to selectable entrypoints --- src/setuptools_scm/_entrypoints.py | 15 +++------------ src/setuptools_scm/_file_finders/__init__.py | 13 +++++++------ src/setuptools_scm/discover.py | 3 +-- src/setuptools_scm/version.py | 7 +++---- 4 files changed, 14 insertions(+), 24 deletions(-) diff --git a/src/setuptools_scm/_entrypoints.py b/src/setuptools_scm/_entrypoints.py index 95651491..08e74b77 100644 --- a/src/setuptools_scm/_entrypoints.py +++ b/src/setuptools_scm/_entrypoints.py @@ -19,12 +19,10 @@ if sys.version_info[:2] < (3, 10): from importlib_metadata import EntryPoint as EntryPoint - from importlib_metadata import EntryPoints - from importlib_metadata import entry_points + from importlib_metadata import entry_points as entry_points else: from importlib.metadata import EntryPoint as EntryPoint - from importlib.metadata import EntryPoints - from importlib.metadata import entry_points + from importlib.metadata import entry_points as entry_points log = _log.log.getChild("entrypoints") @@ -45,15 +43,8 @@ def version_from_entrypoint( return None -def iter_entry_points(group: str, name: str | None = None) -> Iterator[EntryPoint]: - eps: EntryPoints = entry_points(group=group) - res = eps if name is None else eps.select(name=name) - - return iter(res) - - def _get_ep(group: str, name: str) -> Any | None: - for ep in iter_entry_points(group, name): + for ep in entry_points(group=group, name=name): log.debug("ep found: %s", ep.name) return ep.load() return None diff --git a/src/setuptools_scm/_file_finders/__init__.py b/src/setuptools_scm/_file_finders/__init__.py index 8201bae1..a3bf01c1 100644 --- a/src/setuptools_scm/_file_finders/__init__.py +++ b/src/setuptools_scm/_file_finders/__init__.py @@ -1,6 +1,5 @@ from __future__ import annotations -import itertools import os from typing import TYPE_CHECKING @@ -8,7 +7,8 @@ from .. import _log from .. import _types as _t -from .._entrypoints import iter_entry_points +from .._entrypoints import EntryPoint +from .._entrypoints import entry_points from .pathtools import norm_real if TYPE_CHECKING: @@ -102,10 +102,11 @@ def is_toplevel_acceptable(toplevel: str | None) -> TypeGuard[str]: def find_files(path: _t.PathT = "") -> list[str]: - for ep in itertools.chain( - iter_entry_points("setuptools_scm.files_command"), - iter_entry_points("setuptools_scm.files_command_fallback"), - ): + eps: list[EntryPoint] = [ + *entry_points(group="setuptools_scm.files_command"), + *entry_points(group="setuptools_scm.files_command_fallback"), + ] + for ep in eps: command: Callable[[_t.PathT], list[str]] = ep.load() res: list[str] = command(path) if res: diff --git a/src/setuptools_scm/discover.py b/src/setuptools_scm/discover.py index 7c1be381..e3dbda91 100644 --- a/src/setuptools_scm/discover.py +++ b/src/setuptools_scm/discover.py @@ -58,10 +58,9 @@ def iter_matching_entrypoints( """ log.debug("looking for ep %s in %s", entrypoint, root) - from ._entrypoints import iter_entry_points for wd in walk_potential_roots(root, config.search_parent_directories): - for ep in iter_entry_points(entrypoint): + for ep in _entrypoints.entry_points(group=entrypoint): if ep.value in _BLOCKED_EP_TARGETS: continue if match_entrypoint(wd, ep.name): diff --git a/src/setuptools_scm/version.py b/src/setuptools_scm/version.py index 633351c9..29803fcd 100644 --- a/src/setuptools_scm/version.py +++ b/src/setuptools_scm/version.py @@ -82,11 +82,10 @@ def callable_or_entrypoint(group: str, callable_or_name: str | Any) -> Any: if callable(callable_or_name): return callable_or_name - from ._entrypoints import iter_entry_points - for ep in iter_entry_points(group, callable_or_name): - log.debug("ep found: %s", ep.name) - return ep.load() + from ._entrypoints import _get_ep + + return _get_ep(group, callable_or_name) def tag_to_version( From 1f7abeab064da3784c1107ca02707a1b1686a283 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 22 Apr 2025 10:51:11 +0200 Subject: [PATCH 30/32] [pre-commit.ci] pre-commit autoupdate (#1129) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.11.5 → v0.11.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.5...v0.11.6) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b1c97fac..a42e2d10 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,7 @@ repos: - id: debug-statements - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.5 + rev: v0.11.6 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix, --show-fixes] From 0a07be85bfe0c08f0ee46bdb3aa09f69dd5b8b66 Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Tue, 22 Apr 2025 10:55:03 +0200 Subject: [PATCH 31/32] changelog --- CHANGELOG.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eff85d24..4aa60e59 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ # Changelog -## v8.2.1 +## v8.3.0 + +### Fixed + +- fix #1013: use modern importlib_metadata in all cases to dedup distribution objects that must shadow based on pythonpath priority + starting with python 3.10 this is part of python itself + +## v8.2.1 (yanked due to legacy python issues) ### Fixed From 15dca67c876d457631673bcfcdaf0357c85ee8a7 Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Wed, 23 Apr 2025 12:27:04 +0200 Subject: [PATCH 32/32] fix #1131: allow self-build without importlib_metadata --- CHANGELOG.md | 6 +++++ pyproject.toml | 1 - src/setuptools_scm/_entrypoints.py | 25 +++++++++++++++----- src/setuptools_scm/_file_finders/__init__.py | 3 +-- src/setuptools_scm/discover.py | 7 +++++- 5 files changed, 32 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b63f03c..c8823c7e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## v8.3.1 + +### Fixed + +- fixed #1131: allow self-build without importlib_metadata avaliable on python3.9 + ## v8.3.0 ### Fixed diff --git a/pyproject.toml b/pyproject.toml index 0d133f5c..b66940ee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,6 @@ build-backend = "_own_version_helper:build_meta" requires = [ "setuptools>=61", 'tomli<=2.0.2; python_version < "3.11"', - 'importlib-metadata>=4.6; python_version < "3.10"', ] backend-path = [ ".", diff --git a/src/setuptools_scm/_entrypoints.py b/src/setuptools_scm/_entrypoints.py index 08e74b77..3333eb5c 100644 --- a/src/setuptools_scm/_entrypoints.py +++ b/src/setuptools_scm/_entrypoints.py @@ -12,22 +12,33 @@ from . import _log from . import version +__all__ = [ + "entry_points", + "im", +] if TYPE_CHECKING: from . import _types as _t from ._config import Configuration from ._config import ParseFunction -if sys.version_info[:2] < (3, 10): - from importlib_metadata import EntryPoint as EntryPoint - from importlib_metadata import entry_points as entry_points -else: - from importlib.metadata import EntryPoint as EntryPoint - from importlib.metadata import entry_points as entry_points + if sys.version_info[:2] < (3, 10): + import importlib_metadata as im + else: + from importlib import metadata as im log = _log.log.getChild("entrypoints") +def entry_points(**kw: Any) -> im.EntryPoints: + if sys.version_info[:2] < (3, 10): + import importlib_metadata as im + else: + import importlib.metadata as im + + return im.entry_points(**kw) + + def version_from_entrypoint( config: Configuration, *, entrypoint: str, root: _t.PathT ) -> version.ScmVersion | None: @@ -52,6 +63,8 @@ def _get_ep(group: str, name: str) -> Any | None: def _get_from_object_reference_str(path: str, group: str) -> Any | None: # todo: remove for importlib native spelling + from importlib.metadata import EntryPoint # hack + ep = EntryPoint(path, path, group) try: return ep.load() diff --git a/src/setuptools_scm/_file_finders/__init__.py b/src/setuptools_scm/_file_finders/__init__.py index a3bf01c1..e19afc81 100644 --- a/src/setuptools_scm/_file_finders/__init__.py +++ b/src/setuptools_scm/_file_finders/__init__.py @@ -7,7 +7,6 @@ from .. import _log from .. import _types as _t -from .._entrypoints import EntryPoint from .._entrypoints import entry_points from .pathtools import norm_real @@ -102,7 +101,7 @@ def is_toplevel_acceptable(toplevel: str | None) -> TypeGuard[str]: def find_files(path: _t.PathT = "") -> list[str]: - eps: list[EntryPoint] = [ + eps = [ *entry_points(group="setuptools_scm.files_command"), *entry_points(group="setuptools_scm.files_command_fallback"), ] diff --git a/src/setuptools_scm/discover.py b/src/setuptools_scm/discover.py index e3dbda91..e8208ca4 100644 --- a/src/setuptools_scm/discover.py +++ b/src/setuptools_scm/discover.py @@ -3,6 +3,7 @@ import os from pathlib import Path +from typing import TYPE_CHECKING from typing import Iterable from typing import Iterator @@ -11,6 +12,10 @@ from . import _types as _t from ._config import Configuration +if TYPE_CHECKING: + from ._entrypoints import im + + log = _log.log.getChild("discover") @@ -48,7 +53,7 @@ def match_entrypoint(root: _t.PathT, name: str) -> bool: def iter_matching_entrypoints( root: _t.PathT, entrypoint: str, config: Configuration -) -> Iterable[_entrypoints.EntryPoint]: +) -> Iterable[im.EntryPoint]: """ Consider different entry-points in ``root`` and optionally its parents. :param root: File path.