rhiza 0.5.1__tar.gz → 0.5.2__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.
- {rhiza-0.5.1 → rhiza-0.5.2}/.github/workflows/sync.yml +0 -3
- rhiza-0.5.2/.rhiza.history +45 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/PKG-INFO +1 -1
- {rhiza-0.5.1 → rhiza-0.5.2}/pyproject.toml +1 -1
- {rhiza-0.5.1 → rhiza-0.5.2}/src/rhiza/commands/materialize.py +80 -58
- {rhiza-0.5.1 → rhiza-0.5.2}/uv.lock +1 -1
- {rhiza-0.5.1 → rhiza-0.5.2}/.editorconfig +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/.github/README.md +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/.github/TOKEN_SETUP.md +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/.github/actions/setup-project/action.yml +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/.github/copilot-instructions.md +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/.github/renovate.json +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/.github/scripts/book.sh +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/.github/scripts/bump.sh +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/.github/scripts/customisations/build-extras.sh +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/.github/scripts/customisations/post-release.sh +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/.github/scripts/marimushka.sh +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/.github/scripts/release.sh +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/.github/scripts/update-readme-help.sh +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/.github/template.yml +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/.github/workflows/book.yml +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/.github/workflows/ci.yml +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/.github/workflows/deptry.yml +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/.github/workflows/marimo.yml +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/.github/workflows/pre-commit.yml +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/.github/workflows/release.yml +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/.github/workflows/scripts/version_matrix.py +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/.github/workflows/scripts/version_max.py +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/.github/workflows/structure.yml +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/.gitignore +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/.pre-commit-config.yaml +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/CLI.md +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/CODE_OF_CONDUCT.md +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/CONTRIBUTING.md +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/LICENSE +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/Makefile +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/README.md +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/USAGE.md +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/book/marimo/.gitkeep +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/pytest.ini +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/ruff.toml +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/src/rhiza/__init__.py +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/src/rhiza/__main__.py +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/src/rhiza/cli.py +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/src/rhiza/commands/__init__.py +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/src/rhiza/commands/init.py +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/src/rhiza/commands/validate.py +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/src/rhiza/models.py +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/tests/test_cli_commands.py +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/tests/test_commands/test_init.py +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/tests/test_commands/test_materialize.py +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/tests/test_commands/test_validate.py +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/tests/test_models.py +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/tests/test_rhiza/README.md +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/tests/test_rhiza/conftest.py +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/tests/test_rhiza/test_bump_script.py +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/tests/test_rhiza/test_docstrings.py +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/tests/test_rhiza/test_git_repo_fixture.py +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/tests/test_rhiza/test_makefile.py +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/tests/test_rhiza/test_marimushka_script.py +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/tests/test_rhiza/test_readme.py +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/tests/test_rhiza/test_release_script.py +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/tests/test_rhiza/test_structure.py +0 -0
- {rhiza-0.5.1 → rhiza-0.5.2}/tests/test_rhiza/test_updatereadme_script.py +0 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Rhiza Template History
|
|
2
|
+
# This file lists all files managed by the Rhiza template.
|
|
3
|
+
# Template repository: jebel-quant/rhiza
|
|
4
|
+
# Template branch: main
|
|
5
|
+
#
|
|
6
|
+
# Files under template control:
|
|
7
|
+
.editorconfig
|
|
8
|
+
.github/README.md
|
|
9
|
+
.github/TOKEN_SETUP.md
|
|
10
|
+
.github/actions/setup-project/action.yml
|
|
11
|
+
.github/renovate.json
|
|
12
|
+
.github/scripts/book.sh
|
|
13
|
+
.github/scripts/bump.sh
|
|
14
|
+
.github/scripts/customisations/build-extras.sh
|
|
15
|
+
.github/scripts/customisations/post-release.sh
|
|
16
|
+
.github/scripts/marimushka.sh
|
|
17
|
+
.github/scripts/release.sh
|
|
18
|
+
.github/scripts/update-readme-help.sh
|
|
19
|
+
.github/workflows/book.yml
|
|
20
|
+
.github/workflows/ci.yml
|
|
21
|
+
.github/workflows/deptry.yml
|
|
22
|
+
.github/workflows/marimo.yml
|
|
23
|
+
.github/workflows/pre-commit.yml
|
|
24
|
+
.github/workflows/release.yml
|
|
25
|
+
.github/workflows/scripts/version_matrix.py
|
|
26
|
+
.github/workflows/scripts/version_max.py
|
|
27
|
+
.github/workflows/sync.yml
|
|
28
|
+
.gitignore
|
|
29
|
+
.pre-commit-config.yaml
|
|
30
|
+
CODE_OF_CONDUCT.md
|
|
31
|
+
CONTRIBUTING.md
|
|
32
|
+
Makefile
|
|
33
|
+
pytest.ini
|
|
34
|
+
ruff.toml
|
|
35
|
+
tests/test_rhiza/README.md
|
|
36
|
+
tests/test_rhiza/conftest.py
|
|
37
|
+
tests/test_rhiza/test_bump_script.py
|
|
38
|
+
tests/test_rhiza/test_docstrings.py
|
|
39
|
+
tests/test_rhiza/test_git_repo_fixture.py
|
|
40
|
+
tests/test_rhiza/test_makefile.py
|
|
41
|
+
tests/test_rhiza/test_marimushka_script.py
|
|
42
|
+
tests/test_rhiza/test_readme.py
|
|
43
|
+
tests/test_rhiza/test_release_script.py
|
|
44
|
+
tests/test_rhiza/test_structure.py
|
|
45
|
+
tests/test_rhiza/test_updatereadme_script.py
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rhiza
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.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
|
|
@@ -1,20 +1,11 @@
|
|
|
1
|
-
"""Command-line helpers for working with Rhiza templates.
|
|
2
|
-
|
|
3
|
-
This module currently exposes a thin wrapper that shells out to the
|
|
4
|
-
`tools/inject_rhiza.sh` script. It exists so the functionality can be
|
|
5
|
-
invoked via a Python entry point while delegating the heavy lifting to
|
|
6
|
-
the maintained shell script.
|
|
7
|
-
"""
|
|
8
|
-
|
|
9
1
|
import shutil
|
|
10
2
|
import subprocess
|
|
11
|
-
import sys
|
|
12
3
|
import tempfile
|
|
13
4
|
from pathlib import Path
|
|
14
5
|
|
|
15
6
|
from loguru import logger
|
|
16
7
|
|
|
17
|
-
from rhiza.commands
|
|
8
|
+
from rhiza.commands import init
|
|
18
9
|
from rhiza.models import RhizaTemplate
|
|
19
10
|
|
|
20
11
|
|
|
@@ -37,46 +28,44 @@ def expand_paths(base_dir: Path, paths: list[str]) -> list[Path]:
|
|
|
37
28
|
return all_files
|
|
38
29
|
|
|
39
30
|
|
|
40
|
-
def materialize(target: Path, branch: str, force: bool):
|
|
41
|
-
"""Materialize
|
|
42
|
-
|
|
31
|
+
def materialize(target: Path, branch: str, force: bool) -> None:
|
|
32
|
+
"""Materialize Rhiza templates into the target repository.
|
|
33
|
+
|
|
34
|
+
This performs a sparse checkout of the template repository and copies
|
|
35
|
+
the selected files into the target repository, recording all files
|
|
36
|
+
under template control in `.rhiza.history`.
|
|
37
|
+
"""
|
|
43
38
|
target = target.resolve()
|
|
44
39
|
|
|
45
40
|
logger.info(f"Target repository: {target}")
|
|
46
41
|
logger.info(f"Rhiza branch: {branch}")
|
|
47
42
|
|
|
48
43
|
# -----------------------
|
|
49
|
-
# Ensure
|
|
44
|
+
# Ensure Rhiza is initialized
|
|
50
45
|
# -----------------------
|
|
51
|
-
template_file = target / ".github" / "template.yml"
|
|
52
|
-
# template_file.parent.mkdir(parents=True, exist_ok=True)
|
|
53
|
-
|
|
54
|
-
# Initialize rhiza if not already initialized, e.g. construct a template.yml file
|
|
55
46
|
init(target)
|
|
56
47
|
|
|
57
|
-
|
|
58
|
-
# Load template.yml
|
|
59
|
-
# -----------------------
|
|
48
|
+
template_file = target / ".github" / "template.yml"
|
|
60
49
|
template = RhizaTemplate.from_yaml(template_file)
|
|
61
50
|
|
|
62
51
|
rhiza_repo = template.template_repository
|
|
63
|
-
|
|
64
|
-
rhiza_branch = template.template_branch if template.template_branch else branch
|
|
52
|
+
rhiza_branch = template.template_branch or branch
|
|
65
53
|
include_paths = template.include
|
|
66
54
|
excluded_paths = template.exclude
|
|
67
55
|
|
|
68
56
|
if not include_paths:
|
|
69
|
-
|
|
70
|
-
raise sys.exit(1)
|
|
57
|
+
raise RuntimeError("No include paths found in template.yml")
|
|
71
58
|
|
|
72
59
|
logger.info("Include paths:")
|
|
73
60
|
for p in include_paths:
|
|
74
61
|
logger.info(f" - {p}")
|
|
75
62
|
|
|
76
63
|
# -----------------------
|
|
77
|
-
# Sparse clone
|
|
64
|
+
# Sparse clone template repo
|
|
78
65
|
# -----------------------
|
|
79
66
|
tmp_dir = Path(tempfile.mkdtemp())
|
|
67
|
+
materialized_files: list[Path] = []
|
|
68
|
+
|
|
80
69
|
logger.info(f"Cloning {rhiza_repo}@{rhiza_branch} into temporary directory")
|
|
81
70
|
|
|
82
71
|
try:
|
|
@@ -84,12 +73,10 @@ def materialize(target: Path, branch: str, force: bool):
|
|
|
84
73
|
[
|
|
85
74
|
"git",
|
|
86
75
|
"clone",
|
|
87
|
-
"--depth",
|
|
88
|
-
"1",
|
|
76
|
+
"--depth", "1",
|
|
89
77
|
"--filter=blob:none",
|
|
90
78
|
"--sparse",
|
|
91
|
-
"--branch",
|
|
92
|
-
rhiza_branch,
|
|
79
|
+
"--branch", rhiza_branch,
|
|
93
80
|
f"https://github.com/{rhiza_repo}.git",
|
|
94
81
|
str(tmp_dir),
|
|
95
82
|
],
|
|
@@ -97,30 +84,46 @@ def materialize(target: Path, branch: str, force: bool):
|
|
|
97
84
|
stdout=subprocess.DEVNULL,
|
|
98
85
|
)
|
|
99
86
|
|
|
100
|
-
subprocess.run(
|
|
101
|
-
|
|
87
|
+
subprocess.run(
|
|
88
|
+
["git", "sparse-checkout", "init", "--cone"],
|
|
89
|
+
cwd=tmp_dir,
|
|
90
|
+
check=True,
|
|
91
|
+
)
|
|
102
92
|
|
|
103
|
-
|
|
93
|
+
subprocess.run(
|
|
94
|
+
["git", "sparse-checkout", "set", "--skip-checks", *include_paths],
|
|
95
|
+
cwd=tmp_dir,
|
|
96
|
+
check=True,
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
# -----------------------
|
|
100
|
+
# Expand include/exclude paths
|
|
101
|
+
# -----------------------
|
|
104
102
|
all_files = expand_paths(tmp_dir, include_paths)
|
|
105
103
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
104
|
+
excluded_files = {
|
|
105
|
+
f.resolve()
|
|
106
|
+
for f in expand_paths(tmp_dir, excluded_paths)
|
|
107
|
+
}
|
|
109
108
|
|
|
110
|
-
files_to_copy = [
|
|
111
|
-
|
|
109
|
+
files_to_copy = [
|
|
110
|
+
f for f in all_files
|
|
111
|
+
if f.resolve() not in excluded_files
|
|
112
|
+
]
|
|
112
113
|
|
|
113
|
-
#
|
|
114
|
-
|
|
114
|
+
# -----------------------
|
|
115
|
+
# Copy files into target repo
|
|
116
|
+
# -----------------------
|
|
115
117
|
for src_file in files_to_copy:
|
|
116
118
|
dst_file = target / src_file.relative_to(tmp_dir)
|
|
117
119
|
relative_path = dst_file.relative_to(target)
|
|
118
120
|
|
|
119
|
-
# Track this file as being under template control
|
|
120
121
|
materialized_files.append(relative_path)
|
|
121
122
|
|
|
122
123
|
if dst_file.exists() and not force:
|
|
123
|
-
logger.warning(
|
|
124
|
+
logger.warning(
|
|
125
|
+
f"{relative_path} already exists — use --force to overwrite"
|
|
126
|
+
)
|
|
124
127
|
continue
|
|
125
128
|
|
|
126
129
|
dst_file.parent.mkdir(parents=True, exist_ok=True)
|
|
@@ -130,9 +133,25 @@ def materialize(target: Path, branch: str, force: bool):
|
|
|
130
133
|
finally:
|
|
131
134
|
shutil.rmtree(tmp_dir)
|
|
132
135
|
|
|
133
|
-
#
|
|
136
|
+
# -----------------------
|
|
137
|
+
# Warn about workflow files
|
|
138
|
+
# -----------------------
|
|
139
|
+
workflow_files = [
|
|
140
|
+
p for p in materialized_files
|
|
141
|
+
if p.parts[:2] == (".github", "workflows")
|
|
142
|
+
]
|
|
143
|
+
|
|
144
|
+
if workflow_files:
|
|
145
|
+
logger.warning(
|
|
146
|
+
"Workflow files were materialized. Updating these files requires "
|
|
147
|
+
"a token with the 'workflow' permission in GitHub Actions."
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
# -----------------------
|
|
151
|
+
# Write .rhiza.history
|
|
152
|
+
# -----------------------
|
|
134
153
|
history_file = target / ".rhiza.history"
|
|
135
|
-
with open(
|
|
154
|
+
with history_file.open("w", encoding="utf-8") as f:
|
|
136
155
|
f.write("# Rhiza Template History\n")
|
|
137
156
|
f.write("# This file lists all files managed by the Rhiza template.\n")
|
|
138
157
|
f.write(f"# Template repository: {rhiza_repo}\n")
|
|
@@ -141,19 +160,22 @@ def materialize(target: Path, branch: str, force: bool):
|
|
|
141
160
|
f.write("# Files under template control:\n")
|
|
142
161
|
for file_path in sorted(materialized_files):
|
|
143
162
|
f.write(f"{file_path}\n")
|
|
144
|
-
|
|
163
|
+
|
|
164
|
+
logger.info(
|
|
165
|
+
f"Created {history_file.relative_to(target)} "
|
|
166
|
+
f"with {len(materialized_files)} files"
|
|
167
|
+
)
|
|
145
168
|
|
|
146
169
|
logger.success("Rhiza templates materialized successfully")
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
git
|
|
152
|
-
|
|
153
|
-
2. Commit
|
|
154
|
-
git add
|
|
155
|
-
git commit -m "chore: import rhiza templates"
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
""")
|
|
170
|
+
|
|
171
|
+
logger.info(
|
|
172
|
+
"Next steps:\n"
|
|
173
|
+
" 1. Review changes:\n"
|
|
174
|
+
" git status\n"
|
|
175
|
+
" git diff\n\n"
|
|
176
|
+
" 2. Commit:\n"
|
|
177
|
+
" git add .\n"
|
|
178
|
+
' git commit -m "chore: import rhiza templates"\n\n'
|
|
179
|
+
"This is a one-shot snapshot.\n"
|
|
180
|
+
"Re-run this command to update templates explicitly."
|
|
181
|
+
)
|
|
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
|
|
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
|