rhiza 0.8.0__py3-none-any.whl → 0.8.2__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 CHANGED
@@ -85,6 +85,7 @@ def init(
85
85
  template_repository="jebel-quant/rhiza",
86
86
  template_branch="main",
87
87
  include=[
88
+ ".rhiza", # .rhiza folder
88
89
  ".github", # GitHub configuration and workflows
89
90
  ".editorconfig", # Editor configuration
90
91
  ".gitignore", # Git ignore patterns
@@ -15,7 +15,7 @@ from pathlib import Path
15
15
 
16
16
  from loguru import logger
17
17
 
18
- from rhiza.commands import init
18
+ from rhiza.commands.validate import validate
19
19
  from rhiza.models import RhizaTemplate
20
20
 
21
21
 
@@ -116,11 +116,11 @@ def materialize(target: Path, branch: str, target_branch: str | None, force: boo
116
116
  sys.exit(1)
117
117
 
118
118
  # -----------------------
119
- # Ensure Rhiza is initialized
119
+ # Validate Rhiza configuration
120
120
  # -----------------------
121
- # The init function creates template.yml if missing and validates it
121
+ # The validate function checks if template.yml exists and is valid
122
122
  # Returns True if valid, False otherwise
123
- valid = init(target)
123
+ valid = validate(target)
124
124
 
125
125
  if not valid:
126
126
  logger.error(f"Rhiza template is invalid in: {target}")
@@ -128,21 +128,8 @@ def materialize(target: Path, branch: str, target_branch: str | None, force: boo
128
128
  sys.exit(1)
129
129
 
130
130
  # Load the template configuration from the validated file
131
- # Check for template in new location first, then fall back to old location
132
- migrated_template_file = target / ".rhiza" / "template.yml"
133
- standard_template_file = target / ".github" / "rhiza" / "template.yml"
134
-
135
- if migrated_template_file.exists():
136
- template_file = migrated_template_file
137
- logger.debug(f"Loading template configuration from migrated location: {template_file}")
138
- elif standard_template_file.exists():
139
- template_file = standard_template_file
140
- logger.debug(f"Loading template configuration from standard location: {template_file}")
141
- else:
142
- logger.error("No template.yml file found")
143
- logger.error("Run 'rhiza init' or 'rhiza migrate' to create one")
144
- sys.exit(1)
145
-
131
+ # Validation ensures the file exists at .rhiza/template.yml
132
+ template_file = target / ".rhiza" / "template.yml"
146
133
  template = RhizaTemplate.from_yaml(template_file)
147
134
 
148
135
  # Extract template configuration settings
rhiza/commands/migrate.py CHANGED
@@ -10,6 +10,8 @@ from pathlib import Path
10
10
 
11
11
  from loguru import logger
12
12
 
13
+ from rhiza.models import RhizaTemplate
14
+
13
15
 
14
16
  def migrate(target: Path) -> None:
15
17
  """Migrate project to use the new .rhiza folder structure.
@@ -81,6 +83,23 @@ def migrate(target: Path) -> None:
81
83
  logger.warning("No existing template.yml file found in .github")
82
84
  logger.info("You may need to run 'rhiza init' to create a template configuration")
83
85
 
86
+ # Ensure the .rhiza folder is included in template.yml include list (if template exists)
87
+ template_file = new_template_file
88
+ if template_file.exists():
89
+ # Load existing template configuration
90
+ template = RhizaTemplate.from_yaml(template_file)
91
+ template_include = template.include or []
92
+ if ".rhiza" not in template_include:
93
+ logger.warning("The .rhiza folder is not included in your template.yml")
94
+ template_include.append(".rhiza")
95
+ logger.info("The .rhiza folder is added to your template.yml to ensure it's included in your repository")
96
+
97
+ # Save the updated template.yml
98
+ template.include = template_include
99
+ template.to_yaml(template_file)
100
+ else:
101
+ logger.debug("No template.yml present in .rhiza; skipping include update")
102
+
84
103
  # Migrate .rhiza.history to .rhiza/history if it exists
85
104
  old_history_file = target / ".rhiza.history"
86
105
  new_history_file = rhiza_dir / "history"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rhiza
3
- Version: 0.8.0
3
+ Version: 0.8.2
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
@@ -6,14 +6,14 @@ rhiza/_templates/basic/__init__.py.jinja2,sha256=gs8qN4LAKcdFd6iO9gZVLuVetODmZP_
6
6
  rhiza/_templates/basic/main.py.jinja2,sha256=uTCahxf9Bftao1IghHue4cSZ9YzBYmBEXeIhEmK9UXQ,362
7
7
  rhiza/_templates/basic/pyproject.toml.jinja2,sha256=Mizpnnd_kFQd-pCWOxG-KWhvg4_ZhZaQppTt2pz0WOc,695
8
8
  rhiza/commands/__init__.py,sha256=Z5CeMh7ylX27H6dvwqRbEKzYo5pwQq-5TyTxABUSaQg,1848
9
- rhiza/commands/init.py,sha256=RsYmomOq-00b4bAjseiHR7ljgJQ_XSjDX-ZWKYTPPN8,6787
10
- rhiza/commands/materialize.py,sha256=kzcpiKDN0HZQylZW-TZVlrJJctHnmBxq2JQQcNGyOV8,17951
11
- rhiza/commands/migrate.py,sha256=Zlu-Oq4MJCW3jcKqB2v1-wV3zEr2s6AqYV_btvGOjCE,5425
9
+ rhiza/commands/init.py,sha256=hQTd1y4fcT6JVNVVAxnr463jnt0dNG_Ku-fny4DSIfI,6830
10
+ rhiza/commands/materialize.py,sha256=AbVXJrR8faa3t7m_Xl5TR8VE3ODmkh2oiAwCYFA36wA,17343
11
+ rhiza/commands/migrate.py,sha256=hhSkj2iafCCxKrrVOfnPWDjK7fTJ5ReAJsWNDGz71s0,6307
12
12
  rhiza/commands/uninstall.py,sha256=z95xqamV7wGPr8PBveWzaRmtD5bPhOrTLI0GcOvpnAo,5371
13
13
  rhiza/commands/validate.py,sha256=1HMQWF9Syv7JKC31AkaPYMTnqy8HOvAMxMLrYty36FQ,9112
14
14
  rhiza/commands/welcome.py,sha256=w3BziR042o6oYincd3EqDsFzF6qqInU7iYhWjF3yJqY,2382
15
- rhiza-0.8.0.dist-info/METADATA,sha256=k_wVNzEknv4GiXwVCxmeUvQ8ex0OXDVsfOkiWELyI9g,25156
16
- rhiza-0.8.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
17
- rhiza-0.8.0.dist-info/entry_points.txt,sha256=NAwZUpbXvfKv50a_Qq-PxMHl3lcjAyZO63IBeuUNgfY,45
18
- rhiza-0.8.0.dist-info/licenses/LICENSE,sha256=4m5X7LhqX-6D0Ks79Ys8CLpmza8cxDG34g4S9XSNAGY,1077
19
- rhiza-0.8.0.dist-info/RECORD,,
15
+ rhiza-0.8.2.dist-info/METADATA,sha256=YXsp3ECxAvgQUjWkksYpaRNTUbENYnhQPKcdDJKJJ_A,25156
16
+ rhiza-0.8.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
17
+ rhiza-0.8.2.dist-info/entry_points.txt,sha256=NAwZUpbXvfKv50a_Qq-PxMHl3lcjAyZO63IBeuUNgfY,45
18
+ rhiza-0.8.2.dist-info/licenses/LICENSE,sha256=4m5X7LhqX-6D0Ks79Ys8CLpmza8cxDG34g4S9XSNAGY,1077
19
+ rhiza-0.8.2.dist-info/RECORD,,
File without changes