rhiza 0.5.4__py3-none-any.whl → 0.5.5__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.
@@ -18,7 +18,7 @@ from rhiza.commands import init
18
18
  from rhiza.models import RhizaTemplate
19
19
 
20
20
 
21
- def expand_paths(base_dir: Path, paths: list[str]) -> list[Path]:
21
+ def __expand_paths(base_dir: Path, paths: list[str]) -> list[Path]:
22
22
  """Expand files/directories relative to base_dir into a flat list of files.
23
23
 
24
24
  Given a list of paths relative to ``base_dir``, return a flat list of all
@@ -40,20 +40,16 @@ def expand_paths(base_dir: Path, paths: list[str]) -> list[Path]:
40
40
  def materialize(target: Path, branch: str, target_branch: str | None, force: bool) -> None:
41
41
  """Materialize Rhiza templates into the target repository.
42
42
 
43
- This performs a sparse checkout of the template repository and copies
44
- the selected files into the target repository, recording all files
45
- under template control in `.rhiza.history`.
46
-
47
- Parameters
48
- ----------
49
- target:
50
- Path to the target repository.
51
- branch:
52
- The Rhiza template branch to use.
53
- target_branch:
54
- Optional branch name to create/checkout in target repository.
55
- force:
56
- Whether to overwrite existing files.
43
+ This performs a sparse checkout of the template repository and copies the
44
+ selected files into the target repository, recording all files under
45
+ template control in `.rhiza.history`.
46
+
47
+ Args:
48
+ target (Path): Path to the target repository.
49
+ branch (str): The Rhiza template branch to use.
50
+ target_branch (str | None): Optional branch name to create/checkout in
51
+ the target repository.
52
+ force (bool): Whether to overwrite existing files.
57
53
  """
58
54
  target = target.resolve()
59
55
 
@@ -138,41 +134,67 @@ def materialize(target: Path, branch: str, target_branch: str | None, force: boo
138
134
  logger.info(f"Cloning {rhiza_repo}@{rhiza_branch} from {rhiza_host} into temporary directory")
139
135
 
140
136
  try:
141
- subprocess.run(
142
- [
143
- "git",
144
- "clone",
145
- "--depth",
146
- "1",
147
- "--filter=blob:none",
148
- "--sparse",
149
- "--branch",
150
- rhiza_branch,
151
- git_url,
152
- str(tmp_dir),
153
- ],
154
- check=True,
155
- stdout=subprocess.DEVNULL,
156
- )
137
+ # Clone the repository - capture output to avoid blocking
138
+ try:
139
+ subprocess.run(
140
+ [
141
+ "git",
142
+ "clone",
143
+ "--depth",
144
+ "1",
145
+ "--filter=blob:none",
146
+ "--sparse",
147
+ "--branch",
148
+ rhiza_branch,
149
+ git_url,
150
+ str(tmp_dir),
151
+ ],
152
+ check=True,
153
+ capture_output=True,
154
+ text=True,
155
+ )
156
+ except subprocess.CalledProcessError as e:
157
+ logger.error(f"Failed to clone repository: {e}")
158
+ if e.stderr:
159
+ logger.error(f"Git error: {e.stderr.strip()}")
160
+ raise
157
161
 
158
- subprocess.run(
159
- ["git", "sparse-checkout", "init", "--cone"],
160
- cwd=tmp_dir,
161
- check=True,
162
- )
162
+ # Initialize sparse checkout
163
+ try:
164
+ subprocess.run(
165
+ ["git", "sparse-checkout", "init", "--cone"],
166
+ cwd=tmp_dir,
167
+ check=True,
168
+ capture_output=True,
169
+ text=True,
170
+ )
171
+ except subprocess.CalledProcessError as e:
172
+ logger.error(f"Failed to initialize sparse checkout: {e}")
173
+ if e.stderr:
174
+ logger.error(f"Git error: {e.stderr.strip()}")
175
+ raise
163
176
 
164
- subprocess.run(
165
- ["git", "sparse-checkout", "set", "--skip-checks", *include_paths],
166
- cwd=tmp_dir,
167
- check=True,
168
- )
177
+ # Set sparse checkout paths
178
+ try:
179
+ subprocess.run(
180
+ ["git", "sparse-checkout", "set", "--skip-checks", *include_paths],
181
+ cwd=tmp_dir,
182
+ check=True,
183
+ capture_output=True,
184
+ text=True,
185
+ )
186
+ except subprocess.CalledProcessError as e:
187
+ logger.error(f"Failed to set sparse checkout paths: {e}")
188
+ if e.stderr:
189
+ logger.error(f"Git error: {e.stderr.strip()}")
190
+ raise
169
191
 
170
192
  # -----------------------
171
193
  # Expand include/exclude paths
172
194
  # -----------------------
173
- all_files = expand_paths(tmp_dir, include_paths)
195
+ all_files = __expand_paths(tmp_dir, include_paths)
174
196
 
175
- excluded_files = {f.resolve() for f in expand_paths(tmp_dir, excluded_paths)}
197
+ excluded_files = {f.resolve() for f in __expand_paths(tmp_dir, excluded_paths)}
176
198
 
177
199
  files_to_copy = [f for f in all_files if f.resolve() not in excluded_files]
178
200
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rhiza
3
- Version: 0.5.4
3
+ Version: 0.5.5
4
4
  Summary: Reusable configuration templates for modern Python projects
5
5
  Project-URL: Homepage, https://github.com/jebel-quant/rhiza-cli
6
6
  Project-URL: Repository, https://github.com/jebel-quant/rhiza-cli
@@ -4,10 +4,10 @@ rhiza/cli.py,sha256=orVHOn569qHm-TffRLpSoJlF5x59dNfQsC2pX7VppYA,4721
4
4
  rhiza/models.py,sha256=R2nu_bf-j-U0kPfQXg6u-MSykrdGO9ixOzZoWy8mLCc,3448
5
5
  rhiza/commands/__init__.py,sha256=lIkN15MIat-wn9CB1cgUjTzTUQB95LBBAKFK1sGHdCc,1836
6
6
  rhiza/commands/init.py,sha256=QsOV_VBnRfSPebydH-fMe3haadboNIAYlOpAIYHtgUs,1936
7
- rhiza/commands/materialize.py,sha256=PcJT7Cq1eXoUZjAe_X1TXn4yUXt1Kft7rCedEe2P-44,7921
7
+ rhiza/commands/materialize.py,sha256=5kpeLSiuAb9MIDvDRZboHRXy2JCUMmpJgF-lvwoawO4,9044
8
8
  rhiza/commands/validate.py,sha256=_0t9kfylMncm9JmKULn5e7V71XcQdFjlrtuOqZeshPM,5282
9
- rhiza-0.5.4.dist-info/METADATA,sha256=2Dh1FhzIIHbDvGu2FSPGHJCG8PQonP9rcZvO4D3MH-M,21278
10
- rhiza-0.5.4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
11
- rhiza-0.5.4.dist-info/entry_points.txt,sha256=NAwZUpbXvfKv50a_Qq-PxMHl3lcjAyZO63IBeuUNgfY,45
12
- rhiza-0.5.4.dist-info/licenses/LICENSE,sha256=4m5X7LhqX-6D0Ks79Ys8CLpmza8cxDG34g4S9XSNAGY,1077
13
- rhiza-0.5.4.dist-info/RECORD,,
9
+ rhiza-0.5.5.dist-info/METADATA,sha256=auu4yvBXlw4MIdZzUE8YDMNr2Mjj3bmC4zgH88qefJ4,21278
10
+ rhiza-0.5.5.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
11
+ rhiza-0.5.5.dist-info/entry_points.txt,sha256=NAwZUpbXvfKv50a_Qq-PxMHl3lcjAyZO63IBeuUNgfY,45
12
+ rhiza-0.5.5.dist-info/licenses/LICENSE,sha256=4m5X7LhqX-6D0Ks79Ys8CLpmza8cxDG34g4S9XSNAGY,1077
13
+ rhiza-0.5.5.dist-info/RECORD,,
File without changes