From 77deaba9d1604f9e6bda88ac5bbb7a354d154105 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 20:13:22 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- nextgen/vcs-versioning/pyproject.toml | 10 +- pyproject.toml | 115 ++++++++---------- src/setuptools_scm/_config.py | 4 +- src/setuptools_scm/_entrypoints.py | 12 +- src/setuptools_scm/_integration/setuptools.py | 6 +- src/setuptools_scm/_log.py | 4 +- src/setuptools_scm/git.py | 4 +- testing/conftest.py | 4 +- testing/test_file_finder.py | 2 +- testing/test_git.py | 4 +- testing/test_integration.py | 2 +- testing/test_main.py | 2 +- testing/test_mercurial.py | 6 +- 13 files changed, 80 insertions(+), 95 deletions(-) diff --git a/nextgen/vcs-versioning/pyproject.toml b/nextgen/vcs-versioning/pyproject.toml index f71b85a5..84f4fd35 100644 --- a/nextgen/vcs-versioning/pyproject.toml +++ b/nextgen/vcs-versioning/pyproject.toml @@ -24,16 +24,16 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", ] dynamic = [ "version", ] dependencies = [ ] -[project.urls] -Documentation = "https://github.com/unknown/vcs-versioning#readme" -Issues = "https://github.com/unknown/vcs-versioning/issues" -Source = "https://github.com/unknown/vcs-versioning" +urls.Documentation = "https://github.com/unknown/vcs-versioning#readme" +urls.Issues = "https://github.com/unknown/vcs-versioning/issues" +urls.Source = "https://github.com/unknown/vcs-versioning" [tool.hatch.version] path = "vcs_versioning/__about__.py" @@ -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" ] [tool.coverage.run] branch = true diff --git a/pyproject.toml b/pyproject.toml index a55d0731..15a7d454 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,8 @@ - - [build-system] build-backend = "_own_version_helper:build_meta" requires = [ "setuptools>=61", - 'tomli; python_version < "3.11"', + "tomli; python_version<'3.11'", ] backend-path = [ ".", @@ -17,7 +15,7 @@ description = "the blessed package to manage your versions by scm tags" readme = "README.md" license.file = "LICENSE" authors = [ - {name="Ronny Pfannschmidt", email="opensource@ronnypfannschmidt.de"} + { name = "Ronny Pfannschmidt", email = "opensource@ronnypfannschmidt.de" }, ] requires-python = ">=3.8" classifiers = [ @@ -31,6 +29,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", @@ -42,11 +41,10 @@ dynamic = [ dependencies = [ "packaging>=20", "setuptools", - 'tomli>=1; python_version < "3.11"', - 'typing-extensions; python_version < "3.10"', + "tomli>=1; python_version<'3.11'", + "typing-extensions; python_version<'3.10'", ] -[project.optional-dependencies] -docs = [ +optional-dependencies.docs = [ "entangled-cli~=2.0", "mkdocs", "mkdocs-entangled-plugin", @@ -54,86 +52,73 @@ docs = [ "mkdocstrings[python]", "pygments", ] -rich = [ +optional-dependencies.rich = [ "rich", ] -test = [ +optional-dependencies.test = [ "build", "pytest", "rich", - 'typing-extensions; python_version < "3.11"', + "typing-extensions; python_version<'3.11'", "wheel", ] -toml = [ +optional-dependencies.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" -[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" -"no-guess-dev" = "setuptools_scm.version:no_guess_dev_version" -"only-version" = "setuptools_scm.version:only_version" -"post-release" = "setuptools_scm.version:postrelease_version" -"python-simplified-semver" = "setuptools_scm.version:simplified_semver_version" -"release-branch-semver" = "setuptools_scm.version:release_branch_semver_version" +urls.documentation = "https://setuptools-scm.readthedocs.io/" +urls.repository = "https://github.com/pypa/setuptools-scm/" +entry-points."distutils.setup_keywords".use_scm_version = "setuptools_scm._integration.setuptools:version_keyword" +entry-points."pipx.run".setuptools_scm = "setuptools_scm._cli:main" +entry-points."setuptools.file_finders".setuptools_scm = "setuptools_scm._file_finders:find_files" +entry-points."setuptools.finalize_distribution_options".setuptools_scm = "setuptools_scm._integration.setuptools:infer_version" +entry-points."setuptools_scm.files_command".".git" = "setuptools_scm._file_finders.git:git_find_files" +entry-points."setuptools_scm.files_command".".hg" = "setuptools_scm._file_finders.hg:hg_find_files" +entry-points."setuptools_scm.files_command_fallback".".git_archival.txt" = "setuptools_scm._file_finders.git:git_archive_find_files" +entry-points."setuptools_scm.files_command_fallback".".hg_archival.txt" = "setuptools_scm._file_finders.hg:hg_archive_find_files" +entry-points."setuptools_scm.local_scheme".dirty-tag = "setuptools_scm.version:get_local_dirty_tag" +entry-points."setuptools_scm.local_scheme".no-local-version = "setuptools_scm.version:get_no_local_node" +entry-points."setuptools_scm.local_scheme".node-and-date = "setuptools_scm.version:get_local_node_and_date" +entry-points."setuptools_scm.local_scheme".node-and-timestamp = "setuptools_scm.version:get_local_node_and_timestamp" +entry-points."setuptools_scm.parse_scm".".git" = "setuptools_scm.git:parse" +entry-points."setuptools_scm.parse_scm".".hg" = "setuptools_scm.hg:parse" +entry-points."setuptools_scm.parse_scm_fallback".".git_archival.txt" = "setuptools_scm.git:parse_archival" +entry-points."setuptools_scm.parse_scm_fallback".".hg_archival.txt" = "setuptools_scm.hg:parse_archival" +entry-points."setuptools_scm.parse_scm_fallback".PKG-INFO = "setuptools_scm.fallbacks:parse_pkginfo" +entry-points."setuptools_scm.parse_scm_fallback"."pyproject.toml" = "setuptools_scm.fallbacks:fallback_version" +entry-points."setuptools_scm.parse_scm_fallback"."setup.py" = "setuptools_scm.fallbacks:fallback_version" +entry-points."setuptools_scm.version_scheme"."calver-by-date" = "setuptools_scm.version:calver_by_date" +entry-points."setuptools_scm.version_scheme"."guess-next-dev" = "setuptools_scm.version:guess_next_dev_version" +entry-points."setuptools_scm.version_scheme"."no-guess-dev" = "setuptools_scm.version:no_guess_dev_version" +entry-points."setuptools_scm.version_scheme"."only-version" = "setuptools_scm.version:only_version" +entry-points."setuptools_scm.version_scheme"."post-release" = "setuptools_scm.version:postrelease_version" +entry-points."setuptools_scm.version_scheme"."python-simplified-semver" = "setuptools_scm.version:simplified_semver_version" +entry-points."setuptools_scm.version_scheme"."release-branch-semver" = "setuptools_scm.version:release_branch_semver_version" [tool.setuptools.packages.find] -where = ["src"] +where = [ "src" ] namespaces = false [tool.setuptools.dynamic] -version = { attr = "_own_version_helper.version"} +version = { attr = "_own_version_helper.version" } [tool.setuptools_scm] [tool.ruff] -src = ["src"] +src = [ "src" ] fix = true -lint.select = ["E", "F", "B", "UP", "YTT", "C", "DTZ", "PYI", "PT", "I", "FURB", "RUF"] -lint.ignore = ["B028"] +lint.select = [ "B", "C", "DTZ", "E", "F", "FURB", "I", "PT", "PYI", "RUF", "UP", "YTT" ] +lint.ignore = [ "B028" ] +lint.isort.force-single-line = true +lint.isort.from-first = false +lint.isort.lines-between-types = 1 +lint.isort.order-by-type = true lint.preview = true -[tool.ruff.lint.isort] -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"] +ignore = [ "PP305", "GH103", "GH212", "MY100", "PC111", "PC160", "PC170", "PC180", "PC901" ] [tool.pytest.ini_options] minversion = "7" -testpaths = ["testing"] +testpaths = [ "testing" ] filterwarnings = [ "error", "ignore:.*tool\\.setuptools_scm.*", @@ -142,7 +127,7 @@ filterwarnings = [ log_level = "debug" log_cli_level = "info" # disable unraisable until investigated -addopts = ["-ra", "--strict-config", "--strict-markers", "-p", "no:unraisableexception"] +addopts = [ "-ra", "--strict-config", "--strict-markers", "-p", "no:unraisableexception" ] markers = [ "issue(id): reference to github issue", "skip_commit: allows to skip committing in the helpers", diff --git a/src/setuptools_scm/_config.py b/src/setuptools_scm/_config.py index 6ed520f9..240aa134 100644 --- a/src/setuptools_scm/_config.py +++ b/src/setuptools_scm/_config.py @@ -115,7 +115,7 @@ def from_file( cls, name: str | os.PathLike[str] = "pyproject.toml", dist_name: str | None = None, - _require_section: bool = True, + require_section: bool = True, **kwargs: Any, ) -> Configuration: """ @@ -125,7 +125,7 @@ def from_file( not contain the [tool.setuptools_scm] section. """ - pyproject_data = _read_pyproject(Path(name), require_section=_require_section) + pyproject_data = _read_pyproject(Path(name), require_section=require_section) args = _get_args_for_pyproject(pyproject_data, dist_name, kwargs) args.update(read_toml_overrides(args["dist_name"])) diff --git a/src/setuptools_scm/_entrypoints.py b/src/setuptools_scm/_entrypoints.py index 5eab1ed2..e5133ccf 100644 --- a/src/setuptools_scm/_entrypoints.py +++ b/src/setuptools_scm/_entrypoints.py @@ -88,10 +88,10 @@ def _get_from_object_reference_str(path: str, group: str) -> Any | None: def _iter_version_schemes( entrypoint: str, scheme_value: _t.VERSION_SCHEMES, - _memo: set[object] | None = None, + memo: set[object] | None = None, ) -> Iterator[Callable[[version.ScmVersion], str]]: - if _memo is None: - _memo = set() + if memo is None: + memo = set() if isinstance(scheme_value, str): scheme_value = cast( "_t.VERSION_SCHEMES", @@ -101,9 +101,9 @@ def _iter_version_schemes( if isinstance(scheme_value, (list, tuple)): for variant in scheme_value: - if variant not in _memo: - _memo.add(variant) - yield from _iter_version_schemes(entrypoint, variant, _memo=_memo) + if variant not in memo: + memo.add(variant) + yield from _iter_version_schemes(entrypoint, variant, _memo=memo) elif callable(scheme_value): yield scheme_value diff --git a/src/setuptools_scm/_integration/setuptools.py b/src/setuptools_scm/_integration/setuptools.py index 3ed48470..ed8ab9eb 100644 --- a/src/setuptools_scm/_integration/setuptools.py +++ b/src/setuptools_scm/_integration/setuptools.py @@ -26,12 +26,12 @@ def read_dist_name_from_setup_cfg( return dist_name -def _warn_on_old_setuptools(_version: str = setuptools.__version__) -> None: - if int(_version.split(".")[0]) < 61: +def _warn_on_old_setuptools(version: str = setuptools.__version__) -> None: + if int(version.split(".")[0]) < 61: warnings.warn( RuntimeWarning( f""" -ERROR: setuptools=={_version} is used in combination with setuptools-scm>=8.x +ERROR: setuptools=={version} is used in combination with setuptools-scm>=8.x Your build configuration is incomplete and previously worked by accident! setuptools-scm requires setuptools>=61 diff --git a/src/setuptools_scm/_log.py b/src/setuptools_scm/_log.py index 7e4b7db7..9f51b3d1 100644 --- a/src/setuptools_scm/_log.py +++ b/src/setuptools_scm/_log.py @@ -49,8 +49,8 @@ def make_default_handler() -> logging.Handler: log.addHandler(_default_handler) -def _default_log_level(_env: Mapping[str, str] = os.environ) -> int: - val: str | None = _env.get("SETUPTOOLS_SCM_DEBUG") +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 diff --git a/src/setuptools_scm/git.py b/src/setuptools_scm/git.py index 7eccf198..3783e2dc 100644 --- a/src/setuptools_scm/git.py +++ b/src/setuptools_scm/git.py @@ -145,12 +145,12 @@ def fetch_shallow(self) -> None: run_git(["fetch", "--unshallow"], self.path, check=True, timeout=240) def node(self) -> str | None: - _unsafe_short_node = operator.itemgetter(slice(7)) + unsafe_short_node = operator.itemgetter(slice(7)) return run_git( ["rev-parse", "--verify", "--quiet", "HEAD"], self.path ).parse_success( - parse=_unsafe_short_node, + parse=unsafe_short_node, ) def count_all_nodes(self) -> int: diff --git a/testing/conftest.py b/testing/conftest.py index d1c96ed3..09b69c1a 100644 --- a/testing/conftest.py +++ b/testing/conftest.py @@ -79,14 +79,14 @@ def debug_mode() -> Iterator[DebugMode]: yield debug_mode -@pytest.fixture() +@pytest.fixture def wd(tmp_path: Path) -> WorkDir: target_wd = tmp_path.resolve() / "wd" target_wd.mkdir() return WorkDir(target_wd) -@pytest.fixture() +@pytest.fixture def repositories_hg_git(tmp_path: Path) -> tuple[WorkDir, WorkDir]: tmp_path = tmp_path.resolve() path_git = tmp_path / "repo_git" diff --git a/testing/test_file_finder.py b/testing/test_file_finder.py index 5af94fcf..cc1a08fd 100644 --- a/testing/test_file_finder.py +++ b/testing/test_file_finder.py @@ -212,7 +212,7 @@ def test_symlink_not_in_scm_while_target_is(inwd: WorkDir) -> None: @pytest.mark.issue(587) -@pytest.mark.skip_commit() +@pytest.mark.skip_commit def test_not_commited(inwd: WorkDir) -> None: assert find_files() == [] diff --git a/testing/test_git.py b/testing/test_git.py index 661dcb76..9186b1a6 100644 --- a/testing/test_git.py +++ b/testing/test_git.py @@ -307,7 +307,7 @@ def test_git_worktree_support(wd: WorkDir, tmp_path: Path) -> None: assert str(worktree) in res.stdout -@pytest.fixture() +@pytest.fixture def shallow_wd(wd: WorkDir, tmp_path: Path) -> Path: wd.commit_testfile() wd.commit_testfile() @@ -515,7 +515,7 @@ def test_git_getdate_git_2_45_0_plus( assert git_wd.get_head_date() == date(2024, 4, 30) -@pytest.fixture() +@pytest.fixture def signed_commit_wd(monkeypatch: pytest.MonkeyPatch, wd: WorkDir) -> WorkDir: if not has_command("gpg", args=["--version"], warn=False): pytest.skip("gpg executable not found") diff --git a/testing/test_integration.py b/testing/test_integration.py index 86c8cbee..514877c7 100644 --- a/testing/test_integration.py +++ b/testing/test_integration.py @@ -23,7 +23,7 @@ c = Configuration() -@pytest.fixture() +@pytest.fixture def wd(wd: WorkDir) -> WorkDir: wd("git init") wd("git config user.email test@example.com") diff --git a/testing/test_main.py b/testing/test_main.py index ad9a2903..3c0ff3f8 100644 --- a/testing/test_main.py +++ b/testing/test_main.py @@ -20,7 +20,7 @@ def test_main() -> None: exec(code, ns) -@pytest.fixture() +@pytest.fixture def repo(wd: WorkDir) -> WorkDir: wd("git init") wd("git config user.email user@host") diff --git a/testing/test_mercurial.py b/testing/test_mercurial.py index b51c3fd9..57073716 100644 --- a/testing/test_mercurial.py +++ b/testing/test_mercurial.py @@ -21,7 +21,7 @@ ) -@pytest.fixture() +@pytest.fixture def wd(wd: WorkDir) -> WorkDir: wd("hg init") wd.add_command = "hg add ." @@ -153,7 +153,7 @@ def test_parse_no_worktree(tmp_path: Path) -> None: assert ret is None -@pytest.fixture() +@pytest.fixture def version_1_0(wd: WorkDir) -> WorkDir: wd("hg branch default") wd.commit_testfile() @@ -161,7 +161,7 @@ def version_1_0(wd: WorkDir) -> WorkDir: return wd -@pytest.fixture() +@pytest.fixture def pre_merge_commit_after_tag(version_1_0: WorkDir) -> WorkDir: wd = version_1_0 wd("hg branch testbranch")