rhiza 0.5.6__py3-none-any.whl → 0.6.0__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/__init__.py CHANGED
@@ -29,7 +29,7 @@ Validate your configuration:
29
29
  rhiza validate
30
30
  ```
31
31
 
32
- Customize `.github/template.yml`, then materialize templates into your project:
32
+ Customize `.github/rhiza/template.yml`, then materialize templates into your project:
33
33
 
34
34
  ```bash
35
35
  rhiza materialize
rhiza/cli.py CHANGED
@@ -71,10 +71,10 @@ def init(
71
71
  help="Target directory (defaults to current directory)",
72
72
  ),
73
73
  ):
74
- r"""Initialize or validate .github/template.yml.
74
+ r"""Initialize or validate .github/rhiza/template.yml.
75
75
 
76
76
  \b
77
- Creates a default `.github/template.yml` configuration file if one
77
+ Creates a default `.github/rhiza/template.yml` configuration file if one
78
78
  doesn't exist, or validates the existing configuration.
79
79
 
80
80
  \b
@@ -117,10 +117,10 @@ def materialize(
117
117
 
118
118
  \b
119
119
  Materializes configuration files from the template repository specified
120
- in .github/template.yml into your project. This command:
120
+ in .github/rhiza/template.yml into your project. This command:
121
121
 
122
122
  \b
123
- - Reads .github/template.yml configuration
123
+ - Reads .github/rhiza/template.yml configuration
124
124
  - Performs a sparse clone of the template repository
125
125
  - Copies specified files/directories to your project
126
126
  - Respects exclusion patterns defined in the configuration
@@ -149,7 +149,7 @@ def validate(
149
149
  ):
150
150
  r"""Validate Rhiza template configuration.
151
151
 
152
- Validates the .github/template.yml file to ensure it is syntactically
152
+ Validates the .github/rhiza/template.yml file to ensure it is syntactically
153
153
  correct and semantically valid.
154
154
 
155
155
  \b
@@ -8,7 +8,7 @@ configuration templates for Python projects.
8
8
 
9
9
  ### init
10
10
 
11
- Initialize or validate `.github/template.yml` in a target directory.
11
+ Initialize or validate `.github/rhiza/template.yml` in a target directory.
12
12
 
13
13
  Creates a default configuration file if it doesn't exist, or validates
14
14
  an existing one. The default configuration includes common Python project
@@ -29,7 +29,7 @@ is used.
29
29
 
30
30
  Validate Rhiza template configuration.
31
31
 
32
- Validates the `.github/template.yml` file to ensure it is syntactically
32
+ Validates the `.github/rhiza/template.yml` file to ensure it is syntactically
33
33
  correct and semantically valid. Performs comprehensive validation including
34
34
  YAML syntax checking, required field verification, field type validation,
35
35
  and repository format verification.
rhiza/commands/init.py CHANGED
@@ -1,10 +1,11 @@
1
- """Command to initialize or validate .github/template.yml.
1
+ """Command to initialize or validate .github/rhiza/template.yml.
2
2
 
3
3
  This module provides the init command that creates or validates the
4
- .github/template.yml file, which defines where templates come from
4
+ .github/rhiza/template.yml file, which defines where templates come from
5
5
  and what paths are governed by Rhiza.
6
6
  """
7
7
 
8
+ import shutil
8
9
  from pathlib import Path
9
10
 
10
11
  from loguru import logger
@@ -14,9 +15,9 @@ from rhiza.models import RhizaTemplate
14
15
 
15
16
 
16
17
  def init(target: Path):
17
- """Initialize or validate .github/template.yml in the target repository.
18
+ """Initialize or validate .github/rhiza/template.yml in the target repository.
18
19
 
19
- Creates a default .github/template.yml file if it doesn't exist,
20
+ Creates a default .github/rhiza/template.yml file if it doesn't exist,
20
21
  or validates an existing one.
21
22
 
22
23
  Args:
@@ -27,16 +28,24 @@ def init(target: Path):
27
28
 
28
29
  logger.info(f"Initializing Rhiza configuration in: {target}")
29
30
 
30
- # Create .github directory if it doesn't exist
31
+ # Create .github/rhiza directory if it doesn't exist
31
32
  github_dir = target / ".github"
32
- github_dir.mkdir(parents=True, exist_ok=True)
33
+ rhiza_dir = github_dir / "rhiza"
34
+ rhiza_dir.mkdir(parents=True, exist_ok=True)
33
35
 
34
- # Define the template file path
36
+ # check the old location and copy over if existent
37
+ # todo: remove this logic later
35
38
  template_file = github_dir / "template.yml"
39
+ if template_file.exists():
40
+ # move the file into rhiza_dir
41
+ shutil.copyfile(template_file, rhiza_dir / "template.yml")
42
+
43
+ # Define the template file path
44
+ template_file = rhiza_dir / "template.yml"
36
45
 
37
46
  if not template_file.exists():
38
47
  # Create default template.yml
39
- logger.info("Creating default .github/template.yml")
48
+ logger.info("Creating default .github/rhiza/template.yml")
40
49
 
41
50
  default_template = RhizaTemplate(
42
51
  template_repository="jebel-quant/rhiza",
@@ -53,10 +62,10 @@ def init(target: Path):
53
62
 
54
63
  default_template.to_yaml(template_file)
55
64
 
56
- logger.success("✓ Created .github/template.yml")
65
+ logger.success("✓ Created .github/rhiza/template.yml")
57
66
  logger.info("""
58
67
  Next steps:
59
- 1. Review and customize .github/template.yml to match your project needs
68
+ 1. Review and customize .github/rhiza/template.yml to match your project needs
60
69
  2. Run 'rhiza materialize' to inject templates into your repository
61
70
  """)
62
71
 
@@ -103,13 +103,17 @@ def materialize(target: Path, branch: str, target_branch: str | None, force: boo
103
103
  # -----------------------
104
104
  valid = init(target)
105
105
 
106
+ # init will make sure the template_file exists at the new location!
107
+
106
108
  if not valid:
107
109
  logger.error(f"Rhiza template is invalid. {target}")
108
110
  sys.exit(1)
109
111
 
110
- template_file = target / ".github" / "template.yml"
112
+ template_file = target / ".github" / "rhiza" / "template.yml"
111
113
  template = RhizaTemplate.from_yaml(template_file)
112
114
 
115
+ # init will make sure the template_file exists at the new location!
116
+
113
117
  rhiza_repo = template.template_repository
114
118
  rhiza_branch = template.template_branch or branch
115
119
  rhiza_host = template.template_host or "github"
@@ -1,6 +1,6 @@
1
1
  """Command for validating Rhiza template configuration.
2
2
 
3
- This module provides functionality to validate .github/template.yml files
3
+ This module provides functionality to validate .github/rhiza/template.yml files
4
4
  to ensure they are syntactically correct and semantically valid.
5
5
  """
6
6
 
@@ -35,14 +35,23 @@ def validate(target: Path) -> bool:
35
35
 
36
36
  logger.info(f"Validating template configuration in: {target}")
37
37
 
38
- # Check if template.yml exists
39
- template_file = target / ".github" / "template.yml"
40
- if not template_file.exists():
41
- logger.error(f"Template file not found: {template_file}")
38
+ # Check one of the possible template.yml exists
39
+ template_file = [target / ".github" / "rhiza" / "template.yml", target / ".github" / "template.yml"]
40
+
41
+ # Check the exists
42
+ exists = [file.exists() for file in template_file]
43
+
44
+ if not any(exists):
45
+ logger.error(f"No template file found: {template_file}")
42
46
  logger.info("Run 'rhiza init' to create a default template.yml")
43
47
  return False
44
48
 
45
- logger.success(f"Found template file: {template_file}")
49
+ if exists[0]:
50
+ logger.success(f"Template file exists: {template_file[0]}")
51
+ template_file = template_file[0]
52
+ else:
53
+ logger.warning(f"Template file exists but in old location: {template_file[1]}")
54
+ template_file = template_file[1]
46
55
 
47
56
  # Validate YAML syntax
48
57
  try:
rhiza/commands/welcome.py CHANGED
@@ -19,7 +19,7 @@ def welcome():
19
19
  welcome_message = f"""
20
20
  ╭───────────────────────────────────────────────────────────────╮
21
21
  │ │
22
- │ 🌿 Welcome to Rhiza v{__version__:<43} │
22
+ │ 🌿 Welcome to Rhiza v{__version__:<39} │
23
23
  │ │
24
24
  ╰───────────────────────────────────────────────────────────────╯
25
25
 
@@ -38,7 +38,7 @@ Python projects using reusable templates stored in a central repository.
38
38
  1. Initialize a project:
39
39
  $ rhiza init
40
40
 
41
- 2. Customize .github/template.yml to match your needs
41
+ 2. Customize .github/rhiza/template.yml to match your needs
42
42
 
43
43
  3. Materialize templates into your project:
44
44
  $ rhiza materialize
rhiza/models.py CHANGED
@@ -13,7 +13,7 @@ import yaml
13
13
 
14
14
  @dataclass
15
15
  class RhizaTemplate:
16
- """Represents the structure of .github/template.yml.
16
+ """Represents the structure of .github/rhiza/template.yml.
17
17
 
18
18
  Attributes:
19
19
  template_repository: The GitHub or GitLab repository containing templates (e.g., "jebel-quant/rhiza").
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rhiza
3
- Version: 0.5.6
3
+ Version: 0.6.0
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
@@ -81,6 +81,35 @@ For more detailed information, see:
81
81
  pip install rhiza
82
82
  ```
83
83
 
84
+ To update to the latest version:
85
+
86
+ ```bash
87
+ pip install --upgrade rhiza
88
+ ```
89
+
90
+ ### Using uvx (run without installation)
91
+
92
+ [uvx](https://docs.astral.sh/uv/) is part of the `uv` package manager and allows you to run CLI tools directly without installing them:
93
+
94
+ ```bash
95
+ uvx rhiza --help
96
+ ```
97
+
98
+ With uvx, you don't need to install rhiza globally. Each time you run `uvx rhiza`, it will automatically use the latest version available on PyPI. To ensure you're using the latest version, simply run your command - uvx will fetch updates as needed:
99
+
100
+ ```bash
101
+ # Always uses the latest version
102
+ uvx rhiza init
103
+ uvx rhiza materialize
104
+ uvx rhiza validate
105
+ ```
106
+
107
+ If you want to use a specific version:
108
+
109
+ ```bash
110
+ uvx rhiza@0.5.6 --help
111
+ ```
112
+
84
113
  ### From source
85
114
 
86
115
  ```bash
@@ -112,11 +141,11 @@ rhiza --help
112
141
  rhiza init
113
142
  ```
114
143
 
115
- This creates a `.github/template.yml` file with default configuration.
144
+ This creates a `.github/rhiza/template.yml` file with default configuration.
116
145
 
117
146
  2. **Customize the template configuration:**
118
147
 
119
- Edit `.github/template.yml` to specify which files/directories to include from your template repository.
148
+ Edit `.github/rhiza/template.yml` to specify which files/directories to include from your template repository.
120
149
 
121
150
  3. **Materialize templates into your project:**
122
151
 
@@ -132,13 +161,13 @@ rhiza --help
132
161
  rhiza validate
133
162
  ```
134
163
 
135
- This checks that your `.github/template.yml` is correctly formatted and valid.
164
+ This checks that your `.github/rhiza/template.yml` is correctly formatted and valid.
136
165
 
137
166
  ## Commands
138
167
 
139
168
  ### `rhiza init`
140
169
 
141
- Initialize or validate `.github/template.yml` in a target directory.
170
+ Initialize or validate `.github/rhiza/template.yml` in a target directory.
142
171
 
143
172
  **Usage:**
144
173
 
@@ -152,7 +181,7 @@ rhiza init [TARGET]
152
181
 
153
182
  **Description:**
154
183
 
155
- Creates a default `.github/template.yml` file if it doesn't exist, or validates an existing one. The default configuration includes common Python project files like `.github`, `.editorconfig`, `.gitignore`, `.pre-commit-config.yaml`, `Makefile`, and `pytest.ini`.
184
+ Creates a default `.github/rhiza/template.yml` file if it doesn't exist, or validates an existing one. The default configuration includes common Python project files like `.github`, `.editorconfig`, `.gitignore`, `.pre-commit-config.yaml`, `Makefile`, and `pytest.ini`.
156
185
 
157
186
  **Examples:**
158
187
 
@@ -172,18 +201,18 @@ rhiza init ..
172
201
  When creating a new template file:
173
202
  ```
174
203
  [INFO] Initializing Rhiza configuration in: /path/to/project
175
- [INFO] Creating default .github/template.yml
176
- ✓ Created .github/template.yml
204
+ [INFO] Creating default .github/rhiza/template.yml
205
+ ✓ Created .github/rhiza/template.yml
177
206
 
178
207
  Next steps:
179
- 1. Review and customize .github/template.yml to match your project needs
208
+ 1. Review and customize .github/rhiza/template.yml to match your project needs
180
209
  2. Run 'rhiza materialize' to inject templates into your repository
181
210
  ```
182
211
 
183
212
  When validating an existing file:
184
213
  ```
185
214
  [INFO] Validating template configuration in: /path/to/project
186
- ✓ Found template file: /path/to/project/.github/template.yml
215
+ ✓ Found template file: /path/to/project/.github/rhiza/template.yml
187
216
  ✓ YAML syntax is valid
188
217
  ✓ Field 'template-repository' is present and valid
189
218
  ✓ Field 'include' is present and valid
@@ -218,7 +247,7 @@ rhiza materialize [OPTIONS] [TARGET]
218
247
 
219
248
  Materializes template files from the configured template repository into your target project. This command:
220
249
 
221
- 1. Reads the `.github/template.yml` configuration
250
+ 1. Reads the `.github/rhiza/template.yml` configuration
222
251
  2. Performs a sparse clone of the template repository
223
252
  3. Copies specified files/directories to your project
224
253
  4. Respects exclusion patterns defined in the configuration
@@ -300,7 +329,7 @@ rhiza validate [TARGET]
300
329
 
301
330
  **Description:**
302
331
 
303
- Validates the `.github/template.yml` file to ensure it is syntactically correct and semantically valid. This performs authoritative validation including:
332
+ Validates the `.github/rhiza/template.yml` file to ensure it is syntactically correct and semantically valid. This performs authoritative validation including:
304
333
 
305
334
  - Checking if the file exists
306
335
  - Validating YAML syntax
@@ -331,7 +360,7 @@ rhiza validate ..
331
360
 
332
361
  ```
333
362
  [INFO] Validating template configuration in: /path/to/project
334
- ✓ Found template file: /path/to/project/.github/template.yml
363
+ ✓ Found template file: /path/to/project/.github/rhiza/template.yml
335
364
  ✓ YAML syntax is valid
336
365
  ✓ Field 'template-repository' is present and valid
337
366
  ✓ Field 'include' is present and valid
@@ -355,7 +384,7 @@ rhiza validate ..
355
384
  or
356
385
 
357
386
  ```
358
- [ERROR] Template file not found: /path/to/project/.github/template.yml
387
+ [ERROR] Template file not found: /path/to/project/.github/rhiza/template.yml
359
388
  [INFO] Run 'rhiza materialize' or 'rhiza init' to create a default template.yml
360
389
  ```
361
390
 
@@ -363,7 +392,7 @@ or
363
392
 
364
393
  ## Configuration
365
394
 
366
- Rhiza uses a `.github/template.yml` file to define template sources and what to include in your project.
395
+ Rhiza uses a `.github/rhiza/template.yml` file to define template sources and what to include in your project.
367
396
 
368
397
  ### Configuration File Format
369
398
 
@@ -504,7 +533,7 @@ git init
504
533
  rhiza init
505
534
 
506
535
  # Review the generated template.yml
507
- cat .github/template.yml
536
+ cat .github/rhiza/template.yml
508
537
 
509
538
  # Materialize templates
510
539
  rhiza materialize
@@ -539,7 +568,7 @@ git commit -m "chore: update rhiza templates"
539
568
 
540
569
  ### Example 3: Using a custom template repository
541
570
 
542
- Edit `.github/template.yml`:
571
+ Edit `.github/rhiza/template.yml`:
543
572
 
544
573
  ```yaml
545
574
  template-repository: myorg/my-templates
@@ -561,7 +590,7 @@ rhiza materialize --force
561
590
 
562
591
  ### Example 4: Using a GitLab template repository
563
592
 
564
- Edit `.github/template.yml`:
593
+ Edit `.github/rhiza/template.yml`:
565
594
 
566
595
  ```yaml
567
596
  template-repository: mygroup/python-templates
@@ -701,7 +730,7 @@ Releasing and Versioning
701
730
  post-release perform post-release tasks
702
731
 
703
732
  Meta
704
- sync sync with template repository as defined in .github/template.yml
733
+ sync sync with template repository as defined in .github/rhiza/template.yml
705
734
  help Display this help message
706
735
  customisations list available customisation scripts
707
736
  update-readme update README.md with current Makefile help output
@@ -773,7 +802,7 @@ export PATH="$HOME/.local/bin:$PATH"
773
802
  ### Template validation fails
774
803
 
775
804
  Check that:
776
- 1. Your `.github/template.yml` file exists
805
+ 1. Your `.github/rhiza/template.yml` file exists
777
806
  2. The YAML syntax is valid
778
807
  3. Required fields (`template-repository` and `include`) are present
779
808
  4. The repository format is `owner/repo`
@@ -805,11 +834,11 @@ A: Yes, as long as you have Git credentials configured that allow access to the
805
834
 
806
835
  **Q: Does Rhiza support template repositories hosted outside GitHub?**
807
836
 
808
- A: Yes! Rhiza supports both GitHub and GitLab repositories. Use the `template-host` field in your `.github/template.yml` to specify "github" (default) or "gitlab".
837
+ A: Yes! Rhiza supports both GitHub and GitLab repositories. Use the `template-host` field in your `.github/rhiza/template.yml` to specify "github" (default) or "gitlab".
809
838
 
810
839
  **Q: How do I use a GitLab repository as a template source?**
811
840
 
812
- A: Add `template-host: gitlab` to your `.github/template.yml` file. For example:
841
+ A: Add `template-host: gitlab` to your `.github/rhiza/template.yml` file. For example:
813
842
  ```yaml
814
843
  template-repository: mygroup/myproject
815
844
  template-host: gitlab
@@ -824,15 +853,23 @@ A: Not directly. However, you can run `rhiza materialize` multiple times with di
824
853
 
825
854
  **Q: What's the difference between `rhiza init` and `rhiza materialize`?**
826
855
 
827
- A: `init` creates or validates the `.github/template.yml` configuration file. `materialize` reads that configuration and actually copies the template files into your project.
856
+ A: `init` creates or validates the `.github/rhiza/template.yml` configuration file. `materialize` reads that configuration and actually copies the template files into your project.
828
857
 
829
858
  **Q: How do I update my project's templates?**
830
859
 
831
860
  A: Simply run `rhiza materialize --force` to fetch and overwrite with the latest versions from your template repository.
832
861
 
862
+ **Q: How do I update rhiza-cli itself?**
863
+
864
+ A: The update method depends on how you installed rhiza:
865
+
866
+ - **Using pip**: Run `pip install --upgrade rhiza`
867
+ - **Using uvx**: No action needed! `uvx` automatically uses the latest version each time you run it. Just run your command: `uvx rhiza <command>`
868
+ - **From source**: Run `git pull` in the repository directory and then `pip install -e .` again
869
+
833
870
  **Q: Can I customize which files are included?**
834
871
 
835
- A: Yes, edit the `include` and `exclude` lists in `.github/template.yml` to control exactly which files are copied.
872
+ A: Yes, edit the `include` and `exclude` lists in `.github/rhiza/template.yml` to control exactly which files are copied.
836
873
 
837
874
  ## Acknowledgments
838
875
 
@@ -0,0 +1,14 @@
1
+ rhiza/__init__.py,sha256=iW3niLBjwRKxcMhIV_1eb78putjUTo2tbZsadofluJk,1939
2
+ rhiza/__main__.py,sha256=Lx0GqVZo6ymm0f18_uYB6E7_SOWwJNYjb73Vr31oLoM,236
3
+ rhiza/cli.py,sha256=faCIOKDzEDRvL4doLZhiIAyHUUGESGrwWLtjLjimCUY,5111
4
+ rhiza/models.py,sha256=fW9lofkkid-bghk2bXEgBdGbZ4scSqG726fMrVfKX_M,3454
5
+ rhiza/commands/__init__.py,sha256=Z5CeMh7ylX27H6dvwqRbEKzYo5pwQq-5TyTxABUSaQg,1848
6
+ rhiza/commands/init.py,sha256=1JFvT-Y8eYcjqhM7xaaRCBmelKlQNmxaVgyCOeDvydw,2310
7
+ rhiza/commands/materialize.py,sha256=aQcBp8VTBt5DPxyDC2VcgngqTdLDxqbYd5F_B2UF2_A,9534
8
+ rhiza/commands/validate.py,sha256=oYCZnTxr39l20jr6DhBpFtMURv7jULSV8Ii6it8KHxs,5628
9
+ rhiza/commands/welcome.py,sha256=gLgahbfBCBhmZPxWKywx7kYGBTMCVyyVVnly9uKdJv0,2007
10
+ rhiza-0.6.0.dist-info/METADATA,sha256=GrFAnXe3MUq0evyRHFQDE4Yv3mUziu2LKz0wrYFN1fQ,22523
11
+ rhiza-0.6.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
12
+ rhiza-0.6.0.dist-info/entry_points.txt,sha256=NAwZUpbXvfKv50a_Qq-PxMHl3lcjAyZO63IBeuUNgfY,45
13
+ rhiza-0.6.0.dist-info/licenses/LICENSE,sha256=4m5X7LhqX-6D0Ks79Ys8CLpmza8cxDG34g4S9XSNAGY,1077
14
+ rhiza-0.6.0.dist-info/RECORD,,
@@ -1,14 +0,0 @@
1
- rhiza/__init__.py,sha256=1jfkGAONm7dH4KwYjvNEyuxrQ-1m2YncxREYCJnTrHA,1933
2
- rhiza/__main__.py,sha256=Lx0GqVZo6ymm0f18_uYB6E7_SOWwJNYjb73Vr31oLoM,236
3
- rhiza/cli.py,sha256=Jqe285OWOvbvembO5DXTVITfnFefsjVGZCJuK3EKRT8,5081
4
- rhiza/models.py,sha256=R2nu_bf-j-U0kPfQXg6u-MSykrdGO9ixOzZoWy8mLCc,3448
5
- rhiza/commands/__init__.py,sha256=lIkN15MIat-wn9CB1cgUjTzTUQB95LBBAKFK1sGHdCc,1836
6
- rhiza/commands/init.py,sha256=QsOV_VBnRfSPebydH-fMe3haadboNIAYlOpAIYHtgUs,1936
7
- rhiza/commands/materialize.py,sha256=FUStZGUr2oDEC-M8V61JnV3W7USj-VS0EHI10a0Mn6Y,9378
8
- rhiza/commands/validate.py,sha256=_0t9kfylMncm9JmKULn5e7V71XcQdFjlrtuOqZeshPM,5282
9
- rhiza/commands/welcome.py,sha256=GpDbRSIUigaxS7Di9RIpl2jCOFOlhlQT2vNvCzBR-8U,2001
10
- rhiza-0.5.6.dist-info/METADATA,sha256=PI_8F886fva98V4uq_toyZ9O8gC8tnOPy-FPSUn0eE4,21278
11
- rhiza-0.5.6.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
12
- rhiza-0.5.6.dist-info/entry_points.txt,sha256=NAwZUpbXvfKv50a_Qq-PxMHl3lcjAyZO63IBeuUNgfY,45
13
- rhiza-0.5.6.dist-info/licenses/LICENSE,sha256=4m5X7LhqX-6D0Ks79Ys8CLpmza8cxDG34g4S9XSNAGY,1077
14
- rhiza-0.5.6.dist-info/RECORD,,
File without changes