rhiza 0.8.2__tar.gz → 0.8.3__tar.gz

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.
Files changed (87) hide show
  1. {rhiza-0.8.2 → rhiza-0.8.3}/PKG-INFO +1 -1
  2. {rhiza-0.8.2 → rhiza-0.8.3}/pyproject.toml +1 -1
  3. {rhiza-0.8.2 → rhiza-0.8.3}/src/rhiza/cli.py +13 -7
  4. {rhiza-0.8.2 → rhiza-0.8.3}/src/rhiza/commands/init.py +66 -7
  5. {rhiza-0.8.2 → rhiza-0.8.3}/tests/test_commands/test_init.py +58 -0
  6. {rhiza-0.8.2 → rhiza-0.8.3}/uv.lock +1 -1
  7. {rhiza-0.8.2 → rhiza-0.8.3}/.editorconfig +0 -0
  8. {rhiza-0.8.2 → rhiza-0.8.3}/.github/dependabot.yml +0 -0
  9. {rhiza-0.8.2 → rhiza-0.8.3}/.github/rhiza/actions/setup-project/action.yml +0 -0
  10. {rhiza-0.8.2 → rhiza-0.8.3}/.github/workflows/rhiza_book.yml +0 -0
  11. {rhiza-0.8.2 → rhiza-0.8.3}/.github/workflows/rhiza_ci.yml +0 -0
  12. {rhiza-0.8.2 → rhiza-0.8.3}/.github/workflows/rhiza_deptry.yml +0 -0
  13. {rhiza-0.8.2 → rhiza-0.8.3}/.github/workflows/rhiza_devcontainer.yml +0 -0
  14. {rhiza-0.8.2 → rhiza-0.8.3}/.github/workflows/rhiza_docker.yml +0 -0
  15. {rhiza-0.8.2 → rhiza-0.8.3}/.github/workflows/rhiza_marimo.yml +0 -0
  16. {rhiza-0.8.2 → rhiza-0.8.3}/.github/workflows/rhiza_pre-commit.yml +0 -0
  17. {rhiza-0.8.2 → rhiza-0.8.3}/.github/workflows/rhiza_release.yml +0 -0
  18. {rhiza-0.8.2 → rhiza-0.8.3}/.github/workflows/rhiza_sync.yml +0 -0
  19. {rhiza-0.8.2 → rhiza-0.8.3}/.github/workflows/rhiza_validate.yml +0 -0
  20. {rhiza-0.8.2 → rhiza-0.8.3}/.gitignore +0 -0
  21. {rhiza-0.8.2 → rhiza-0.8.3}/.pre-commit-config.yaml +0 -0
  22. {rhiza-0.8.2 → rhiza-0.8.3}/.rhiza/CONFIG.md +0 -0
  23. {rhiza-0.8.2 → rhiza-0.8.3}/.rhiza/TOKEN_SETUP.md +0 -0
  24. {rhiza-0.8.2 → rhiza-0.8.3}/.rhiza/history +0 -0
  25. {rhiza-0.8.2 → rhiza-0.8.3}/.rhiza/scripts/book.sh +0 -0
  26. {rhiza-0.8.2 → rhiza-0.8.3}/.rhiza/scripts/bump.sh +0 -0
  27. {rhiza-0.8.2 → rhiza-0.8.3}/.rhiza/scripts/customisations/build-extras.sh +0 -0
  28. {rhiza-0.8.2 → rhiza-0.8.3}/.rhiza/scripts/customisations/post-release.sh +0 -0
  29. {rhiza-0.8.2 → rhiza-0.8.3}/.rhiza/scripts/marimushka.sh +0 -0
  30. {rhiza-0.8.2 → rhiza-0.8.3}/.rhiza/scripts/release.sh +0 -0
  31. {rhiza-0.8.2 → rhiza-0.8.3}/.rhiza/scripts/update-readme-help.sh +0 -0
  32. {rhiza-0.8.2 → rhiza-0.8.3}/.rhiza/template.yml +0 -0
  33. {rhiza-0.8.2 → rhiza-0.8.3}/.rhiza/utils/version_matrix.py +0 -0
  34. {rhiza-0.8.2 → rhiza-0.8.3}/.rhiza/utils/version_max.py +0 -0
  35. {rhiza-0.8.2 → rhiza-0.8.3}/CLI.md +0 -0
  36. {rhiza-0.8.2 → rhiza-0.8.3}/CODE_OF_CONDUCT.md +0 -0
  37. {rhiza-0.8.2 → rhiza-0.8.3}/CONTRIBUTING.md +0 -0
  38. {rhiza-0.8.2 → rhiza-0.8.3}/GETTING_STARTED.md +0 -0
  39. {rhiza-0.8.2 → rhiza-0.8.3}/LICENSE +0 -0
  40. {rhiza-0.8.2 → rhiza-0.8.3}/Makefile +0 -0
  41. {rhiza-0.8.2 → rhiza-0.8.3}/README.md +0 -0
  42. {rhiza-0.8.2 → rhiza-0.8.3}/USAGE.md +0 -0
  43. {rhiza-0.8.2 → rhiza-0.8.3}/book/Makefile.book +0 -0
  44. {rhiza-0.8.2 → rhiza-0.8.3}/book/marimo/.gitkeep +0 -0
  45. {rhiza-0.8.2 → rhiza-0.8.3}/book/marimo/README.md +0 -0
  46. {rhiza-0.8.2 → rhiza-0.8.3}/book/marimo/rhiza.py +0 -0
  47. {rhiza-0.8.2 → rhiza-0.8.3}/book/minibook-templates/custom.html.jinja2 +0 -0
  48. {rhiza-0.8.2 → rhiza-0.8.3}/book/pdoc-templates/module.html.jinja2 +0 -0
  49. {rhiza-0.8.2 → rhiza-0.8.3}/presentation/Makefile.presentation +0 -0
  50. {rhiza-0.8.2 → rhiza-0.8.3}/presentation/README.md +0 -0
  51. {rhiza-0.8.2 → rhiza-0.8.3}/pytest.ini +0 -0
  52. {rhiza-0.8.2 → rhiza-0.8.3}/renovate.json +0 -0
  53. {rhiza-0.8.2 → rhiza-0.8.3}/ruff.toml +0 -0
  54. {rhiza-0.8.2 → rhiza-0.8.3}/src/rhiza/__init__.py +0 -0
  55. {rhiza-0.8.2 → rhiza-0.8.3}/src/rhiza/__main__.py +0 -0
  56. {rhiza-0.8.2 → rhiza-0.8.3}/src/rhiza/_templates/basic/__init__.py.jinja2 +0 -0
  57. {rhiza-0.8.2 → rhiza-0.8.3}/src/rhiza/_templates/basic/main.py.jinja2 +0 -0
  58. {rhiza-0.8.2 → rhiza-0.8.3}/src/rhiza/_templates/basic/pyproject.toml.jinja2 +0 -0
  59. {rhiza-0.8.2 → rhiza-0.8.3}/src/rhiza/commands/__init__.py +0 -0
  60. {rhiza-0.8.2 → rhiza-0.8.3}/src/rhiza/commands/materialize.py +0 -0
  61. {rhiza-0.8.2 → rhiza-0.8.3}/src/rhiza/commands/migrate.py +0 -0
  62. {rhiza-0.8.2 → rhiza-0.8.3}/src/rhiza/commands/uninstall.py +0 -0
  63. {rhiza-0.8.2 → rhiza-0.8.3}/src/rhiza/commands/validate.py +0 -0
  64. {rhiza-0.8.2 → rhiza-0.8.3}/src/rhiza/commands/welcome.py +0 -0
  65. {rhiza-0.8.2 → rhiza-0.8.3}/src/rhiza/models.py +0 -0
  66. {rhiza-0.8.2 → rhiza-0.8.3}/tests/Makefile.tests +0 -0
  67. {rhiza-0.8.2 → rhiza-0.8.3}/tests/test_cli_commands.py +0 -0
  68. {rhiza-0.8.2 → rhiza-0.8.3}/tests/test_commands/test_materialize.py +0 -0
  69. {rhiza-0.8.2 → rhiza-0.8.3}/tests/test_commands/test_migrate.py +0 -0
  70. {rhiza-0.8.2 → rhiza-0.8.3}/tests/test_commands/test_uninstall.py +0 -0
  71. {rhiza-0.8.2 → rhiza-0.8.3}/tests/test_commands/test_validate.py +0 -0
  72. {rhiza-0.8.2 → rhiza-0.8.3}/tests/test_models.py +0 -0
  73. {rhiza-0.8.2 → rhiza-0.8.3}/tests/test_package.py +0 -0
  74. {rhiza-0.8.2 → rhiza-0.8.3}/tests/test_rhiza/README.md +0 -0
  75. {rhiza-0.8.2 → rhiza-0.8.3}/tests/test_rhiza/benchmarks/.gitignore +0 -0
  76. {rhiza-0.8.2 → rhiza-0.8.3}/tests/test_rhiza/benchmarks/README.md +0 -0
  77. {rhiza-0.8.2 → rhiza-0.8.3}/tests/test_rhiza/benchmarks/analyze_benchmarks.py +0 -0
  78. {rhiza-0.8.2 → rhiza-0.8.3}/tests/test_rhiza/conftest.py +0 -0
  79. {rhiza-0.8.2 → rhiza-0.8.3}/tests/test_rhiza/test_bump_script.py +0 -0
  80. {rhiza-0.8.2 → rhiza-0.8.3}/tests/test_rhiza/test_docstrings.py +0 -0
  81. {rhiza-0.8.2 → rhiza-0.8.3}/tests/test_rhiza/test_git_repo_fixture.py +0 -0
  82. {rhiza-0.8.2 → rhiza-0.8.3}/tests/test_rhiza/test_makefile.py +0 -0
  83. {rhiza-0.8.2 → rhiza-0.8.3}/tests/test_rhiza/test_marimushka_script.py +0 -0
  84. {rhiza-0.8.2 → rhiza-0.8.3}/tests/test_rhiza/test_readme.py +0 -0
  85. {rhiza-0.8.2 → rhiza-0.8.3}/tests/test_rhiza/test_release_script.py +0 -0
  86. {rhiza-0.8.2 → rhiza-0.8.3}/tests/test_rhiza/test_structure.py +0 -0
  87. {rhiza-0.8.2 → rhiza-0.8.3}/tests/test_rhiza/test_updatereadme_script.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rhiza
3
- Version: 0.8.2
3
+ Version: 0.8.3
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,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "rhiza"
7
- version = "0.8.2"
7
+ version = "0.8.3"
8
8
  description = "Reusable configuration templates for modern Python projects"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -87,22 +87,27 @@ def init(
87
87
  "--with-dev-dependencies",
88
88
  help="Include development dependencies in pyproject.toml",
89
89
  ),
90
+ git_host: str = typer.Option(
91
+ None,
92
+ "--git-host",
93
+ help="Target Git hosting platform (github or gitlab). Determines which CI/CD files to include. "
94
+ "If not provided, will prompt interactively.",
95
+ ),
90
96
  ):
91
97
  r"""Initialize or validate .github/rhiza/template.yml.
92
98
 
93
99
  Creates a default `.github/rhiza/template.yml` configuration file if one
94
100
  doesn't exist, or validates the existing configuration.
95
101
 
96
- The default template includes common Python project files:
97
- - .github (workflows, actions, etc.)
98
- - .editorconfig
99
- - .gitignore
100
- - .pre-commit-config.yaml
101
- - Makefile
102
- - pytest.ini
102
+ The default template includes common Python project files.
103
+ The --git-host option determines which CI/CD configuration to include:
104
+ - github: includes .github folder (GitHub Actions workflows)
105
+ - gitlab: includes .gitlab-ci.yml (GitLab CI configuration)
103
106
 
104
107
  Examples:
105
108
  rhiza init
109
+ rhiza init --git-host github
110
+ rhiza init --git-host gitlab
106
111
  rhiza init /path/to/project
107
112
  rhiza init ..
108
113
  """
@@ -111,6 +116,7 @@ def init(
111
116
  project_name=project_name,
112
117
  package_name=package_name,
113
118
  with_dev_dependencies=with_dev_dependencies,
119
+ git_host=git_host,
114
120
  )
115
121
 
116
122
 
@@ -8,8 +8,10 @@ and what paths are governed by Rhiza.
8
8
  import importlib.resources
9
9
  import keyword
10
10
  import re
11
+ import sys
11
12
  from pathlib import Path
12
13
 
14
+ import typer
13
15
  from jinja2 import Template
14
16
  from loguru import logger
15
17
 
@@ -45,6 +47,7 @@ def init(
45
47
  project_name: str | None = None,
46
48
  package_name: str | None = None,
47
49
  with_dev_dependencies: bool = False,
50
+ git_host: str | None = None,
48
51
  ):
49
52
  """Initialize or validate .github/rhiza/template.yml in the target repository.
50
53
 
@@ -56,6 +59,8 @@ def init(
56
59
  project_name: Custom project name. Defaults to target directory name.
57
60
  package_name: Custom package name. Defaults to normalized project name.
58
61
  with_dev_dependencies: Include development dependencies in pyproject.toml.
62
+ git_host: Target Git hosting platform ("github" or "gitlab"). Determines which
63
+ CI/CD configuration files to include. If None, will prompt user interactively.
59
64
 
60
65
  Returns:
61
66
  bool: True if validation passes, False otherwise.
@@ -63,6 +68,13 @@ def init(
63
68
  # Convert to absolute path to avoid surprises
64
69
  target = target.resolve()
65
70
 
71
+ # Validate git_host if provided
72
+ if git_host is not None:
73
+ git_host = git_host.lower()
74
+ if git_host not in ["github", "gitlab"]:
75
+ logger.error(f"Invalid git-host: {git_host}. Must be 'github' or 'gitlab'")
76
+ raise ValueError(f"Invalid git-host: {git_host}. Must be 'github' or 'gitlab'")
77
+
66
78
  logger.info(f"Initializing Rhiza configuration in: {target}")
67
79
 
68
80
  # Create .rhiza directory structure if it doesn't exist
@@ -79,12 +91,50 @@ def init(
79
91
  logger.info("Creating default .rhiza/template.yml")
80
92
  logger.debug("Using default template configuration")
81
93
 
82
- # Default template points to the jebel-quant/rhiza repository
83
- # and includes common Python project configuration files
84
- default_template = RhizaTemplate(
85
- template_repository="jebel-quant/rhiza",
86
- template_branch="main",
87
- include=[
94
+ # Prompt for target git hosting platform if not provided
95
+ if git_host is None:
96
+ # Only prompt if running in an interactive terminal
97
+ if sys.stdin.isatty():
98
+ logger.info("Where will your project be hosted?")
99
+ git_host = typer.prompt(
100
+ "Target Git hosting platform (github/gitlab)",
101
+ type=str,
102
+ default="github",
103
+ ).lower()
104
+
105
+ # Validate the input
106
+ while git_host not in ["github", "gitlab"]:
107
+ logger.warning(f"Invalid choice: {git_host}. Please choose 'github' or 'gitlab'")
108
+ git_host = typer.prompt(
109
+ "Target Git hosting platform (github/gitlab)",
110
+ type=str,
111
+ default="github",
112
+ ).lower()
113
+ else:
114
+ # Non-interactive mode (e.g., tests), default to github
115
+ git_host = "github"
116
+ logger.debug("Non-interactive mode detected, defaulting to github")
117
+
118
+ # Adjust template based on target git hosting platform
119
+ # The template repository is always on GitHub (jebel-quant/rhiza)
120
+ # but we include different files based on where the target project will be
121
+ if git_host == "gitlab":
122
+ include_paths = [
123
+ ".rhiza", # .rhiza folder
124
+ ".gitlab", # .gitlab folder
125
+ ".gitlab-ci.yml", # GitLab CI configuration
126
+ ".editorconfig", # Editor configuration
127
+ ".gitignore", # Git ignore patterns
128
+ ".pre-commit-config.yaml", # Pre-commit hooks
129
+ "ruff.toml", # Ruff linter configuration
130
+ "Makefile", # Build and development tasks
131
+ "pytest.ini", # Pytest configuration
132
+ "book", # Documentation book
133
+ "presentation", # Presentation materials
134
+ "tests", # Test structure
135
+ ]
136
+ else:
137
+ include_paths = [
88
138
  ".rhiza", # .rhiza folder
89
139
  ".github", # GitHub configuration and workflows
90
140
  ".editorconfig", # Editor configuration
@@ -96,7 +146,16 @@ def init(
96
146
  "book", # Documentation book
97
147
  "presentation", # Presentation materials
98
148
  "tests", # Test structure
99
- ],
149
+ ]
150
+
151
+ # Default template points to the jebel-quant/rhiza repository on GitHub
152
+ # and includes files appropriate for the target platform
153
+ default_template = RhizaTemplate(
154
+ template_repository="jebel-quant/rhiza",
155
+ template_branch="main",
156
+ # template_host is not set here - it defaults to "github" in the model
157
+ # because the template repository is on GitHub
158
+ include=include_paths,
100
159
  )
101
160
 
102
161
  # Write the default template to the file
@@ -6,6 +6,7 @@ that the Typer CLI entry `rhiza init` works as expected.
6
6
 
7
7
  from pathlib import Path
8
8
 
9
+ import pytest
9
10
  import yaml
10
11
  from typer.testing import CliRunner
11
12
 
@@ -232,3 +233,60 @@ class TestInitCommand:
232
233
  pyproject_file = tmp_path / "pyproject.toml"
233
234
  content = pyproject_file.read_text()
234
235
  assert 'packages = ["src/class_"]' in content
236
+
237
+ def test_init_with_github_explicit(self, tmp_path):
238
+ """Test init with explicitly specified GitHub target platform."""
239
+ init(tmp_path, git_host="github")
240
+
241
+ # Verify template.yml was created
242
+ template_file = tmp_path / ".rhiza" / "template.yml"
243
+ assert template_file.exists()
244
+
245
+ with open(template_file) as f:
246
+ config = yaml.safe_load(f)
247
+
248
+ # template-host should not appear (defaults to github for template repo)
249
+ assert "template-host" not in config
250
+ # Should include .github for GitHub target
251
+ assert ".github" in config["include"]
252
+ assert ".gitlab-ci.yml" not in config["include"]
253
+
254
+ def test_init_with_gitlab_explicit(self, tmp_path):
255
+ """Test init with explicitly specified GitLab target platform."""
256
+ init(tmp_path, git_host="gitlab")
257
+
258
+ # Verify template.yml was created
259
+ template_file = tmp_path / ".rhiza" / "template.yml"
260
+ assert template_file.exists()
261
+
262
+ with open(template_file) as f:
263
+ config = yaml.safe_load(f)
264
+
265
+ # template-host should not appear because template repo is still on GitHub
266
+ # We only change the include list based on target platform
267
+ assert "template-host" not in config
268
+ # Should include .gitlab-ci.yml for GitLab target
269
+ assert ".gitlab-ci.yml" in config["include"]
270
+ # Should NOT include .github for GitLab target
271
+ assert ".github" not in config["include"]
272
+
273
+ def test_init_with_invalid_git_host(self, tmp_path):
274
+ """Test init with invalid git-host raises error."""
275
+ with pytest.raises(ValueError, match="Invalid git-host"):
276
+ init(tmp_path, git_host="bitbucket")
277
+
278
+ def test_init_with_git_host_case_insensitive(self, tmp_path):
279
+ """Test init with git-host is case insensitive."""
280
+ init(tmp_path, git_host="GitLab")
281
+
282
+ # Verify template.yml was created
283
+ template_file = tmp_path / ".rhiza" / "template.yml"
284
+ assert template_file.exists()
285
+
286
+ with open(template_file) as f:
287
+ config = yaml.safe_load(f)
288
+
289
+ # Should include .gitlab-ci.yml for GitLab target
290
+ assert ".gitlab-ci.yml" in config["include"]
291
+ # Should NOT include .github for GitLab target
292
+ assert ".github" not in config["include"]
@@ -771,7 +771,7 @@ wheels = [
771
771
 
772
772
  [[package]]
773
773
  name = "rhiza"
774
- version = "0.8.2"
774
+ version = "0.8.3"
775
775
  source = { editable = "." }
776
776
  dependencies = [
777
777
  { name = "jinja2" },
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes