rhiza 0.5.4__tar.gz → 0.5.5__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.4 → rhiza-0.5.5}/PKG-INFO +1 -1
- {rhiza-0.5.4 → rhiza-0.5.5}/pyproject.toml +1 -1
- {rhiza-0.5.4 → rhiza-0.5.5}/src/rhiza/commands/materialize.py +65 -43
- {rhiza-0.5.4 → rhiza-0.5.5}/tests/test_cli_commands.py +0 -62
- {rhiza-0.5.4 → rhiza-0.5.5}/uv.lock +1 -1
- {rhiza-0.5.4 → rhiza-0.5.5}/.editorconfig +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/.github/README.md +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/.github/TOKEN_SETUP.md +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/.github/actions/setup-project/action.yml +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/.github/copilot-instructions.md +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/.github/renovate.json +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/.github/scripts/book.sh +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/.github/scripts/bump.sh +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/.github/scripts/customisations/build-extras.sh +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/.github/scripts/customisations/post-release.sh +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/.github/scripts/marimushka.sh +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/.github/scripts/release.sh +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/.github/scripts/update-readme-help.sh +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/.github/template.yml +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/.github/workflows/book.yml +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/.github/workflows/ci.yml +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/.github/workflows/deptry.yml +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/.github/workflows/marimo.yml +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/.github/workflows/pre-commit.yml +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/.github/workflows/release.yml +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/.github/workflows/scripts/version_matrix.py +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/.github/workflows/scripts/version_max.py +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/.github/workflows/structure.yml +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/.github/workflows/sym2.yml +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/.github/workflows/sync.yml +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/.gitignore +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/.pre-commit-config.yaml +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/.rhiza.history +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/CLI.md +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/CODE_OF_CONDUCT.md +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/CONTRIBUTING.md +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/LICENSE +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/Makefile +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/README.md +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/USAGE.md +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/book/marimo/.gitkeep +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/pytest.ini +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/ruff.toml +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/src/rhiza/__init__.py +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/src/rhiza/__main__.py +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/src/rhiza/cli.py +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/src/rhiza/commands/__init__.py +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/src/rhiza/commands/init.py +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/src/rhiza/commands/validate.py +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/src/rhiza/models.py +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/tests/test_commands/test_init.py +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/tests/test_commands/test_materialize.py +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/tests/test_commands/test_validate.py +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/tests/test_models.py +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/tests/test_package.py +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/tests/test_rhiza/README.md +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/tests/test_rhiza/conftest.py +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/tests/test_rhiza/test_bump_script.py +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/tests/test_rhiza/test_docstrings.py +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/tests/test_rhiza/test_git_repo_fixture.py +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/tests/test_rhiza/test_makefile.py +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/tests/test_rhiza/test_marimushka_script.py +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/tests/test_rhiza/test_readme.py +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/tests/test_rhiza/test_release_script.py +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/tests/test_rhiza/test_structure.py +0 -0
- {rhiza-0.5.4 → rhiza-0.5.5}/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.5.
|
|
3
|
+
Version: 0.5.5
|
|
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
|
|
@@ -18,7 +18,7 @@ from rhiza.commands import init
|
|
|
18
18
|
from rhiza.models import RhizaTemplate
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
def
|
|
21
|
+
def __expand_paths(base_dir: Path, paths: list[str]) -> list[Path]:
|
|
22
22
|
"""Expand files/directories relative to base_dir into a flat list of files.
|
|
23
23
|
|
|
24
24
|
Given a list of paths relative to ``base_dir``, return a flat list of all
|
|
@@ -40,20 +40,16 @@ def expand_paths(base_dir: Path, paths: list[str]) -> list[Path]:
|
|
|
40
40
|
def materialize(target: Path, branch: str, target_branch: str | None, force: bool) -> None:
|
|
41
41
|
"""Materialize Rhiza templates into the target repository.
|
|
42
42
|
|
|
43
|
-
This performs a sparse checkout of the template repository and copies
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
target_branch:
|
|
54
|
-
Optional branch name to create/checkout in target repository.
|
|
55
|
-
force:
|
|
56
|
-
Whether to overwrite existing files.
|
|
43
|
+
This performs a sparse checkout of the template repository and copies the
|
|
44
|
+
selected files into the target repository, recording all files under
|
|
45
|
+
template control in `.rhiza.history`.
|
|
46
|
+
|
|
47
|
+
Args:
|
|
48
|
+
target (Path): Path to the target repository.
|
|
49
|
+
branch (str): The Rhiza template branch to use.
|
|
50
|
+
target_branch (str | None): Optional branch name to create/checkout in
|
|
51
|
+
the target repository.
|
|
52
|
+
force (bool): Whether to overwrite existing files.
|
|
57
53
|
"""
|
|
58
54
|
target = target.resolve()
|
|
59
55
|
|
|
@@ -138,41 +134,67 @@ def materialize(target: Path, branch: str, target_branch: str | None, force: boo
|
|
|
138
134
|
logger.info(f"Cloning {rhiza_repo}@{rhiza_branch} from {rhiza_host} into temporary directory")
|
|
139
135
|
|
|
140
136
|
try:
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
137
|
+
# Clone the repository - capture output to avoid blocking
|
|
138
|
+
try:
|
|
139
|
+
subprocess.run(
|
|
140
|
+
[
|
|
141
|
+
"git",
|
|
142
|
+
"clone",
|
|
143
|
+
"--depth",
|
|
144
|
+
"1",
|
|
145
|
+
"--filter=blob:none",
|
|
146
|
+
"--sparse",
|
|
147
|
+
"--branch",
|
|
148
|
+
rhiza_branch,
|
|
149
|
+
git_url,
|
|
150
|
+
str(tmp_dir),
|
|
151
|
+
],
|
|
152
|
+
check=True,
|
|
153
|
+
capture_output=True,
|
|
154
|
+
text=True,
|
|
155
|
+
)
|
|
156
|
+
except subprocess.CalledProcessError as e:
|
|
157
|
+
logger.error(f"Failed to clone repository: {e}")
|
|
158
|
+
if e.stderr:
|
|
159
|
+
logger.error(f"Git error: {e.stderr.strip()}")
|
|
160
|
+
raise
|
|
157
161
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
162
|
+
# Initialize sparse checkout
|
|
163
|
+
try:
|
|
164
|
+
subprocess.run(
|
|
165
|
+
["git", "sparse-checkout", "init", "--cone"],
|
|
166
|
+
cwd=tmp_dir,
|
|
167
|
+
check=True,
|
|
168
|
+
capture_output=True,
|
|
169
|
+
text=True,
|
|
170
|
+
)
|
|
171
|
+
except subprocess.CalledProcessError as e:
|
|
172
|
+
logger.error(f"Failed to initialize sparse checkout: {e}")
|
|
173
|
+
if e.stderr:
|
|
174
|
+
logger.error(f"Git error: {e.stderr.strip()}")
|
|
175
|
+
raise
|
|
163
176
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
177
|
+
# Set sparse checkout paths
|
|
178
|
+
try:
|
|
179
|
+
subprocess.run(
|
|
180
|
+
["git", "sparse-checkout", "set", "--skip-checks", *include_paths],
|
|
181
|
+
cwd=tmp_dir,
|
|
182
|
+
check=True,
|
|
183
|
+
capture_output=True,
|
|
184
|
+
text=True,
|
|
185
|
+
)
|
|
186
|
+
except subprocess.CalledProcessError as e:
|
|
187
|
+
logger.error(f"Failed to set sparse checkout paths: {e}")
|
|
188
|
+
if e.stderr:
|
|
189
|
+
logger.error(f"Git error: {e.stderr.strip()}")
|
|
190
|
+
raise
|
|
169
191
|
|
|
170
192
|
# -----------------------
|
|
171
193
|
# Expand include/exclude paths
|
|
172
194
|
# -----------------------
|
|
173
|
-
all_files =
|
|
195
|
+
all_files = __expand_paths(tmp_dir, include_paths)
|
|
174
196
|
|
|
175
|
-
excluded_files = {f.resolve() for f in
|
|
197
|
+
excluded_files = {f.resolve() for f in __expand_paths(tmp_dir, excluded_paths)}
|
|
176
198
|
|
|
177
199
|
files_to_copy = [f for f in all_files if f.resolve() not in excluded_files]
|
|
178
200
|
|
|
@@ -14,7 +14,6 @@ import typer
|
|
|
14
14
|
|
|
15
15
|
from rhiza import __version__
|
|
16
16
|
from rhiza.cli import version_callback
|
|
17
|
-
from rhiza.commands.materialize import expand_paths
|
|
18
17
|
|
|
19
18
|
|
|
20
19
|
class TestCliApp:
|
|
@@ -59,67 +58,6 @@ class TestCliApp:
|
|
|
59
58
|
version_callback(False) # Should not raise
|
|
60
59
|
|
|
61
60
|
|
|
62
|
-
class TestExpandPaths:
|
|
63
|
-
"""Tests for the expand_paths utility function."""
|
|
64
|
-
|
|
65
|
-
def test_expand_single_file(self, tmp_path):
|
|
66
|
-
"""Test expanding a single file path."""
|
|
67
|
-
test_file = tmp_path / "test.txt"
|
|
68
|
-
test_file.write_text("content")
|
|
69
|
-
|
|
70
|
-
result = expand_paths(tmp_path, ["test.txt"])
|
|
71
|
-
assert result == [test_file]
|
|
72
|
-
|
|
73
|
-
def test_expand_directory(self, tmp_path):
|
|
74
|
-
"""Test expanding a directory into all its files."""
|
|
75
|
-
test_dir = tmp_path / "dir"
|
|
76
|
-
test_dir.mkdir()
|
|
77
|
-
file1 = test_dir / "file1.txt"
|
|
78
|
-
file2 = test_dir / "file2.txt"
|
|
79
|
-
file1.write_text("content1")
|
|
80
|
-
file2.write_text("content2")
|
|
81
|
-
|
|
82
|
-
result = expand_paths(tmp_path, ["dir"])
|
|
83
|
-
assert len(result) == 2
|
|
84
|
-
assert file1 in result
|
|
85
|
-
assert file2 in result
|
|
86
|
-
|
|
87
|
-
def test_expand_nested_directory(self, tmp_path):
|
|
88
|
-
"""Test expanding a directory with nested subdirectories."""
|
|
89
|
-
test_dir = tmp_path / "dir"
|
|
90
|
-
sub_dir = test_dir / "subdir"
|
|
91
|
-
sub_dir.mkdir(parents=True)
|
|
92
|
-
file1 = test_dir / "file1.txt"
|
|
93
|
-
file2 = sub_dir / "file2.txt"
|
|
94
|
-
file1.write_text("content1")
|
|
95
|
-
file2.write_text("content2")
|
|
96
|
-
|
|
97
|
-
result = expand_paths(tmp_path, ["dir"])
|
|
98
|
-
assert len(result) == 2
|
|
99
|
-
assert file1 in result
|
|
100
|
-
assert file2 in result
|
|
101
|
-
|
|
102
|
-
def test_expand_nonexistent_path(self, tmp_path):
|
|
103
|
-
"""Test that nonexistent paths are skipped."""
|
|
104
|
-
result = expand_paths(tmp_path, ["nonexistent.txt"])
|
|
105
|
-
assert result == []
|
|
106
|
-
|
|
107
|
-
def test_expand_mixed_paths(self, tmp_path):
|
|
108
|
-
"""Test expanding a mix of files and directories."""
|
|
109
|
-
file1 = tmp_path / "file1.txt"
|
|
110
|
-
file1.write_text("content1")
|
|
111
|
-
|
|
112
|
-
test_dir = tmp_path / "dir"
|
|
113
|
-
test_dir.mkdir()
|
|
114
|
-
file2 = test_dir / "file2.txt"
|
|
115
|
-
file2.write_text("content2")
|
|
116
|
-
|
|
117
|
-
result = expand_paths(tmp_path, ["file1.txt", "dir"])
|
|
118
|
-
assert len(result) == 2
|
|
119
|
-
assert file1 in result
|
|
120
|
-
assert file2 in result
|
|
121
|
-
|
|
122
|
-
|
|
123
61
|
class TestMainEntry:
|
|
124
62
|
"""Tests for the __main__.py entry point."""
|
|
125
63
|
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|