rhiza 0.6.1__py3-none-any.whl → 0.7.1__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.
- rhiza/commands/init.py +2 -2
- rhiza/commands/materialize.py +41 -2
- {rhiza-0.6.1.dist-info → rhiza-0.7.1.dist-info}/METADATA +1 -1
- {rhiza-0.6.1.dist-info → rhiza-0.7.1.dist-info}/RECORD +7 -7
- {rhiza-0.6.1.dist-info → rhiza-0.7.1.dist-info}/WHEEL +0 -0
- {rhiza-0.6.1.dist-info → rhiza-0.7.1.dist-info}/entry_points.txt +0 -0
- {rhiza-0.6.1.dist-info → rhiza-0.7.1.dist-info}/licenses/LICENSE +0 -0
rhiza/commands/init.py
CHANGED
|
@@ -87,12 +87,12 @@ Next steps:
|
|
|
87
87
|
|
|
88
88
|
# Bootstrap basic Python project structure if it doesn't exist
|
|
89
89
|
# Get the name of the parent directory to use as package name
|
|
90
|
-
parent = target.
|
|
90
|
+
parent = target.name
|
|
91
91
|
logger.debug(f"Parent directory name: {parent}")
|
|
92
92
|
|
|
93
93
|
# Create src/{parent} directory structure following src-layout
|
|
94
94
|
src_folder = target / "src" / parent
|
|
95
|
-
if not
|
|
95
|
+
if not (target / "src").exists():
|
|
96
96
|
logger.info(f"Creating Python package structure: {src_folder}")
|
|
97
97
|
src_folder.mkdir(parents=True)
|
|
98
98
|
|
rhiza/commands/materialize.py
CHANGED
|
@@ -320,13 +320,52 @@ def materialize(target: Path, branch: str, target_branch: str | None, force: boo
|
|
|
320
320
|
)
|
|
321
321
|
logger.info(f"Workflow files affected: {len(workflow_files)}")
|
|
322
322
|
|
|
323
|
+
# -----------------------
|
|
324
|
+
# Clean up orphaned files
|
|
325
|
+
# -----------------------
|
|
326
|
+
# Read the old .rhiza.history file to find files that are no longer
|
|
327
|
+
# part of the current materialization and should be deleted
|
|
328
|
+
history_file = target / ".rhiza.history"
|
|
329
|
+
previously_tracked_files: set[Path] = set()
|
|
330
|
+
|
|
331
|
+
if history_file.exists():
|
|
332
|
+
logger.debug("Reading existing .rhiza.history file")
|
|
333
|
+
with history_file.open("r", encoding="utf-8") as f:
|
|
334
|
+
for line in f:
|
|
335
|
+
line = line.strip()
|
|
336
|
+
# Skip comments and empty lines
|
|
337
|
+
if line and not line.startswith("#"):
|
|
338
|
+
previously_tracked_files.add(Path(line))
|
|
339
|
+
|
|
340
|
+
logger.debug(f"Found {len(previously_tracked_files)} file(s) in previous .rhiza.history")
|
|
341
|
+
|
|
342
|
+
# Convert materialized_files list to a set for comparison
|
|
343
|
+
currently_materialized_files = set(materialized_files)
|
|
344
|
+
|
|
345
|
+
# Find orphaned files (in old history but not in new materialization)
|
|
346
|
+
orphaned_files = previously_tracked_files - currently_materialized_files
|
|
347
|
+
|
|
348
|
+
if orphaned_files:
|
|
349
|
+
logger.info(f"Found {len(orphaned_files)} orphaned file(s) no longer maintained by template")
|
|
350
|
+
for file_path in sorted(orphaned_files):
|
|
351
|
+
full_path = target / file_path
|
|
352
|
+
if full_path.exists():
|
|
353
|
+
try:
|
|
354
|
+
full_path.unlink()
|
|
355
|
+
logger.success(f"[DEL] {file_path}")
|
|
356
|
+
except Exception as e:
|
|
357
|
+
logger.warning(f"Failed to delete {file_path}: {e}")
|
|
358
|
+
else:
|
|
359
|
+
logger.debug(f"Skipping {file_path} (already deleted)")
|
|
360
|
+
else:
|
|
361
|
+
logger.debug("No orphaned files to clean up")
|
|
362
|
+
|
|
323
363
|
# -----------------------
|
|
324
364
|
# Write .rhiza.history
|
|
325
365
|
# -----------------------
|
|
326
366
|
# This file tracks which files were materialized by Rhiza
|
|
327
367
|
# Useful for understanding which files came from the template
|
|
328
368
|
logger.debug("Writing .rhiza.history file")
|
|
329
|
-
history_file = target / ".rhiza.history"
|
|
330
369
|
with history_file.open("w", encoding="utf-8") as f:
|
|
331
370
|
f.write("# Rhiza Template History\n")
|
|
332
371
|
f.write("# This file lists all files managed by the Rhiza template.\n")
|
|
@@ -338,7 +377,7 @@ def materialize(target: Path, branch: str, target_branch: str | None, force: boo
|
|
|
338
377
|
for file_path in sorted(materialized_files):
|
|
339
378
|
f.write(f"{file_path}\n")
|
|
340
379
|
|
|
341
|
-
logger.info(f"
|
|
380
|
+
logger.info(f"Updated {history_file.relative_to(target)} with {len(materialized_files)} file(s)")
|
|
342
381
|
|
|
343
382
|
logger.success("Rhiza templates materialized successfully")
|
|
344
383
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rhiza
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.1
|
|
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
|
|
@@ -3,12 +3,12 @@ rhiza/__main__.py,sha256=Lx0GqVZo6ymm0f18_uYB6E7_SOWwJNYjb73Vr31oLoM,236
|
|
|
3
3
|
rhiza/cli.py,sha256=faCIOKDzEDRvL4doLZhiIAyHUUGESGrwWLtjLjimCUY,5111
|
|
4
4
|
rhiza/models.py,sha256=fW9lofkkid-bghk2bXEgBdGbZ4scSqG726fMrVfKX_M,3454
|
|
5
5
|
rhiza/commands/__init__.py,sha256=Z5CeMh7ylX27H6dvwqRbEKzYo5pwQq-5TyTxABUSaQg,1848
|
|
6
|
-
rhiza/commands/init.py,sha256=
|
|
7
|
-
rhiza/commands/materialize.py,sha256=
|
|
6
|
+
rhiza/commands/init.py,sha256=3dAQmFYPVIdRXyJsv0-28RLpPcRh-0urMyd-3IxHnGw,5725
|
|
7
|
+
rhiza/commands/materialize.py,sha256=jmXH9Fb3lkktxgdWtZ2cQk0wyURleWzHvQN6n_DNZ7U,16049
|
|
8
8
|
rhiza/commands/validate.py,sha256=cxStfXbY_ifsc_yRDCg0TOnv8jG05hxE9rteta-X9hQ,8093
|
|
9
9
|
rhiza/commands/welcome.py,sha256=w3BziR042o6oYincd3EqDsFzF6qqInU7iYhWjF3yJqY,2382
|
|
10
|
-
rhiza-0.
|
|
11
|
-
rhiza-0.
|
|
12
|
-
rhiza-0.
|
|
13
|
-
rhiza-0.
|
|
14
|
-
rhiza-0.
|
|
10
|
+
rhiza-0.7.1.dist-info/METADATA,sha256=NUz6Ye9SW_JPrqjGmqSLBPJO8eDHvkE_Z4mtCw70Scc,22742
|
|
11
|
+
rhiza-0.7.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
12
|
+
rhiza-0.7.1.dist-info/entry_points.txt,sha256=NAwZUpbXvfKv50a_Qq-PxMHl3lcjAyZO63IBeuUNgfY,45
|
|
13
|
+
rhiza-0.7.1.dist-info/licenses/LICENSE,sha256=4m5X7LhqX-6D0Ks79Ys8CLpmza8cxDG34g4S9XSNAGY,1077
|
|
14
|
+
rhiza-0.7.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|