zrb 1.9.10__py3-none-any.whl → 1.9.11__py3-none-any.whl

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.
zrb/util/git.py CHANGED
@@ -1,16 +1,11 @@
1
1
  import os
2
2
  from collections.abc import Callable
3
- from typing import Any
4
-
5
- from pydantic import BaseModel
3
+ from typing import TYPE_CHECKING, Any
6
4
 
7
5
  from zrb.util.cmd.command import run_command
8
6
 
9
-
10
- class DiffResult(BaseModel):
11
- created: list[str]
12
- removed: list[str]
13
- updated: list[str]
7
+ if TYPE_CHECKING:
8
+ from zrb.util.git_diff_model import DiffResult
14
9
 
15
10
 
16
11
  async def get_diff(
@@ -18,7 +13,7 @@ async def get_diff(
18
13
  source_commit: str,
19
14
  current_commit: str,
20
15
  print_method: Callable[..., Any] = print,
21
- ) -> DiffResult:
16
+ ) -> "DiffResult":
22
17
  """
23
18
  Get the difference between two commits in a Git repository.
24
19
 
@@ -34,6 +29,8 @@ async def get_diff(
34
29
  Raises:
35
30
  Exception: If the git command returns a non-zero exit code.
36
31
  """
32
+ from zrb.util.git_diff_model import DiffResult
33
+
37
34
  cmd_result, exit_code = await run_command(
38
35
  cmd=["git", "diff", source_commit, current_commit],
39
36
  cwd=repo_dir,
@@ -0,0 +1,7 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class DiffResult(BaseModel):
5
+ created: list[str]
6
+ removed: list[str]
7
+ updated: list[str]
zrb/util/git_subtree.py CHANGED
@@ -1,24 +1,15 @@
1
1
  import os
2
2
  from collections.abc import Callable
3
- from typing import Any
4
-
5
- from pydantic import BaseModel
3
+ from typing import TYPE_CHECKING, Any
6
4
 
7
5
  from zrb.util.cmd.command import run_command
8
6
  from zrb.util.file import read_file, write_file
9
7
 
8
+ if TYPE_CHECKING:
9
+ from zrb.util.git_subtree_model import SubTreeConfig
10
10
 
11
- class SingleSubTreeConfig(BaseModel):
12
- repo_url: str
13
- branch: str
14
- prefix: str
15
-
16
-
17
- class SubTreeConfig(BaseModel):
18
- data: dict[str, SingleSubTreeConfig]
19
11
 
20
-
21
- def load_config(repo_dir: str) -> SubTreeConfig:
12
+ def load_config(repo_dir: str):
22
13
  """
23
14
  Load the subtree configuration from subtrees.json.
24
15
 
@@ -28,13 +19,15 @@ def load_config(repo_dir: str) -> SubTreeConfig:
28
19
  Returns:
29
20
  SubTreeConfig: The loaded subtree configuration.
30
21
  """
22
+ from zrb.util.git_subtree_model import SubTreeConfig
23
+
31
24
  file_path = os.path.join(repo_dir, "subtrees.json")
32
25
  if not os.path.exists(file_path):
33
26
  return SubTreeConfig(data={})
34
27
  return SubTreeConfig.model_validate_json(read_file(file_path))
35
28
 
36
29
 
37
- def save_config(repo_dir: str, config: SubTreeConfig):
30
+ def save_config(repo_dir: str, config: "SubTreeConfig"):
38
31
  """
39
32
  Save the subtree configuration to subtrees.json.
40
33
 
@@ -70,6 +63,8 @@ async def add_subtree(
70
63
  name already exists.
71
64
  Exception: If the git command returns a non-zero exit code.
72
65
  """
66
+ from zrb.util.git_subtree_model import SingleSubTreeConfig
67
+
73
68
  config = load_config(repo_dir)
74
69
  if os.path.isdir(prefix):
75
70
  raise ValueError(f"Directory exists: {prefix}")
@@ -0,0 +1,11 @@
1
+ from pydantic import BaseModel
2
+
3
+
4
+ class SingleSubTreeConfig(BaseModel):
5
+ repo_url: str
6
+ branch: str
7
+ prefix: str
8
+
9
+
10
+ class SubTreeConfig(BaseModel):
11
+ data: dict[str, SingleSubTreeConfig]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: zrb
3
- Version: 1.9.10
3
+ Version: 1.9.11
4
4
  Summary: Your Automation Powerhouse
5
5
  Home-page: https://github.com/state-alchemists/zrb
6
6
  License: AGPL-3.0-or-later
@@ -377,8 +377,10 @@ zrb/util/codemod/modify_method.py,sha256=5fioXjqNQmrf4CV2qlTZHpViF9PMnNer4FvuKam
377
377
  zrb/util/codemod/modify_module.py,sha256=2mzi_NxJ-kNFo5G0U_Rqb3JoYQl1s6Izt7b_wAl10F0,715
378
378
  zrb/util/cron.py,sha256=UWqqhhM7DDTPx6wjCIdBndnVh3NRu-sdKazp8aZkXh8,3833
379
379
  zrb/util/file.py,sha256=tm_8qn0vEM8Hz46yXUcvFHfsLtQNqidQaEuB85xqhFE,2806
380
- zrb/util/git.py,sha256=gS_Y9sQgJbY0PfgSQiowLvV3Nf0y9C8nT3j6z6oEsG8,8186
381
- zrb/util/git_subtree.py,sha256=E_UB5OIgm8WkHL9beifRxpZ25_BB9p1H578OhLZTgRU,4611
380
+ zrb/util/git.py,sha256=GS08OqE-gs6mN-_VqACN82DbI81nzG3FiXeim_-jVAU,8193
381
+ zrb/util/git_diff_model.py,sha256=Fthl2nyBz3D5fIfbMCPEFBWfXUB6qA4rQWApKaimaI8,131
382
+ zrb/util/git_subtree.py,sha256=AyQWCWEi2EIzEpYXRnYN55157KMUql0WHj70QNw5PHU,4612
383
+ zrb/util/git_subtree_model.py,sha256=mDMUG6mju1_-XXpIE41EqFdu_gmDeeJ3OAxqcJunY7g,196
382
384
  zrb/util/group.py,sha256=T82yr3qg9I5k10VPXkMyrIRIqyfzadSH813bqzwKEPI,4718
383
385
  zrb/util/init_path.py,sha256=9eN7CkWNGhDBpjTQs2j9YHVMzui7Y8DEb1WP4aTPzeo,659
384
386
  zrb/util/load.py,sha256=DK0KYSlu48HCoGPqnW1IxnE3pHrZSPCstfz8Fjyqqv8,2140
@@ -391,7 +393,7 @@ zrb/util/todo.py,sha256=r9_KYF2-hLKMNjsp6AFK9zivykMrywd-kJ4bCwfdafI,19323
391
393
  zrb/util/todo_model.py,sha256=0SJ8aLYfJAscDOk5JsH7pXP3h1rAG91VMCS20-c2Y6A,1576
392
394
  zrb/xcom/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
393
395
  zrb/xcom/xcom.py,sha256=o79rxR9wphnShrcIushA0Qt71d_p3ZTxjNf7x9hJB78,1571
394
- zrb-1.9.10.dist-info/METADATA,sha256=naCcHpyKVqi7EqfXhaJPzV4fyjeSClYKXws2yjpyZno,9778
395
- zrb-1.9.10.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
396
- zrb-1.9.10.dist-info/entry_points.txt,sha256=-Pg3ElWPfnaSM-XvXqCxEAa-wfVI6BEgcs386s8C8v8,46
397
- zrb-1.9.10.dist-info/RECORD,,
396
+ zrb-1.9.11.dist-info/METADATA,sha256=UzGGLF7ae4d-kprWIxmTmvvRRmTDWBJ4jxfsYPhxSaM,9778
397
+ zrb-1.9.11.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
398
+ zrb-1.9.11.dist-info/entry_points.txt,sha256=-Pg3ElWPfnaSM-XvXqCxEAa-wfVI6BEgcs386s8C8v8,46
399
+ zrb-1.9.11.dist-info/RECORD,,
File without changes