diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7382542..42fb203 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,4 +41,3 @@ jobs: with: flags: ${{ matrix.os }} name: ${{ matrix.os }} Python ${{ matrix.python-version }} - token: ${{ secrets.CODECOV_ORG_TOKEN }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b3b6189..b7ddb76 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,12 +1,12 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.14.10 + rev: v0.15.9 hooks: - id: ruff-check args: [--exit-non-zero-on-fix] - repo: https://github.com/psf/black-pre-commit-mirror - rev: 25.12.0 + rev: 26.3.1 hooks: - id: black @@ -25,18 +25,18 @@ repos: - id: trailing-whitespace - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.36.0 + rev: 0.37.1 hooks: - id: check-dependabot - id: check-github-workflows - repo: https://github.com/rhysd/actionlint - rev: v1.7.10 + rev: v1.7.12 hooks: - id: actionlint - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.19.1 + rev: v1.20.0 hooks: - id: mypy args: @@ -49,18 +49,18 @@ repos: pass_filenames: false additional_dependencies: ["types-requests"] - - repo: https://github.com/woodruffw/zizmor-pre-commit - rev: v1.14.2 + - repo: https://github.com/zizmorcore/zizmor-pre-commit + rev: v1.23.1 hooks: - id: zizmor - repo: https://github.com/tox-dev/pyproject-fmt - rev: v2.11.1 + rev: v2.21.0 hooks: - id: pyproject-fmt - repo: https://github.com/abravalheri/validate-pyproject - rev: v0.24.1 + rev: v0.25 hooks: - id: validate-pyproject @@ -70,7 +70,7 @@ repos: - id: tox-ini-fmt - repo: https://github.com/codespell-project/codespell - rev: v2.4.1 + rev: v2.4.2 hooks: - id: codespell args: [--ignore-words-list=commitish] diff --git a/cherry_picker/cherry_picker.py b/cherry_picker/cherry_picker.py index 55a0f26..a9a2575 100755 --- a/cherry_picker/cherry_picker.py +++ b/cherry_picker/cherry_picker.py @@ -398,8 +398,7 @@ def amend_commit_message(self, cherry_pick_branch): return updated_commit_message def pause_after_committing(self, cherry_pick_branch): - click.echo( - f""" + click.echo(f""" Finished cherry-pick {self.commit_sha1} into {cherry_pick_branch} \U0001f600 --no-push option used. ... Stopping here. @@ -408,8 +407,7 @@ def pause_after_committing(self, cherry_pick_branch): To abort the cherry-pick and cleanup: $ cherry_picker --abort -""" - ) +""") self.set_paused_state() def push_to_remote(self, base_branch, head_branch, commit_message=""): diff --git a/cherry_picker/test_cherry_picker.py b/cherry_picker/test_cherry_picker.py index 5eefb1f..65e823d 100644 --- a/cherry_picker/test_cherry_picker.py +++ b/cherry_picker/test_cherry_picker.py @@ -133,7 +133,8 @@ def tmp_git_repo_dir(tmpdir, cd, git_init, git_commit, git_config): try: git_init() except subprocess.CalledProcessError: - version = subprocess.run(("git", "--version"), capture_output=True) + git_version_cmd = "git", "--version" + version = subprocess.run(git_version_cmd, capture_output=True) # the output looks like "git version 2.34.1" v = version.stdout.decode("utf-8").removeprefix("git version ").split(".") if (int(v[0]), int(v[1])) < (2, 28): @@ -475,14 +476,12 @@ def test_find_config_not_git(tmpdir, cd): def test_load_full_config(tmp_git_repo_dir, git_add, git_commit): relative_config_path = ".cherry_picker.toml" - tmp_git_repo_dir.join(relative_config_path).write( - """\ + tmp_git_repo_dir.join(relative_config_path).write("""\ team = "python" - repo = "core-workfolow" + repo = "core-workflow" check_sha = "5f007046b5d4766f971272a0cc99f8461215c1ec" default_branch = "devel" - """ - ) + """) git_add(relative_config_path) git_commit("Add config") scm_revision = get_sha1_from("HEAD") @@ -491,7 +490,7 @@ def test_load_full_config(tmp_git_repo_dir, git_add, git_commit): scm_revision + ":" + relative_config_path, { "check_sha": "5f007046b5d4766f971272a0cc99f8461215c1ec", - "repo": "core-workfolow", + "repo": "core-workflow", "team": "python", "fix_commit_msg": True, "default_branch": "devel", @@ -503,11 +502,9 @@ def test_load_full_config(tmp_git_repo_dir, git_add, git_commit): def test_load_partial_config(tmp_git_repo_dir, git_add, git_commit): relative_config_path = ".cherry_picker.toml" - tmp_git_repo_dir.join(relative_config_path).write( - """\ - repo = "core-workfolow" - """ - ) + tmp_git_repo_dir.join(relative_config_path).write("""\ + repo = "core-workflow" + """) git_add(relative_config_path) git_commit("Add config") scm_revision = get_sha1_from("HEAD") @@ -516,7 +513,7 @@ def test_load_partial_config(tmp_git_repo_dir, git_add, git_commit): f"{scm_revision}:{relative_config_path}", { "check_sha": "7f777ed95a19224294949e1b4ce56bbffcb1fe9f", - "repo": "core-workfolow", + "repo": "core-workflow", "team": "python", "fix_commit_msg": True, "default_branch": "main", @@ -528,14 +525,12 @@ def test_load_partial_config(tmp_git_repo_dir, git_add, git_commit): def test_load_config_no_head_sha(tmp_git_repo_dir, git_add, git_commit): relative_config_path = ".cherry_picker.toml" - tmp_git_repo_dir.join(relative_config_path).write( - """\ + tmp_git_repo_dir.join(relative_config_path).write("""\ team = "python" - repo = "core-workfolow" + repo = "core-workflow" check_sha = "5f007046b5d4766f971272a0cc99f8461215c1ec" default_branch = "devel" - """ - ) + """) git_add(relative_config_path) git_commit(f"Add {relative_config_path}") @@ -546,7 +541,7 @@ def test_load_config_no_head_sha(tmp_git_repo_dir, git_add, git_commit): ":" + relative_config_path, { "check_sha": "5f007046b5d4766f971272a0cc99f8461215c1ec", - "repo": "core-workfolow", + "repo": "core-workflow", "team": "python", "fix_commit_msg": True, "default_branch": "devel", @@ -572,8 +567,7 @@ def test_normalize_long_commit_message(): title == "[3.6] Fix broken `Show Source` links on documentation pages (GH-3113)" ) assert ( - body - == """The `Show Source` was broken because of a change made in sphinx 1.5.1 + body == """The `Show Source` was broken because of a change made in sphinx 1.5.1 In Sphinx 1.4.9, the sourcename was "index.txt". In Sphinx 1.5.1+, it is now "index.rst.txt". (cherry picked from commit b9ff498793611d1c6a9b99df464812931a1e2d69) @@ -596,8 +590,7 @@ def test_normalize_short_commit_message(): title == "[3.6] Fix broken `Show Source` links on documentation pages (GH-3113)" ) assert ( - body - == """(cherry picked from commit b9ff498793611d1c6a9b99df464812931a1e2d69) + body == """(cherry picked from commit b9ff498793611d1c6a9b99df464812931a1e2d69) Co-authored-by: Elmar Ritsch <35851+elritsch@users.noreply.github.com>""" @@ -775,12 +768,10 @@ def test_paused_flow(tmp_git_repo_dir, git_add, git_commit): initial_scm_revision = get_sha1_from("HEAD") relative_file_path = "some.toml" - tmp_git_repo_dir.join(relative_file_path).write( - f"""\ + tmp_git_repo_dir.join(relative_file_path).write(f"""\ check_sha = "{initial_scm_revision}" - repo = "core-workfolow" - """ - ) + repo = "core-workflow" + """) git_add(relative_file_path) git_commit("Add a config") config_scm_revision = get_sha1_from("HEAD") diff --git a/pyproject.toml b/pyproject.toml index adcc37f..a7c9684 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,16 +39,12 @@ optional-dependencies.dev = [ urls.Homepage = "https://github.com/python/cherry-picker" scripts.cherry_picker = "cherry_picker.cherry_picker:cherry_pick_cli" -[tool.hatch.version] -source = "vcs" +[tool.hatch] +build.hooks.vcs.version-file = "cherry_picker/_version.py" +version.source = "vcs" # Change regex to match tags like "cherry-picker-v2.2.0". -tag-pattern = '^cherry-picker-(?P[vV]?\d+(?:\.\d+){0,2}[^\+]*)(?:\+.*)?$' - -[tool.hatch.build.hooks.vcs] -version-file = "cherry_picker/_version.py" - -[tool.hatch.version.raw-options] -local_scheme = "no-local-version" +version.tag-pattern = "^cherry-picker-(?P[vV]?\\d+(?:\\.\\d+){0,2}[^\\+]*)(?:\\+.*)?$" +version.raw-options.local_scheme = "no-local-version" [tool.ruff] fix = true