rhiza 0.6.0__tar.gz → 0.6.1__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.6.0 → rhiza-0.6.1}/.github/dependabot.yml +14 -14
- rhiza-0.6.1/.github/workflows/rhiza.yml +26 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/.rhiza.history +3 -3
- rhiza-0.6.1/GETTING_STARTED.md +492 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/Makefile +22 -8
- {rhiza-0.6.0 → rhiza-0.6.1}/PKG-INFO +4 -1
- {rhiza-0.6.0 → rhiza-0.6.1}/README.md +3 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/book/Makefile.book +3 -3
- {rhiza-0.6.0 → rhiza-0.6.1}/presentation/Makefile.presentation +3 -3
- rhiza-0.6.1/presentation/README.md +325 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/pyproject.toml +1 -1
- rhiza-0.6.1/src/rhiza/commands/init.py +154 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/src/rhiza/commands/materialize.py +93 -13
- {rhiza-0.6.0 → rhiza-0.6.1}/src/rhiza/commands/validate.py +56 -18
- {rhiza-0.6.0 → rhiza-0.6.1}/src/rhiza/commands/welcome.py +7 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/tests/Makefile.tests +3 -2
- {rhiza-0.6.0 → rhiza-0.6.1}/tests/test_rhiza/test_makefile.py +16 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/uv.lock +1 -1
- rhiza-0.6.0/src/rhiza/commands/init.py +0 -73
- {rhiza-0.6.0 → rhiza-0.6.1}/.editorconfig +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/.github/actions/setup-project/action.yml +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/.github/renovate.json +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/.github/rhiza/CONFIG.md +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/.github/rhiza/TOKEN_SETUP.md +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/.github/rhiza/copilot-instructions.md +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/.github/rhiza/template.yml +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/.github/scripts/book.sh +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/.github/scripts/bump.sh +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/.github/scripts/customisations/build-extras.sh +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/.github/scripts/customisations/post-release.sh +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/.github/scripts/marimushka.sh +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/.github/scripts/release.sh +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/.github/scripts/update-readme-help.sh +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/.github/workflows/book.yml +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/.github/workflows/ci.yml +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/.github/workflows/deptry.yml +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/.github/workflows/marimo.yml +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/.github/workflows/pre-commit.yml +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/.github/workflows/release.yml +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/.github/workflows/scripts/version_matrix.py +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/.github/workflows/scripts/version_max.py +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/.github/workflows/security.yml +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/.github/workflows/structure.yml +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/.github/workflows/sync.yml +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/.gitignore +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/.pre-commit-config.yaml +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/CLI.md +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/CODE_OF_CONDUCT.md +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/CONTRIBUTING.md +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/LICENSE +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/USAGE.md +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/book/marimo/.gitkeep +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/book/minibook-templates/custom.html.jinja2 +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/book/pdoc-templates/module.html.jinja2 +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/pytest.ini +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/ruff.toml +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/src/rhiza/__init__.py +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/src/rhiza/__main__.py +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/src/rhiza/cli.py +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/src/rhiza/commands/__init__.py +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/src/rhiza/models.py +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/tests/test_cli_commands.py +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/tests/test_commands/test_init.py +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/tests/test_commands/test_materialize.py +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/tests/test_commands/test_validate.py +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/tests/test_models.py +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/tests/test_package.py +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/tests/test_rhiza/README.md +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/tests/test_rhiza/benchmarks/.gitignore +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/tests/test_rhiza/benchmarks/README.md +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/tests/test_rhiza/benchmarks/analyze_benchmarks.py +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/tests/test_rhiza/conftest.py +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/tests/test_rhiza/test_bump_script.py +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/tests/test_rhiza/test_docstrings.py +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/tests/test_rhiza/test_git_repo_fixture.py +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/tests/test_rhiza/test_marimushka_script.py +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/tests/test_rhiza/test_readme.py +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/tests/test_rhiza/test_release_script.py +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/tests/test_rhiza/test_structure.py +0 -0
- {rhiza-0.6.0 → rhiza-0.6.1}/tests/test_rhiza/test_updatereadme_script.py +0 -0
|
@@ -43,17 +43,17 @@ updates:
|
|
|
43
43
|
include: "scope"
|
|
44
44
|
|
|
45
45
|
# Docker
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
46
|
+
#- package-ecosystem: "docker"
|
|
47
|
+
# directory: "/docker"
|
|
48
|
+
# schedule:
|
|
49
|
+
# interval: "weekly"
|
|
50
|
+
# day: "tuesday"
|
|
51
|
+
# time: "09:00"
|
|
52
|
+
# timezone: "Asia/Dubai"
|
|
53
|
+
# open-pull-requests-limit: 10
|
|
54
|
+
# labels:
|
|
55
|
+
# - "dependencies"
|
|
56
|
+
# - "docker"
|
|
57
|
+
# commit-message:
|
|
58
|
+
# prefix: "chore(deps)"
|
|
59
|
+
# include: "scope"
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: RHIZA VALIDATE
|
|
2
|
+
|
|
3
|
+
permissions:
|
|
4
|
+
contents: read
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
pull_request:
|
|
9
|
+
branches: [ main, master ]
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
validation:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
# don't run this in rhiza itself. Rhiza has no template.yml file.
|
|
15
|
+
if: ${{ github.repository != 'jebel-quant/rhiza' }}
|
|
16
|
+
container:
|
|
17
|
+
image: ghcr.io/astral-sh/uv:0.9.18-python3.12-trixie
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- name: Checkout repository
|
|
21
|
+
uses: actions/checkout@v6
|
|
22
|
+
|
|
23
|
+
- name: Validate Rhiza config
|
|
24
|
+
shell: bash
|
|
25
|
+
run: |
|
|
26
|
+
uvx rhiza validate .
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
#
|
|
6
6
|
# Files under template control:
|
|
7
7
|
.editorconfig
|
|
8
|
-
.github/CONFIG.md
|
|
9
|
-
.github/TOKEN_SETUP.md
|
|
10
8
|
.github/actions/setup-project/action.yml
|
|
11
9
|
.github/dependabot.yml
|
|
12
10
|
.github/renovate.json
|
|
11
|
+
.github/rhiza/CONFIG.md
|
|
12
|
+
.github/rhiza/TOKEN_SETUP.md
|
|
13
13
|
.github/scripts/book.sh
|
|
14
14
|
.github/scripts/bump.sh
|
|
15
15
|
.github/scripts/customisations/build-extras.sh
|
|
@@ -37,13 +37,13 @@ book/Makefile.book
|
|
|
37
37
|
book/minibook-templates/custom.html.jinja2
|
|
38
38
|
book/pdoc-templates/module.html.jinja2
|
|
39
39
|
presentation/Makefile.presentation
|
|
40
|
+
presentation/README.md
|
|
40
41
|
pytest.ini
|
|
41
42
|
ruff.toml
|
|
42
43
|
tests/Makefile.tests
|
|
43
44
|
tests/test_rhiza/README.md
|
|
44
45
|
tests/test_rhiza/benchmarks/.gitignore
|
|
45
46
|
tests/test_rhiza/benchmarks/README.md
|
|
46
|
-
tests/test_rhiza/benchmarks/__init__.py
|
|
47
47
|
tests/test_rhiza/benchmarks/analyze_benchmarks.py
|
|
48
48
|
tests/test_rhiza/conftest.py
|
|
49
49
|
tests/test_rhiza/test_bump_script.py
|
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
# Getting Started with Rhiza
|
|
2
|
+
|
|
3
|
+
Welcome! This guide will help you get started with Rhiza, a CLI tool for managing reusable configuration templates for Python projects.
|
|
4
|
+
|
|
5
|
+
## What is Rhiza?
|
|
6
|
+
|
|
7
|
+
Rhiza helps you maintain consistent configuration across multiple Python projects by using templates stored in a central repository. Instead of manually copying configuration files between projects, Rhiza automates the process and keeps your projects synchronized.
|
|
8
|
+
|
|
9
|
+
**Works for both new and existing projects!** Whether you're starting fresh or want to add template management to an existing codebase, Rhiza has you covered.
|
|
10
|
+
|
|
11
|
+
## Prerequisites
|
|
12
|
+
|
|
13
|
+
Before you begin, make sure you have:
|
|
14
|
+
|
|
15
|
+
- **Python 3.11 or higher** installed
|
|
16
|
+
- **Git** installed and configured
|
|
17
|
+
- A **terminal** or command prompt
|
|
18
|
+
- **An existing git repository** (or you'll create one in this guide)
|
|
19
|
+
|
|
20
|
+
You can verify your Python version:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
python --version
|
|
24
|
+
# or
|
|
25
|
+
python3 --version
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
### Option 1: Using uvx (Recommended - No installation required!)
|
|
31
|
+
|
|
32
|
+
The easiest way to use Rhiza is with `uvx`, which runs CLI tools without installing them. First, install `uv`:
|
|
33
|
+
|
|
34
|
+
**On macOS and Linux:**
|
|
35
|
+
```bash
|
|
36
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**On Windows:**
|
|
40
|
+
```powershell
|
|
41
|
+
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**Security Note:** The commands above download and execute installation scripts from [astral.sh](https://astral.sh/uv/). You can review the installation scripts before running them, or visit the [official uv documentation](https://docs.astral.sh/uv/) for alternative installation methods.
|
|
45
|
+
|
|
46
|
+
Now you can run Rhiza directly:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
uvx rhiza --help
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
With `uvx`, you always get the latest version automatically - no need to update!
|
|
53
|
+
|
|
54
|
+
### Option 2: Using pip (For regular use)
|
|
55
|
+
|
|
56
|
+
If you prefer to install Rhiza globally:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pip install rhiza
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Verify the installation:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
rhiza --help
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Option 3: From source (For development)
|
|
69
|
+
|
|
70
|
+
Clone and install from the repository:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
git clone https://github.com/jebel-quant/rhiza-cli.git
|
|
74
|
+
cd rhiza-cli
|
|
75
|
+
make install
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Your First Rhiza Project
|
|
79
|
+
|
|
80
|
+
Let's create a new Python project with Rhiza templates in just 4 simple steps:
|
|
81
|
+
|
|
82
|
+
### Step 1: Create a Project Directory
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
mkdir my-python-project
|
|
86
|
+
cd my-python-project
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Step 2: Initialize Git
|
|
90
|
+
|
|
91
|
+
Rhiza requires a git repository to work:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
git init
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Step 3: Initialize Rhiza
|
|
98
|
+
|
|
99
|
+
Create your complete Python project structure with one command:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
uvx rhiza init
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**💡 What does `uvx rhiza init` do?**
|
|
106
|
+
|
|
107
|
+
When you run `uvx rhiza init`, it sets up your entire Python project automatically:
|
|
108
|
+
|
|
109
|
+
1. **uvx downloads and caches Rhiza** - The first time you run this, `uvx` downloads the latest version of Rhiza from PyPI and caches it. Subsequent runs are instant!
|
|
110
|
+
|
|
111
|
+
2. **Creates the Rhiza configuration** - A `.github/rhiza/` directory is created with a `template.yml` file that defines which template files to fetch from the `jebel-quant/rhiza` template repository.
|
|
112
|
+
|
|
113
|
+
3. **Creates your Python package structure** - Automatically creates a `src/<project-name>/` directory with:
|
|
114
|
+
- `__init__.py` - Makes it a Python package
|
|
115
|
+
- `main.py` - A starter Python file with a simple "Hello, World!" example
|
|
116
|
+
|
|
117
|
+
4. **Creates `pyproject.toml`** - Generates a modern Python project configuration file with:
|
|
118
|
+
- Project name (based on your directory name)
|
|
119
|
+
- Version set to "0.1.0"
|
|
120
|
+
- Python version requirement (>=3.11)
|
|
121
|
+
- Empty dependencies list (ready for you to add)
|
|
122
|
+
|
|
123
|
+
5. **Creates `README.md`** - An empty README file for your project documentation
|
|
124
|
+
|
|
125
|
+
You should see:
|
|
126
|
+
```
|
|
127
|
+
[INFO] Initializing Rhiza configuration in: /path/to/my-python-project
|
|
128
|
+
[INFO] Creating default .github/rhiza/template.yml
|
|
129
|
+
✓ Created .github/rhiza/template.yml
|
|
130
|
+
|
|
131
|
+
Next steps:
|
|
132
|
+
1. Review and customize .github/rhiza/template.yml to match your project needs
|
|
133
|
+
2. Run 'rhiza materialize' to inject templates into your repository
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**What gets created:**
|
|
137
|
+
```
|
|
138
|
+
my-python-project/
|
|
139
|
+
├── .github/
|
|
140
|
+
│ └── rhiza/
|
|
141
|
+
│ └── template.yml
|
|
142
|
+
├── src/
|
|
143
|
+
│ └── my-python-project/
|
|
144
|
+
│ ├── __init__.py
|
|
145
|
+
│ └── main.py
|
|
146
|
+
├── pyproject.toml
|
|
147
|
+
└── README.md
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**Note:** If you installed Rhiza with pip, you can use `rhiza init` instead of `uvx rhiza init`.
|
|
151
|
+
|
|
152
|
+
### Step 4: Review the Configuration
|
|
153
|
+
|
|
154
|
+
Take a look at what was created:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
cat .github/rhiza/template.yml
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
You'll see something like:
|
|
161
|
+
|
|
162
|
+
```yaml
|
|
163
|
+
template-repository: jebel-quant/rhiza
|
|
164
|
+
template-branch: main
|
|
165
|
+
include:
|
|
166
|
+
- .github
|
|
167
|
+
- .editorconfig
|
|
168
|
+
- .gitignore
|
|
169
|
+
- .pre-commit-config.yaml
|
|
170
|
+
- Makefile
|
|
171
|
+
- pytest.ini
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
This configuration will fetch common Python project files from the template repository.
|
|
175
|
+
|
|
176
|
+
You can also check the generated Python files:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# View the project metadata
|
|
180
|
+
cat pyproject.toml
|
|
181
|
+
|
|
182
|
+
# Check the starter Python code
|
|
183
|
+
cat src/my-python-project/main.py
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Step 5: Materialize Templates
|
|
187
|
+
|
|
188
|
+
Apply the templates to your project:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
uvx rhiza materialize
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**💡 What does `uvx rhiza materialize` do?**
|
|
195
|
+
|
|
196
|
+
When you run this command, Rhiza performs several actions:
|
|
197
|
+
|
|
198
|
+
1. **Reads your configuration** - Rhiza reads `.github/rhiza/template.yml` to understand what templates you want
|
|
199
|
+
|
|
200
|
+
2. **Performs a sparse clone** - Instead of downloading the entire template repository, Rhiza uses git's sparse checkout to fetch only the files you specified in the `include` list. This is fast and efficient!
|
|
201
|
+
|
|
202
|
+
3. **Copies files to your project** - The specified files are copied from the template repository to your project, maintaining their directory structure
|
|
203
|
+
|
|
204
|
+
4. **Creates `.rhiza.history`** - A tracking file is created that lists all files under Rhiza's control, along with metadata about the template repository and branch used
|
|
205
|
+
|
|
206
|
+
5. **Respects existing files** - By default, Rhiza won't overwrite existing files (including your `pyproject.toml` and source code) unless you use the `--force` flag
|
|
207
|
+
|
|
208
|
+
You'll see output like:
|
|
209
|
+
```
|
|
210
|
+
[INFO] Target repository: /path/to/my-python-project
|
|
211
|
+
[INFO] Rhiza branch: main
|
|
212
|
+
[INFO] Include paths:
|
|
213
|
+
- .github
|
|
214
|
+
- .editorconfig
|
|
215
|
+
- .gitignore
|
|
216
|
+
- .pre-commit-config.yaml
|
|
217
|
+
- Makefile
|
|
218
|
+
- pytest.ini
|
|
219
|
+
[INFO] Cloning jebel-quant/rhiza@main into temporary directory
|
|
220
|
+
[ADD] .github/workflows/ci.yml
|
|
221
|
+
[ADD] .editorconfig
|
|
222
|
+
[ADD] .gitignore
|
|
223
|
+
[ADD] Makefile
|
|
224
|
+
✓ Rhiza templates materialized successfully
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
**Important:** Your project files (`pyproject.toml`, source code in `src/`) are preserved! Rhiza doesn't overwrite them unless you explicitly include them in your template configuration and use the `--force` flag.
|
|
228
|
+
|
|
229
|
+
Review what was added:
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
git status
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Commit the changes:
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
git add .
|
|
239
|
+
git commit -m "chore: initialize project with rhiza templates"
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
**Congratulations!** 🎉 You've successfully set up your first Rhiza project with a complete Python package structure!
|
|
243
|
+
|
|
244
|
+
## Understanding What Just Happened
|
|
245
|
+
|
|
246
|
+
Let's break down what Rhiza did across the two commands:
|
|
247
|
+
|
|
248
|
+
### From `uvx rhiza init`:
|
|
249
|
+
|
|
250
|
+
1. **Created your Python package structure**:
|
|
251
|
+
- `src/<project-name>/` - Following the modern "src layout" pattern
|
|
252
|
+
- `__init__.py` - Makes your directory a Python package
|
|
253
|
+
- `main.py` - A starter file with a simple example function
|
|
254
|
+
|
|
255
|
+
2. **Created `pyproject.toml`**: Your project's metadata and configuration file with:
|
|
256
|
+
- Project name (based on directory)
|
|
257
|
+
- Version (0.1.0)
|
|
258
|
+
- Python requirement (>=3.11)
|
|
259
|
+
- Empty dependencies list
|
|
260
|
+
|
|
261
|
+
3. **Created `README.md`**: An empty file ready for your documentation
|
|
262
|
+
|
|
263
|
+
4. **Created `.github/rhiza/template.yml`**: Configuration defining which template files to fetch
|
|
264
|
+
|
|
265
|
+
### From `uvx rhiza materialize`:
|
|
266
|
+
|
|
267
|
+
1. **Materialized templates**: Rhiza copied configuration and tooling files from the template repository:
|
|
268
|
+
- `.github/` - GitHub workflows and configurations
|
|
269
|
+
- `.editorconfig` - Editor configuration
|
|
270
|
+
- `.gitignore` - Git ignore rules
|
|
271
|
+
- `.pre-commit-config.yaml` - Pre-commit hooks
|
|
272
|
+
- `Makefile` - Build and development commands
|
|
273
|
+
- `pytest.ini` - Test configuration
|
|
274
|
+
|
|
275
|
+
2. **Created `.rhiza.history`**: Tracks all files under Rhiza's control
|
|
276
|
+
|
|
277
|
+
3. **Preserved your code**: Your `pyproject.toml` and `src/` directory remain untouched since they're not in the template's `include` list
|
|
278
|
+
|
|
279
|
+
## Common Use Cases
|
|
280
|
+
|
|
281
|
+
### Use Case 1: Add Rhiza to an Existing Project
|
|
282
|
+
|
|
283
|
+
Already have a project? No problem! Rhiza works perfectly with existing projects:
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
cd existing-project
|
|
287
|
+
|
|
288
|
+
# Initialize Rhiza (creates missing files only, won't overwrite existing)
|
|
289
|
+
uvx rhiza init
|
|
290
|
+
|
|
291
|
+
# If you didn't have a pyproject.toml, Rhiza created one!
|
|
292
|
+
# If you didn't have a src/ directory, Rhiza created it!
|
|
293
|
+
# Check what was created:
|
|
294
|
+
ls -la
|
|
295
|
+
|
|
296
|
+
# Review and edit .github/rhiza/template.yml if needed
|
|
297
|
+
cat .github/rhiza/template.yml
|
|
298
|
+
|
|
299
|
+
# Materialize templates (won't overwrite existing files by default)
|
|
300
|
+
uvx rhiza materialize
|
|
301
|
+
|
|
302
|
+
# Review what was added
|
|
303
|
+
git status
|
|
304
|
+
git diff
|
|
305
|
+
|
|
306
|
+
# Commit if satisfied
|
|
307
|
+
git add .
|
|
308
|
+
git commit -m "chore: add rhiza template management"
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
**Important for existing projects:**
|
|
312
|
+
- `uvx rhiza init` is **safe** - it only creates files that don't exist
|
|
313
|
+
- If you already have `pyproject.toml`, `src/`, or `README.md`, they're left untouched
|
|
314
|
+
- If you're missing these files, Rhiza helpfully creates them with sensible defaults
|
|
315
|
+
- `uvx rhiza materialize` won't overwrite existing files unless you use `--force`
|
|
316
|
+
|
|
317
|
+
### Use Case 2: Update Templates Periodically
|
|
318
|
+
|
|
319
|
+
Keep your templates up to date:
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
uvx rhiza materialize --force
|
|
323
|
+
git diff # Review what changed
|
|
324
|
+
git add .
|
|
325
|
+
git commit -m "chore: update rhiza templates"
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
The `--force` flag overwrites existing files with the latest versions from the template repository.
|
|
329
|
+
|
|
330
|
+
### Use Case 3: Validate Configuration
|
|
331
|
+
|
|
332
|
+
Check if your configuration is valid:
|
|
333
|
+
|
|
334
|
+
```bash
|
|
335
|
+
uvx rhiza validate
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
This is useful before committing changes or in CI/CD pipelines.
|
|
339
|
+
|
|
340
|
+
## Customizing Your Templates
|
|
341
|
+
|
|
342
|
+
### Using a Different Template Repository
|
|
343
|
+
|
|
344
|
+
Edit `.github/rhiza/template.yml` to use your organization's templates:
|
|
345
|
+
|
|
346
|
+
```yaml
|
|
347
|
+
template-repository: myorg/python-templates
|
|
348
|
+
template-branch: main
|
|
349
|
+
include:
|
|
350
|
+
- .github/workflows
|
|
351
|
+
- Makefile
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
Then materialize:
|
|
355
|
+
|
|
356
|
+
```bash
|
|
357
|
+
uvx rhiza materialize --force
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
### Using GitLab Repositories
|
|
361
|
+
|
|
362
|
+
Rhiza supports GitLab too! Just add `template-host: gitlab`:
|
|
363
|
+
|
|
364
|
+
```yaml
|
|
365
|
+
template-repository: mygroup/python-templates
|
|
366
|
+
template-host: gitlab
|
|
367
|
+
template-branch: main
|
|
368
|
+
include:
|
|
369
|
+
- .gitlab-ci.yml
|
|
370
|
+
- .editorconfig
|
|
371
|
+
- Makefile
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### Excluding Specific Files
|
|
375
|
+
|
|
376
|
+
Include a directory but exclude certain files:
|
|
377
|
+
|
|
378
|
+
```yaml
|
|
379
|
+
template-repository: jebel-quant/rhiza
|
|
380
|
+
include:
|
|
381
|
+
- .github
|
|
382
|
+
exclude:
|
|
383
|
+
- .github/CODEOWNERS
|
|
384
|
+
- .github/workflows/deploy.yml
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
## Next Steps
|
|
388
|
+
|
|
389
|
+
Now that you have the basics, here's what to explore next:
|
|
390
|
+
|
|
391
|
+
### 📚 Dive Deeper into Rhiza
|
|
392
|
+
|
|
393
|
+
- **[CLI Quick Reference](CLI.md)** - Command syntax and options
|
|
394
|
+
- **[Usage Guide](USAGE.md)** - Advanced workflows and best practices
|
|
395
|
+
- **[README](README.md)** - Complete documentation
|
|
396
|
+
|
|
397
|
+
### 🔧 Customize Your Setup
|
|
398
|
+
|
|
399
|
+
- Edit `.github/rhiza/template.yml` to include only the files you need
|
|
400
|
+
- Create your own template repository for your organization
|
|
401
|
+
- Set up automated template updates in CI/CD
|
|
402
|
+
|
|
403
|
+
### 🤝 Get Involved
|
|
404
|
+
|
|
405
|
+
- **[Contributing Guidelines](CONTRIBUTING.md)** - Learn how to contribute
|
|
406
|
+
- **[GitHub Issues](https://github.com/jebel-quant/rhiza-cli/issues)** - Report bugs or request features
|
|
407
|
+
- **[Code of Conduct](CODE_OF_CONDUCT.md)** - Community guidelines
|
|
408
|
+
|
|
409
|
+
## Quick Command Reference
|
|
410
|
+
|
|
411
|
+
Here are the essential commands you'll use regularly:
|
|
412
|
+
|
|
413
|
+
| Command | Description |
|
|
414
|
+
|---------|-------------|
|
|
415
|
+
| `uvx rhiza init` | Create or validate `.github/rhiza/template.yml` |
|
|
416
|
+
| `uvx rhiza materialize` | Copy template files to your project |
|
|
417
|
+
| `uvx rhiza materialize --force` | Update templates, overwriting existing files |
|
|
418
|
+
| `uvx rhiza validate` | Check if configuration is valid |
|
|
419
|
+
| `uvx rhiza --help` | Show all available commands and options |
|
|
420
|
+
|
|
421
|
+
**Note:** If you installed Rhiza with `pip install rhiza`, you can use `rhiza` instead of `uvx rhiza`.
|
|
422
|
+
|
|
423
|
+
## Troubleshooting
|
|
424
|
+
|
|
425
|
+
### "Command not found: rhiza"
|
|
426
|
+
|
|
427
|
+
The easiest solution is to use `uvx` which doesn't require installation:
|
|
428
|
+
|
|
429
|
+
```bash
|
|
430
|
+
uvx rhiza --help
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
Or install Rhiza with pip and ensure it's in your PATH:
|
|
434
|
+
|
|
435
|
+
```bash
|
|
436
|
+
pip install --user rhiza
|
|
437
|
+
export PATH="$HOME/.local/bin:$PATH"
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
**Note:** The `export` command above is temporary and only affects your current shell session. To make it permanent, add it to your shell profile:
|
|
441
|
+
|
|
442
|
+
```bash
|
|
443
|
+
# For bash
|
|
444
|
+
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
|
|
445
|
+
|
|
446
|
+
# For zsh
|
|
447
|
+
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
Then restart your terminal or run `source ~/.bashrc` (or `source ~/.zshrc`).
|
|
451
|
+
|
|
452
|
+
### "Target directory is not a git repository"
|
|
453
|
+
|
|
454
|
+
Initialize git first:
|
|
455
|
+
|
|
456
|
+
```bash
|
|
457
|
+
git init
|
|
458
|
+
uvx rhiza init
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
### Need More Help?
|
|
462
|
+
|
|
463
|
+
1. Run `uvx rhiza --help` or `uvx rhiza <command> --help` for command-specific help
|
|
464
|
+
2. Check the [Usage Guide](USAGE.md) for detailed examples
|
|
465
|
+
3. Search [existing issues](https://github.com/jebel-quant/rhiza-cli/issues)
|
|
466
|
+
4. Open a new issue with details about your problem
|
|
467
|
+
|
|
468
|
+
## Summary
|
|
469
|
+
|
|
470
|
+
You've learned how to:
|
|
471
|
+
|
|
472
|
+
- ✅ Install `uv`/`uvx` for running Rhiza without installation
|
|
473
|
+
- ✅ Initialize a complete Python project with `uvx rhiza init` (creates `pyproject.toml`, `src/` structure, `README.md`)
|
|
474
|
+
- ✅ Understand what `uvx rhiza init` and `uvx rhiza materialize` do under the hood
|
|
475
|
+
- ✅ Materialize templates with `uvx rhiza materialize`
|
|
476
|
+
- ✅ Validate configuration with `uvx rhiza validate`
|
|
477
|
+
- ✅ Customize template configurations
|
|
478
|
+
- ✅ Work with both new and existing projects safely
|
|
479
|
+
|
|
480
|
+
**Key Takeaway:** Rhiza's powerful `init` command sets up
|
|
481
|
+
your entire Python project structure (package layout, pyproject.toml, README)
|
|
482
|
+
while also configuring template management. It then helps you maintain
|
|
483
|
+
consistent tooling and configuration files (like `.github/`, Makefile, linting configs) across all your projects.
|
|
484
|
+
|
|
485
|
+
Rhiza’s killer feature? **Scheduled materializations**.
|
|
486
|
+
Set it, forget it, and your repo automatically updates itself from .github/rhiza/template.yml.
|
|
487
|
+
When your template is always changing, this keeps everything perfectly
|
|
488
|
+
in sync—like a self-updating repo on autopilot. We discuss details in [USAGE](USAGE.md)
|
|
489
|
+
|
|
490
|
+
Rhiza makes it easy to bootstrap and maintain consistent Python projects. Start using it today!
|
|
491
|
+
|
|
492
|
+
**Happy coding!** 🚀
|
|
@@ -16,13 +16,22 @@ RESET := \033[0m
|
|
|
16
16
|
# Default goal when running `make` with no target
|
|
17
17
|
.DEFAULT_GOAL := help
|
|
18
18
|
|
|
19
|
-
# Include split Makefiles
|
|
20
|
-
-include tests/Makefile.tests
|
|
21
|
-
-include book/Makefile.book
|
|
22
|
-
-include presentation/Makefile.presentation
|
|
23
|
-
|
|
24
19
|
# Declare phony targets (they don't produce files)
|
|
25
|
-
.PHONY:
|
|
20
|
+
.PHONY: \
|
|
21
|
+
install-uv \
|
|
22
|
+
install \
|
|
23
|
+
install-extras \
|
|
24
|
+
clean \
|
|
25
|
+
marimo \
|
|
26
|
+
fmt \
|
|
27
|
+
deptry \
|
|
28
|
+
bump \
|
|
29
|
+
release \
|
|
30
|
+
release-dry-run \
|
|
31
|
+
post-release \
|
|
32
|
+
sync \
|
|
33
|
+
help \
|
|
34
|
+
update-readme
|
|
26
35
|
|
|
27
36
|
UV_INSTALL_DIR ?= ./bin
|
|
28
37
|
UV_BIN := ${UV_INSTALL_DIR}/uv
|
|
@@ -35,6 +44,11 @@ CUSTOM_SCRIPTS_FOLDER := .github/scripts/customisations
|
|
|
35
44
|
export UV_NO_MODIFY_PATH := 1
|
|
36
45
|
export UV_VENV_CLEAR := 1
|
|
37
46
|
|
|
47
|
+
# Include split Makefiles
|
|
48
|
+
-include tests/Makefile.tests
|
|
49
|
+
-include book/Makefile.book
|
|
50
|
+
-include presentation/Makefile.presentation
|
|
51
|
+
|
|
38
52
|
##@ Bootstrap
|
|
39
53
|
install-uv: ## ensure uv/uvx is installed
|
|
40
54
|
# Ensure the ${UV_INSTALL_DIR} folder exists
|
|
@@ -83,6 +97,8 @@ install: install-uv install-extras ## install
|
|
|
83
97
|
printf "${YELLOW}[WARN] No pyproject.toml found, skipping install${RESET}\n"; \
|
|
84
98
|
fi
|
|
85
99
|
|
|
100
|
+
sync: install-uv ## sync with template repository as defined in .github/rhiza/template.yml
|
|
101
|
+
@${UVX_BIN} rhiza materialize --force .
|
|
86
102
|
|
|
87
103
|
clean: ## clean
|
|
88
104
|
@printf "${BLUE}Cleaning project...${RESET}\n"
|
|
@@ -134,8 +150,6 @@ post-release: install-uv ## perform post-release tasks
|
|
|
134
150
|
fi
|
|
135
151
|
|
|
136
152
|
##@ Meta
|
|
137
|
-
sync: install-uv ## sync with template repository as defined in .github/rhiza/template.yml
|
|
138
|
-
@${UVX_BIN} rhiza materialize --force .
|
|
139
153
|
|
|
140
154
|
help: ## Display this help message
|
|
141
155
|
+@printf "$(BOLD)Usage:$(RESET)\n"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rhiza
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.1
|
|
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
|
|
@@ -41,6 +41,8 @@ Description-Content-Type: text/markdown
|
|
|
41
41
|
|
|
42
42
|
Command-line interface for managing reusable configuration templates for modern Python projects.
|
|
43
43
|
|
|
44
|
+
**📖 New to Rhiza? Check out the [Getting Started Guide](GETTING_STARTED.md) for a beginner-friendly introduction!**
|
|
45
|
+
|
|
44
46
|
## Overview
|
|
45
47
|
|
|
46
48
|
Rhiza is a CLI tool that helps you maintain consistent configuration across multiple Python projects by using templates stored in a central repository. It allows you to:
|
|
@@ -68,6 +70,7 @@ Rhiza is a CLI tool that helps you maintain consistent configuration across mult
|
|
|
68
70
|
|
|
69
71
|
For more detailed information, see:
|
|
70
72
|
|
|
73
|
+
- **[Getting Started Guide](GETTING_STARTED.md)** - Beginner-friendly introduction and walkthrough
|
|
71
74
|
- **[CLI Quick Reference](CLI.md)** - Command syntax and quick examples
|
|
72
75
|
- **[Usage Guide](USAGE.md)** - Practical tutorials and workflows
|
|
73
76
|
- **[Contributing Guidelines](CONTRIBUTING.md)** - How to contribute to the project
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
Command-line interface for managing reusable configuration templates for modern Python projects.
|
|
10
10
|
|
|
11
|
+
**📖 New to Rhiza? Check out the [Getting Started Guide](GETTING_STARTED.md) for a beginner-friendly introduction!**
|
|
12
|
+
|
|
11
13
|
## Overview
|
|
12
14
|
|
|
13
15
|
Rhiza is a CLI tool that helps you maintain consistent configuration across multiple Python projects by using templates stored in a central repository. It allows you to:
|
|
@@ -35,6 +37,7 @@ Rhiza is a CLI tool that helps you maintain consistent configuration across mult
|
|
|
35
37
|
|
|
36
38
|
For more detailed information, see:
|
|
37
39
|
|
|
40
|
+
- **[Getting Started Guide](GETTING_STARTED.md)** - Beginner-friendly introduction and walkthrough
|
|
38
41
|
- **[CLI Quick Reference](CLI.md)** - Command syntax and quick examples
|
|
39
42
|
- **[Usage Guide](USAGE.md)** - Practical tutorials and workflows
|
|
40
43
|
- **[Contributing Guidelines](CONTRIBUTING.md)** - How to contribute to the project
|