wexample-helpers-git 6.11.2__tar.gz → 7.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. {wexample_helpers_git-6.11.2 → wexample_helpers_git-7.0.0}/PKG-INFO +4 -4
  2. {wexample_helpers_git-6.11.2 → wexample_helpers_git-7.0.0}/README.md +2 -2
  3. {wexample_helpers_git-6.11.2 → wexample_helpers_git-7.0.0}/pyproject.toml +2 -2
  4. {wexample_helpers_git-6.11.2/src/wexample_helpers_git/helpers → wexample_helpers_git-7.0.0/src/wexample_helpers_git/helper}/git.py +24 -24
  5. {wexample_helpers_git-6.11.2/src/wexample_helpers_git/helpers → wexample_helpers_git-7.0.0/src/wexample_helpers_git/helper}/git_retryable_callback_manager.py +1 -1
  6. {wexample_helpers_git-6.11.2/src/wexample_helpers_git/helpers → wexample_helpers_git-7.0.0/src/wexample_helpers_git/helper}/repo.py +1 -1
  7. {wexample_helpers_git-6.11.2/tests/helpers → wexample_helpers_git-7.0.0/tests/helper}/test_helper_git.py +2 -2
  8. {wexample_helpers_git-6.11.2/tests/helpers → wexample_helpers_git-7.0.0/tests/helper}/test_repo.py +5 -5
  9. {wexample_helpers_git-6.11.2 → wexample_helpers_git-7.0.0}/src/wexample_helpers_git/__init__.py +0 -0
  10. {wexample_helpers_git-6.11.2 → wexample_helpers_git-7.0.0}/src/wexample_helpers_git/__pycache__/__init__.py +0 -0
  11. {wexample_helpers_git-6.11.2 → wexample_helpers_git-7.0.0}/src/wexample_helpers_git/const/__init__.py +0 -0
  12. {wexample_helpers_git-6.11.2 → wexample_helpers_git-7.0.0}/src/wexample_helpers_git/const/common.py +0 -0
  13. {wexample_helpers_git-6.11.2/src/wexample_helpers_git/helpers → wexample_helpers_git-7.0.0/src/wexample_helpers_git/helper}/__init__.py +0 -0
  14. {wexample_helpers_git-6.11.2/src/wexample_helpers_git/helpers → wexample_helpers_git-7.0.0/src/wexample_helpers_git/helper}/__pycache__/__init__.py +0 -0
  15. {wexample_helpers_git-6.11.2/src/wexample_helpers_git/helpers → wexample_helpers_git-7.0.0/src/wexample_helpers_git/helper}/gitignore.py +0 -0
  16. {wexample_helpers_git-6.11.2 → wexample_helpers_git-7.0.0}/src/wexample_helpers_git/py.typed +0 -0
  17. {wexample_helpers_git-6.11.2/tests/helpers → wexample_helpers_git-7.0.0/tests/helper}/__init__.py +0 -0
  18. {wexample_helpers_git-6.11.2 → wexample_helpers_git-7.0.0}/tests/unit/__init__.py +0 -0
  19. {wexample_helpers_git-6.11.2/tests/unit/helpers → wexample_helpers_git-7.0.0/tests/unit/helper}/__init__.py +0 -0
  20. {wexample_helpers_git-6.11.2/tests/unit/helpers → wexample_helpers_git-7.0.0/tests/unit/helper}/test_git.py +0 -0
  21. {wexample_helpers_git-6.11.2/tests/unit/helpers → wexample_helpers_git-7.0.0/tests/unit/helper}/test_git_retryable_callback_manager.py +0 -0
  22. {wexample_helpers_git-6.11.2/tests/unit/helpers → wexample_helpers_git-7.0.0/tests/unit/helper}/test_gitignore.py +0 -0
  23. {wexample_helpers_git-6.11.2/tests/unit/helpers → wexample_helpers_git-7.0.0/tests/unit/helper}/test_repo.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wexample-helpers-git
3
- Version: 6.11.2
3
+ Version: 7.0.0
4
4
  Summary: Some python basic helpers for git.
5
5
  Author-Email: weeger <contact@wexample.com>
6
6
  License: MIT
@@ -12,7 +12,7 @@ Requires-Python: >=3.10
12
12
  Requires-Dist: attrs>=23.1.0
13
13
  Requires-Dist: cattrs>=23.1.0
14
14
  Requires-Dist: gitpython
15
- Requires-Dist: wexample-helpers>=17.3.0
15
+ Requires-Dist: wexample-helpers>=19.0.0
16
16
  Provides-Extra: dev
17
17
  Requires-Dist: pytest; extra == "dev"
18
18
  Requires-Dist: pytest-cov; extra == "dev"
@@ -20,7 +20,7 @@ Description-Content-Type: text/markdown
20
20
 
21
21
  # helpers_git
22
22
 
23
- Version: 6.11.2
23
+ Version: 7.0.0
24
24
 
25
25
  Some python basic helpers for git.
26
26
 
@@ -103,7 +103,7 @@ Visit the [Wexample Suite documentation](https://docs.wexample.com) for the comp
103
103
  - attrs: >=23.1.0
104
104
  - cattrs: >=23.1.0
105
105
  - gitpython:
106
- - wexample-helpers: >=17.3.0
106
+ - wexample-helpers: >=19.0.0
107
107
 
108
108
  ## Versioning & Compatibility Policy
109
109
 
@@ -1,6 +1,6 @@
1
1
  # helpers_git
2
2
 
3
- Version: 6.11.2
3
+ Version: 7.0.0
4
4
 
5
5
  Some python basic helpers for git.
6
6
 
@@ -83,7 +83,7 @@ Visit the [Wexample Suite documentation](https://docs.wexample.com) for the comp
83
83
  - attrs: >=23.1.0
84
84
  - cattrs: >=23.1.0
85
85
  - gitpython:
86
- - wexample-helpers: >=17.3.0
86
+ - wexample-helpers: >=19.0.0
87
87
 
88
88
  ## Versioning & Compatibility Policy
89
89
 
@@ -6,7 +6,7 @@ build-backend = "pdm.backend"
6
6
 
7
7
  [project]
8
8
  name = "wexample-helpers-git"
9
- version = "6.11.2"
9
+ version = "7.0.0"
10
10
  description = "Some python basic helpers for git."
11
11
  authors = [
12
12
  { name = "weeger", email = "contact@wexample.com" },
@@ -21,7 +21,7 @@ dependencies = [
21
21
  "attrs>=23.1.0",
22
22
  "cattrs>=23.1.0",
23
23
  "gitpython",
24
- "wexample-helpers>=17.3.0",
24
+ "wexample-helpers>=19.0.0",
25
25
  ]
26
26
 
27
27
  [project.readme]
@@ -3,7 +3,7 @@ from __future__ import annotations
3
3
  from typing import TYPE_CHECKING
4
4
 
5
5
  from wexample_helpers.classes.shell_result import ShellResult
6
- from wexample_helpers.helpers.shell import shell_run
6
+ from wexample_helpers.helper.shell import shell_run
7
7
 
8
8
  if TYPE_CHECKING:
9
9
  from git import Remote, Repo
@@ -14,7 +14,7 @@ def git_checkout_new_branch(
14
14
  branch: str, *, cwd: FileStringOrPath, inherit_stdio: bool = True
15
15
  ) -> None:
16
16
  """Create and switch to a new branch using `git checkout -b <branch>` (compat)."""
17
- from wexample_helpers.helpers.file import file_resolve_path
17
+ from wexample_helpers.helper.file import file_resolve_path
18
18
 
19
19
  shell_run(
20
20
  ["git", "checkout", "-b", branch],
@@ -27,7 +27,7 @@ def git_commit_all_with_message(
27
27
  message: str, *, cwd: FileStringOrPath, inherit_stdio: bool = True
28
28
  ) -> None:
29
29
  """Stage all changes (including new files) and commit with the provided message."""
30
- from wexample_helpers.helpers.file import file_resolve_path
30
+ from wexample_helpers.helper.file import file_resolve_path
31
31
 
32
32
  resolved = file_resolve_path(cwd)
33
33
  git_run(["add", "-A"], inherit_stdio=inherit_stdio, cwd=resolved)
@@ -55,7 +55,7 @@ def git_create_or_switch_branch(
55
55
 
56
56
  def git_current_branch(*, cwd: FileStringOrPath, inherit_stdio: bool = False) -> str:
57
57
  """Return the current branch name."""
58
- from wexample_helpers.helpers.file import file_resolve_path
58
+ from wexample_helpers.helper.file import file_resolve_path
59
59
 
60
60
  return shell_run(
61
61
  ["git", "rev-parse", "--abbrev-ref", "HEAD"],
@@ -74,7 +74,7 @@ def git_ensure_upstream(
74
74
 
75
75
  Returns the upstream (e.g., "origin/main").
76
76
  """
77
- from wexample_helpers.helpers.file import file_resolve_path
77
+ from wexample_helpers.helper.file import file_resolve_path
78
78
 
79
79
  cwd_resolved = file_resolve_path(cwd)
80
80
  branch = git_current_branch(cwd=cwd_resolved, inherit_stdio=False)
@@ -114,7 +114,7 @@ def git_get_changed_paths(*, cwd: FileStringOrPath) -> set[str]:
114
114
  """
115
115
  from pathlib import Path
116
116
 
117
- from wexample_helpers.helpers.file import file_resolve_path
117
+ from wexample_helpers.helper.file import file_resolve_path
118
118
 
119
119
  cwd_path = Path(file_resolve_path(cwd))
120
120
 
@@ -154,7 +154,7 @@ def git_get_changed_paths(*, cwd: FileStringOrPath) -> set[str]:
154
154
 
155
155
  def git_get_current_commit_hash(*, cwd: FileStringOrPath, short: bool = False) -> str:
156
156
  """Return the current commit hash (full or short)."""
157
- from wexample_helpers.helpers.file import file_resolve_path
157
+ from wexample_helpers.helper.file import file_resolve_path
158
158
 
159
159
  cmd = ["git", "rev-parse"]
160
160
  if short:
@@ -168,7 +168,7 @@ def git_get_current_commit_hash(*, cwd: FileStringOrPath, short: bool = False) -
168
168
 
169
169
  def git_get_remote_url(remote: str = "origin", *, cwd: FileStringOrPath) -> str:
170
170
  """Return the fetch URL of the given remote."""
171
- from wexample_helpers.helpers.file import file_resolve_path
171
+ from wexample_helpers.helper.file import file_resolve_path
172
172
 
173
173
  return git_run(
174
174
  ["remote", "get-url", remote],
@@ -179,7 +179,7 @@ def git_get_remote_url(remote: str = "origin", *, cwd: FileStringOrPath) -> str:
179
179
 
180
180
  def git_get_upstream(*, cwd: FileStringOrPath, inherit_stdio: bool = False) -> str:
181
181
  """Return the symbolic upstream (e.g., origin/main) or empty string if none is set."""
182
- from wexample_helpers.helpers.file import file_resolve_path
182
+ from wexample_helpers.helper.file import file_resolve_path
183
183
 
184
184
  try:
185
185
  return shell_run(
@@ -198,7 +198,7 @@ def git_has_changes_since_tag(
198
198
 
199
199
  Runs: git diff --quiet <tag> -- <pathspec> || echo CHANGED
200
200
  """
201
- from wexample_helpers.helpers.file import file_resolve_path
201
+ from wexample_helpers.helper.file import file_resolve_path
202
202
 
203
203
  out = shell_run(
204
204
  [
@@ -214,7 +214,7 @@ def git_has_changes_since_tag(
214
214
 
215
215
  def git_has_index_changes(*, cwd: FileStringOrPath) -> bool:
216
216
  """Return True if there are staged (indexed) changes."""
217
- from wexample_helpers.helpers.file import file_resolve_path
217
+ from wexample_helpers.helper.file import file_resolve_path
218
218
 
219
219
  # Always capture output here regardless of inherit_stdio so we can safely read stdout.
220
220
  out = shell_run(
@@ -232,7 +232,7 @@ def git_has_uncommitted_changes(*, cwd: FileStringOrPath) -> bool:
232
232
 
233
233
  def git_has_working_changes(*, cwd: FileStringOrPath) -> bool:
234
234
  """Return True if there are unstaged changes in tracked files."""
235
- from wexample_helpers.helpers.file import file_resolve_path
235
+ from wexample_helpers.helper.file import file_resolve_path
236
236
 
237
237
  # Always capture output here regardless of inherit_stdio so we can safely read stdout.
238
238
  # When inherit_stdio=True, stdout would be None and .strip() would fail.
@@ -246,7 +246,7 @@ def git_has_working_changes(*, cwd: FileStringOrPath) -> bool:
246
246
 
247
247
  def git_is_init(path: FileStringOrPath) -> bool:
248
248
  from git import InvalidGitRepositoryError, Repo
249
- from wexample_helpers.helpers.file import file_resolve_path
249
+ from wexample_helpers.helper.file import file_resolve_path
250
250
 
251
251
  path = file_resolve_path(path)
252
252
 
@@ -267,7 +267,7 @@ def git_last_tag_for_prefix(
267
267
 
268
268
  Returns None if no tag matches.
269
269
  """
270
- from wexample_helpers.helpers.file import file_resolve_path
270
+ from wexample_helpers.helper.file import file_resolve_path
271
271
 
272
272
  out = shell_run(
273
273
  [
@@ -285,7 +285,7 @@ def git_pull_rebase_autostash(
285
285
  *, cwd: FileStringOrPath, inherit_stdio: bool = True
286
286
  ) -> None:
287
287
  """Pull latest changes with rebase and autostash to preserve local modifications."""
288
- from wexample_helpers.helpers.file import file_resolve_path
288
+ from wexample_helpers.helper.file import file_resolve_path
289
289
 
290
290
  git_run(
291
291
  ["pull", "--rebase", "--autostash"],
@@ -308,7 +308,7 @@ def git_push_follow_tags(
308
308
 
309
309
  - If upstream is missing, uses `git push -u` which will create the remote branch if needed.
310
310
  """
311
- from wexample_helpers.helpers.file import file_resolve_path
311
+ from wexample_helpers.helper.file import file_resolve_path
312
312
 
313
313
  cwd = file_resolve_path(cwd)
314
314
 
@@ -386,7 +386,7 @@ def git_push_tag(
386
386
  inherit_stdio: bool = True,
387
387
  ) -> ShellResult:
388
388
  """Push a specific tag to the remote."""
389
- from wexample_helpers.helpers.file import file_resolve_path
389
+ from wexample_helpers.helper.file import file_resolve_path
390
390
 
391
391
  cmd = ["push"]
392
392
  if force:
@@ -425,7 +425,7 @@ def git_set_upstream(
425
425
  inherit_stdio: bool = True,
426
426
  ) -> None:
427
427
  """Set the upstream of the current branch to remote/branch."""
428
- from wexample_helpers.helpers.file import file_resolve_path
428
+ from wexample_helpers.helper.file import file_resolve_path
429
429
 
430
430
  shell_run(
431
431
  [
@@ -444,7 +444,7 @@ def git_switch_branch(
444
444
  branch: str, *, cwd: FileStringOrPath, inherit_stdio: bool = True
445
445
  ) -> None:
446
446
  """Switch to an existing branch using `git switch <branch>`."""
447
- from wexample_helpers.helpers.file import file_resolve_path
447
+ from wexample_helpers.helper.file import file_resolve_path
448
448
 
449
449
  shell_run(
450
450
  ["git", "switch", branch],
@@ -458,7 +458,7 @@ def git_switch_new_branch(
458
458
  branch: str, *, cwd: FileStringOrPath, inherit_stdio: bool = True
459
459
  ) -> None:
460
460
  """Create and switch to a new branch using `git switch -c <branch>`."""
461
- from wexample_helpers.helpers.file import file_resolve_path
461
+ from wexample_helpers.helper.file import file_resolve_path
462
462
 
463
463
  shell_run(
464
464
  ["git", "switch", "-c", branch],
@@ -471,7 +471,7 @@ def git_tag_annotated(
471
471
  tag: str, message: str, *, cwd: FileStringOrPath, inherit_stdio: bool = True
472
472
  ) -> None:
473
473
  """Create an annotated tag. Raises if the tag already exists."""
474
- from wexample_helpers.helpers.file import file_resolve_path
474
+ from wexample_helpers.helper.file import file_resolve_path
475
475
 
476
476
  shell_run(
477
477
  ["git", "tag", "-a", tag, "-m", message],
@@ -484,7 +484,7 @@ def git_tag_exists(
484
484
  tag: str, *, cwd: FileStringOrPath, inherit_stdio: bool = False
485
485
  ) -> bool:
486
486
  """Return True if a tag with the given name exists locally."""
487
- from wexample_helpers.helpers.file import file_resolve_path
487
+ from wexample_helpers.helper.file import file_resolve_path
488
488
 
489
489
  try:
490
490
  out = shell_run(
@@ -501,7 +501,7 @@ def git_tag_lightweight(
501
501
  tag: str, *, cwd: FileStringOrPath, force: bool = False, inherit_stdio: bool = True
502
502
  ) -> None:
503
503
  """Create (or force-update) a lightweight tag at HEAD."""
504
- from wexample_helpers.helpers.file import file_resolve_path
504
+ from wexample_helpers.helper.file import file_resolve_path
505
505
 
506
506
  cmd = ["tag"]
507
507
  if force:
@@ -512,7 +512,7 @@ def git_tag_lightweight(
512
512
 
513
513
  def git_tag_points_to_head(tag: str, *, cwd: FileStringOrPath) -> bool:
514
514
  """Return True if the given tag resolves to the same commit as HEAD."""
515
- from wexample_helpers.helpers.file import file_resolve_path
515
+ from wexample_helpers.helper.file import file_resolve_path
516
516
 
517
517
  try:
518
518
  tag_hash = shell_run(
@@ -4,7 +4,7 @@ from collections.abc import Iterable
4
4
  from typing import TypeVar
5
5
 
6
6
  from wexample_helpers.decorator.base_class import base_class
7
- from wexample_helpers.helpers.retryable_callback_manager import (
7
+ from wexample_helpers.helper.retryable_callback_manager import (
8
8
  RetryableCallbackManager,
9
9
  )
10
10
 
@@ -9,7 +9,7 @@ STATE_FILE = Path(".last_git_state")
9
9
 
10
10
  def repo_get_state(cwd: PathOrString | None = None) -> str:
11
11
  """Return a unique hash representing the current git state (HEAD + changes)."""
12
- from wexample_helpers_git.helpers.git import git_run
12
+ from wexample_helpers_git.helper.git import git_run
13
13
 
14
14
  head_result = git_run(["rev-parse", "HEAD"], cwd=cwd)
15
15
  head_hash = head_result.stdout.strip() if head_result.stdout else ""
@@ -27,7 +27,7 @@ def temp_dir(tmp_path: Path) -> Generator[Path]:
27
27
 
28
28
 
29
29
  def test_git_is_init(temp_dir: Path, git_repo: Repo) -> None:
30
- from wexample_helpers_git.helpers.git import git_is_init
30
+ from wexample_helpers_git.helper.git import git_is_init
31
31
 
32
32
  # Test with initialized repository
33
33
  assert git_is_init(temp_dir) is True
@@ -43,7 +43,7 @@ def test_git_is_init(temp_dir: Path, git_repo: Repo) -> None:
43
43
 
44
44
 
45
45
  def test_git_remote_create_once(git_repo: Repo) -> None:
46
- from wexample_helpers_git.helpers.git import git_remote_create_once
46
+ from wexample_helpers_git.helper.git import git_remote_create_once
47
47
 
48
48
  remote_name = "origin"
49
49
  remote_url = "https://github.com/test/repo.git"
@@ -26,7 +26,7 @@ def git_repo(tmp_path: Path) -> Path:
26
26
 
27
27
 
28
28
  def test_repo_get_state_changes_with_working_tree(git_repo: Path) -> None:
29
- from wexample_helpers_git.helpers.repo import repo_get_state
29
+ from wexample_helpers_git.helper.repo import repo_get_state
30
30
 
31
31
  before = repo_get_state(cwd=git_repo)
32
32
  (git_repo / "file.txt").write_text("modified")
@@ -35,7 +35,7 @@ def test_repo_get_state_changes_with_working_tree(git_repo: Path) -> None:
35
35
 
36
36
 
37
37
  def test_repo_get_state_returns_head_and_diff_hash(git_repo: Path) -> None:
38
- from wexample_helpers_git.helpers.repo import repo_get_state
38
+ from wexample_helpers_git.helper.repo import repo_get_state
39
39
 
40
40
  state = repo_get_state(cwd=git_repo)
41
41
  assert "-" in state
@@ -45,7 +45,7 @@ def test_repo_get_state_returns_head_and_diff_hash(git_repo: Path) -> None:
45
45
  def test_repo_has_changed_false_on_second_unchanged_run(
46
46
  git_repo: Path, tmp_path: Path
47
47
  ) -> None:
48
- from wexample_helpers_git.helpers.repo import repo_has_changed
48
+ from wexample_helpers_git.helper.repo import repo_has_changed
49
49
 
50
50
  state_file = tmp_path / "state"
51
51
  repo_has_changed(cwd=git_repo, state_file=state_file)
@@ -53,7 +53,7 @@ def test_repo_has_changed_false_on_second_unchanged_run(
53
53
 
54
54
 
55
55
  def test_repo_has_changed_since_detects_modification(git_repo: Path) -> None:
56
- from wexample_helpers_git.helpers.repo import (
56
+ from wexample_helpers_git.helper.repo import (
57
57
  repo_get_state,
58
58
  repo_has_changed_since,
59
59
  )
@@ -65,7 +65,7 @@ def test_repo_has_changed_since_detects_modification(git_repo: Path) -> None:
65
65
 
66
66
 
67
67
  def test_repo_has_changed_true_on_first_run(git_repo: Path, tmp_path: Path) -> None:
68
- from wexample_helpers_git.helpers.repo import repo_has_changed
68
+ from wexample_helpers_git.helper.repo import repo_has_changed
69
69
 
70
70
  state_file = tmp_path / "state"
71
71
  assert repo_has_changed(cwd=git_repo, state_file=state_file) is True