half-orm-dev 0.17.3a3__tar.gz → 0.17.3a5__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.
- half_orm_dev-0.17.3a5/PKG-INFO +553 -0
- half_orm_dev-0.17.3a5/README.md +522 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/cli/commands/init.py +1 -1
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/cli/commands/patch.py +9 -9
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/cli/commands/release.py +14 -13
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/cli/commands/todo.py +5 -5
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/cli/main.py +2 -2
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/database.py +4 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/patch_manager.py +1 -1
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/release_file.py +1 -1
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/release_manager.py +9 -8
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/repo.py +28 -16
- half_orm_dev-0.17.3a5/half_orm_dev/templates/README +230 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/templates/git-hooks/pre-commit +8 -4
- half_orm_dev-0.17.3a5/half_orm_dev/version.txt +1 -0
- half_orm_dev-0.17.3a5/half_orm_dev.egg-info/PKG-INFO +553 -0
- half_orm_dev-0.17.3a3/PKG-INFO +0 -1284
- half_orm_dev-0.17.3a3/README.md +0 -1253
- half_orm_dev-0.17.3a3/half_orm_dev/templates/README +0 -25
- half_orm_dev-0.17.3a3/half_orm_dev/version.txt +0 -1
- half_orm_dev-0.17.3a3/half_orm_dev.egg-info/PKG-INFO +0 -1284
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/AUTHORS +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/LICENSE +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/__init__.py +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/cli/__init__.py +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/cli/commands/__init__.py +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/cli/commands/apply.py +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/cli/commands/check.py +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/cli/commands/clone.py +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/cli/commands/migrate.py +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/cli/commands/restore.py +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/cli/commands/sync.py +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/cli/commands/undo.py +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/cli/commands/update.py +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/cli/commands/upgrade.py +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/cli_extension.py +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/decorators.py +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/hgit.py +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/migration_manager.py +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/migrations/0/17/1/00_move_to_hop.py +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/migrations/0/17/1/01_txt_to_toml.py +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/modules.py +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/patch_validator.py +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/patches/0/1/0/00_half_orm_meta.database.sql +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/patches/0/1/0/01_alter_half_orm_meta.hop_release.sql +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/patches/0/1/0/02_half_orm_meta.view.hop_penultimate_release.sql +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/patches/log +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/patches/sql/half_orm_meta.sql +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/templates/.gitignore +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/templates/MANIFEST.in +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/templates/Pipfile +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/templates/conftest_template +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/templates/git-hooks/prepare-commit-msg +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/templates/init_module_template +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/templates/module_template_1 +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/templates/module_template_2 +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/templates/module_template_3 +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/templates/pyproject.toml +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/templates/relation_test +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/templates/sql_adapter +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/templates/warning +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev/utils.py +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev.egg-info/SOURCES.txt +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev.egg-info/dependency_links.txt +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev.egg-info/requires.txt +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/half_orm_dev.egg-info/top_level.txt +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/pyproject.toml +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/setup.cfg +0 -0
- {half_orm_dev-0.17.3a3 → half_orm_dev-0.17.3a5}/setup.py +0 -0
|
@@ -0,0 +1,553 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: half_orm_dev
|
|
3
|
+
Version: 0.17.3a5
|
|
4
|
+
Summary: half_orm development Framework.
|
|
5
|
+
Author-email: Joël Maïzi <joel.maizi@collorg.org>
|
|
6
|
+
License-Expression: GPL-3.0-or-later
|
|
7
|
+
Project-URL: Homepage, https://github.com/collorg/halfORM_dev
|
|
8
|
+
Keywords: postgres,relation-object mapping
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
+
Requires-Python: >=3.9
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
License-File: AUTHORS
|
|
22
|
+
Requires-Dist: GitPython
|
|
23
|
+
Requires-Dist: click
|
|
24
|
+
Requires-Dist: pydash
|
|
25
|
+
Requires-Dist: pytest
|
|
26
|
+
Requires-Dist: half_orm<0.18.0,>=0.17.1
|
|
27
|
+
Requires-Dist: tomli>=2.0.0; python_version < "3.11"
|
|
28
|
+
Requires-Dist: tomli_w>=1.0.0
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
Dynamic: requires-dist
|
|
31
|
+
|
|
32
|
+
# half-orm-dev
|
|
33
|
+
|
|
34
|
+
## **WARNING!** half-orm-dev is in alpha development phase!
|
|
35
|
+
|
|
36
|
+
> **Please report any issues at [GitHub Issues](https://github.com/half-orm/half-orm-dev/issues)**
|
|
37
|
+
|
|
38
|
+
**Git-centric patch management and database versioning for half-orm projects**
|
|
39
|
+
|
|
40
|
+
[](https://www.python.org/downloads/)
|
|
41
|
+
[](https://www.gnu.org/licenses/gpl-3.0)
|
|
42
|
+
[](https://github.com/half-orm/half-orm)
|
|
43
|
+
[](https://pepy.tech/projects/half-orm-dev)
|
|
44
|
+
|
|
45
|
+
Modern development workflow for PostgreSQL databases with automatic code generation, semantic versioning, and production-ready deployment system.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 📖 What is half-orm-dev?
|
|
50
|
+
|
|
51
|
+
`half-orm-dev` provides a complete development lifecycle for database-driven applications:
|
|
52
|
+
|
|
53
|
+
- **Git-centric workflow**: Patches stored in Git branches with semantic versioning
|
|
54
|
+
- **Test-Driven Development**: **Automatic validation** - tests run before integration, patches blocked if tests fail
|
|
55
|
+
- **Code generation**: Python classes auto-generated from schema changes
|
|
56
|
+
- **Safe deployments**: Sequential releases with automatic backups and validation
|
|
57
|
+
- **Team collaboration**: Distributed locks, branch management, conflict prevention
|
|
58
|
+
- **Cloud-friendly**: No superuser privileges required (works on AWS RDS, Azure, GCP)
|
|
59
|
+
|
|
60
|
+
Perfect for teams managing evolving PostgreSQL schemas with Python applications.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## ✨ Key Features
|
|
65
|
+
|
|
66
|
+
### 🧪 Systematic Test Validation (Core Safety Feature)
|
|
67
|
+
|
|
68
|
+
**Tests run automatically before patch integration and block merges if they fail.**
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# When you merge a patch, half-orm-dev:
|
|
72
|
+
git checkout ho-patch/123-feature
|
|
73
|
+
half_orm dev patch merge
|
|
74
|
+
|
|
75
|
+
# Behind the scenes:
|
|
76
|
+
# 1. Creates temporary validation branch
|
|
77
|
+
# 2. Merges ALL patches in release context
|
|
78
|
+
# 3. Runs pytest automatically
|
|
79
|
+
# 4. ✅ If PASS → merges into release, status → "staged"
|
|
80
|
+
# 5. ❌ If FAIL → nothing committed, temp branch deleted
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Benefits:**
|
|
84
|
+
- ✅ Catch integration issues early
|
|
85
|
+
- ✅ Prevent regressions automatically
|
|
86
|
+
- ✅ Only validated code reaches production
|
|
87
|
+
- ✅ Full release context testing (all patches together)
|
|
88
|
+
|
|
89
|
+
**Cannot be disabled** - it's a core safety feature.
|
|
90
|
+
|
|
91
|
+
### 🔧 Development Workflow
|
|
92
|
+
|
|
93
|
+
- **Patch-based development**: Isolated branches for each database change
|
|
94
|
+
- **Automatic code generation**: half-orm Python classes from schema
|
|
95
|
+
- **Complete testing**: Apply patches with full release context
|
|
96
|
+
- **Conflict detection**: Distributed locks prevent concurrent modifications
|
|
97
|
+
|
|
98
|
+
### 📦 Release Management
|
|
99
|
+
|
|
100
|
+
- **Semantic versioning**: patch/minor/major increments
|
|
101
|
+
- **Sequential promotion**: stage → rc → production workflow
|
|
102
|
+
- **Release candidates**: RC validation before production
|
|
103
|
+
- **Branch cleanup**: Automatic deletion after promotion
|
|
104
|
+
|
|
105
|
+
### 🚀 Production
|
|
106
|
+
|
|
107
|
+
- **Safe upgrades**: Automatic database backups before changes
|
|
108
|
+
- **Incremental deployment**: Apply releases sequentially
|
|
109
|
+
- **Version tracking**: Complete release history
|
|
110
|
+
- **Cloud-compatible**: No superuser privileges required
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## 🚀 Installation
|
|
115
|
+
|
|
116
|
+
### Prerequisites
|
|
117
|
+
|
|
118
|
+
- **Python 3.9+** required
|
|
119
|
+
- **PostgreSQL 12+** recommended
|
|
120
|
+
- **Git** for version control
|
|
121
|
+
|
|
122
|
+
### Install
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
pip install half-orm-dev
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Verify Installation
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
half_orm dev --help
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## 📖 Quick Start
|
|
137
|
+
|
|
138
|
+
### Initialize New Project
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Create project with database
|
|
142
|
+
half_orm dev init myproject --database mydb
|
|
143
|
+
cd myproject
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Clone Existing Project
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# Clone from Git
|
|
150
|
+
half_orm dev clone https://github.com/user/project.git
|
|
151
|
+
cd project
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Basic Development Workflow
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
# 1. Create a release (integration branch)
|
|
158
|
+
half_orm dev release create minor # Creates ho-release/0.1.0
|
|
159
|
+
|
|
160
|
+
# 2. Create a patch
|
|
161
|
+
half_orm dev patch create 1-users
|
|
162
|
+
# → Creates ho-patch/1-users branch
|
|
163
|
+
# → Auto-added to 0.1.0-patches.toml as "candidate"
|
|
164
|
+
|
|
165
|
+
# 3. Add schema changes
|
|
166
|
+
echo "CREATE TABLE users (
|
|
167
|
+
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
168
|
+
username TEXT NOT NULL
|
|
169
|
+
);" > Patches/1-users/01_users.sql
|
|
170
|
+
|
|
171
|
+
# 4. Apply patch (generates Python code)
|
|
172
|
+
half_orm dev patch apply
|
|
173
|
+
# → Restores database from production state
|
|
174
|
+
# → Applies SQL patches
|
|
175
|
+
# → Generates Python classes (mydb/public/user.py)
|
|
176
|
+
|
|
177
|
+
# 5. Write tests (TDD approach)
|
|
178
|
+
cat > tests/public/user/test_user_logic.py << 'EOF'
|
|
179
|
+
from mydb.public.user import User
|
|
180
|
+
|
|
181
|
+
def test_user_creation():
|
|
182
|
+
"""Test user creation business logic."""
|
|
183
|
+
user = User(username='alice').ho_insert()
|
|
184
|
+
assert user['username'] == 'alice'
|
|
185
|
+
assert user['id'] is not None
|
|
186
|
+
EOF
|
|
187
|
+
|
|
188
|
+
# 6. Run tests locally
|
|
189
|
+
pytest
|
|
190
|
+
|
|
191
|
+
# 7. Commit your work
|
|
192
|
+
git add .
|
|
193
|
+
git commit -m "Add users table with tests"
|
|
194
|
+
|
|
195
|
+
# 8. Merge patch - AUTOMATIC VALIDATION!
|
|
196
|
+
git checkout ho-patch/1-users
|
|
197
|
+
half_orm dev patch merge
|
|
198
|
+
# → Creates temp validation branch
|
|
199
|
+
# → Runs pytest automatically
|
|
200
|
+
# → If tests pass: merges into ho-release/0.1.0, status → "staged"
|
|
201
|
+
# → If tests fail: aborts, nothing committed
|
|
202
|
+
|
|
203
|
+
# 9. Promote to production
|
|
204
|
+
half_orm dev release promote rc # Optional: create release candidate
|
|
205
|
+
half_orm dev release promote prod # Merge to ho-prod + create tag
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## 💻 Core Workflow
|
|
211
|
+
|
|
212
|
+
### Branch Strategy
|
|
213
|
+
|
|
214
|
+
```
|
|
215
|
+
ho-prod (main production branch)
|
|
216
|
+
│
|
|
217
|
+
├── ho-release/0.17.0 (integration branch, deleted after prod)
|
|
218
|
+
│ ├── ho-patch/6-feature-x (temporary, deleted after merge)
|
|
219
|
+
│ ├── ho-patch/7-bugfix-y (temporary, deleted after merge)
|
|
220
|
+
│ └── ho-patch/8-auth-z (temporary, deleted after merge)
|
|
221
|
+
│
|
|
222
|
+
└── ho-release/0.18.0 (next version in parallel)
|
|
223
|
+
└── ho-patch/10-new-api (temporary, deleted after merge)
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**Branch Types:**
|
|
227
|
+
- **ho-prod**: Stable production branch (source of truth)
|
|
228
|
+
- **ho-release/X.Y.Z**: Integration branches (temporary)
|
|
229
|
+
- **ho-patch/ID**: Patch development branches (temporary)
|
|
230
|
+
|
|
231
|
+
### Release Files
|
|
232
|
+
|
|
233
|
+
```
|
|
234
|
+
.hop/releases/
|
|
235
|
+
├── 0.17.0-patches.toml # Development (mutable: candidate/staged status)
|
|
236
|
+
├── 0.17.0-rc1.txt # Release candidate snapshot (immutable)
|
|
237
|
+
├── 0.17.0.txt # Production snapshot (immutable)
|
|
238
|
+
└── 0.18.0-patches.toml # Next version in progress
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
**Patch States:**
|
|
242
|
+
1. **candidate**: In development (`"patch-id" = "candidate"` in TOML)
|
|
243
|
+
2. **staged**: Integrated, awaiting promotion (`"patch-id" = "staged"` in TOML)
|
|
244
|
+
3. **released**: Deployed to production (in `X.Y.Z.txt` snapshot)
|
|
245
|
+
|
|
246
|
+
### Development Cycle
|
|
247
|
+
|
|
248
|
+
```
|
|
249
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
250
|
+
│ DEVELOPMENT WORKFLOW │
|
|
251
|
+
├─────────────────────────────────────────────────────────────┤
|
|
252
|
+
│ 1. release create <level> Create ho-release/X.Y.Z │
|
|
253
|
+
│ 2. patch create <id> Create patch (auto-candidate) │
|
|
254
|
+
│ 3. patch apply Apply & test changes │
|
|
255
|
+
│ 4. patch merge Merge into release (TESTS!) │
|
|
256
|
+
│ ✅ Tests pass → integrated │
|
|
257
|
+
│ ❌ Tests fail → aborted │
|
|
258
|
+
│ │
|
|
259
|
+
│ RELEASE PROMOTION │
|
|
260
|
+
│ 5. release promote rc Create RC (optional) │
|
|
261
|
+
│ 6. release promote prod Merge to ho-prod + deploy │
|
|
262
|
+
│ │
|
|
263
|
+
│ PRODUCTION DEPLOYMENT │
|
|
264
|
+
│ 7. update Check available releases │
|
|
265
|
+
│ 8. upgrade Apply on production servers │
|
|
266
|
+
└─────────────────────────────────────────────────────────────┘
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## 📖 Command Reference
|
|
272
|
+
|
|
273
|
+
### Init & Clone
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
# Create new project
|
|
277
|
+
half_orm dev init <package_name> --database <db_name>
|
|
278
|
+
|
|
279
|
+
# Clone existing project
|
|
280
|
+
half_orm dev clone <git_origin>
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### Patch Commands
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
# Create new patch (must be on ho-release/* branch)
|
|
287
|
+
half_orm dev patch create <patch_id>
|
|
288
|
+
|
|
289
|
+
# Apply current patch (must be on ho-patch/* branch)
|
|
290
|
+
half_orm dev patch apply
|
|
291
|
+
|
|
292
|
+
# Merge patch into release (AUTOMATIC VALIDATION!)
|
|
293
|
+
# Must be on ho-patch/* branch
|
|
294
|
+
half_orm dev patch merge
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
**Tip:** Patch IDs must start with a number (e.g., `123-add-users`). This number automatically closes the corresponding GitHub/GitLab issue #123 when the patch is merged.
|
|
298
|
+
|
|
299
|
+
### Release Commands
|
|
300
|
+
|
|
301
|
+
```bash
|
|
302
|
+
# Create new release
|
|
303
|
+
half_orm dev release create patch # X.Y.(Z+1)
|
|
304
|
+
half_orm dev release create minor # X.(Y+1).0
|
|
305
|
+
half_orm dev release create major # (X+1).0.0
|
|
306
|
+
|
|
307
|
+
# Promote to release candidate (optional)
|
|
308
|
+
half_orm dev release promote rc
|
|
309
|
+
|
|
310
|
+
# Promote to production
|
|
311
|
+
half_orm dev release promote prod
|
|
312
|
+
|
|
313
|
+
# Hotfix workflow
|
|
314
|
+
half_orm dev release hotfix # Reopen production version
|
|
315
|
+
half_orm dev release promote hotfix # Deploy hotfix
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### Production Commands
|
|
319
|
+
|
|
320
|
+
```bash
|
|
321
|
+
# Check available releases
|
|
322
|
+
half_orm dev update
|
|
323
|
+
|
|
324
|
+
# Apply releases to production
|
|
325
|
+
half_orm dev upgrade [--to-release X.Y.Z]
|
|
326
|
+
|
|
327
|
+
# Dry run (simulate upgrade)
|
|
328
|
+
half_orm dev upgrade --dry-run
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
**Note:** Use `half_orm dev <command> --help` for detailed help on each command.
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
## 🎯 Example: Team Collaboration
|
|
336
|
+
|
|
337
|
+
```bash
|
|
338
|
+
# Integration Manager: Create release
|
|
339
|
+
half_orm dev release create minor # Creates ho-release/0.17.0
|
|
340
|
+
|
|
341
|
+
# Developer A: Work on feature
|
|
342
|
+
git checkout ho-release/0.17.0
|
|
343
|
+
half_orm dev patch create 456-dashboard
|
|
344
|
+
# ... develop and test ...
|
|
345
|
+
git checkout ho-patch/456-dashboard
|
|
346
|
+
half_orm dev patch merge # Tests run automatically
|
|
347
|
+
# → Status: "staged" in 0.17.0-patches.toml
|
|
348
|
+
|
|
349
|
+
# Developer B: Sync and create patch
|
|
350
|
+
git checkout ho-release/0.17.0
|
|
351
|
+
git pull origin ho-release/0.17.0 # Get A's changes
|
|
352
|
+
half_orm dev patch create 789-reports
|
|
353
|
+
# ... develop and test ...
|
|
354
|
+
git merge origin/ho-release/0.17.0 # Sync again
|
|
355
|
+
git checkout ho-patch/789-reports
|
|
356
|
+
half_orm dev patch merge
|
|
357
|
+
# → Tests run with BOTH 456 + 789 together!
|
|
358
|
+
# → Both validated in full release context
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
---
|
|
362
|
+
|
|
363
|
+
## 🎓 Best Practices
|
|
364
|
+
|
|
365
|
+
### Development
|
|
366
|
+
✅ **DO:**
|
|
367
|
+
- Write tests FIRST (TDD approach)
|
|
368
|
+
- Run `pytest` locally before `patch merge`
|
|
369
|
+
- Use descriptive patch IDs: `123-add-user-authentication`
|
|
370
|
+
- Keep patches focused (one feature per patch)
|
|
371
|
+
- Test patches thoroughly
|
|
372
|
+
|
|
373
|
+
❌ **DON'T:**
|
|
374
|
+
- Skip writing tests (validation will fail anyway)
|
|
375
|
+
- Mix multiple features in one patch
|
|
376
|
+
- Bypass test validation (it's there for safety)
|
|
377
|
+
- Modify files outside your patch directory
|
|
378
|
+
|
|
379
|
+
### Release Management
|
|
380
|
+
✅ **DO:**
|
|
381
|
+
- Trust the automatic test validation system
|
|
382
|
+
- Test RC thoroughly before promoting to production
|
|
383
|
+
- Use semantic versioning consistently
|
|
384
|
+
- Review test failures carefully before retrying
|
|
385
|
+
|
|
386
|
+
❌ **DON'T:**
|
|
387
|
+
- Skip RC validation
|
|
388
|
+
- Force promote without fixing issues
|
|
389
|
+
- Bypass test validation
|
|
390
|
+
- Ignore test failures
|
|
391
|
+
|
|
392
|
+
### Production Deployment
|
|
393
|
+
✅ **DO:**
|
|
394
|
+
- Always run `update` first to check available releases
|
|
395
|
+
- Use `--dry-run` to preview changes
|
|
396
|
+
- Verify backups exist before upgrade
|
|
397
|
+
- Verify all tests passed in RC before promoting
|
|
398
|
+
|
|
399
|
+
❌ **DON'T:**
|
|
400
|
+
- Deploy without testing in RC first
|
|
401
|
+
- Skip backup verification
|
|
402
|
+
- Promote to production if RC tests failed
|
|
403
|
+
- Apply patches directly without releases
|
|
404
|
+
|
|
405
|
+
---
|
|
406
|
+
|
|
407
|
+
## 📚 Documentation
|
|
408
|
+
|
|
409
|
+
- **[CONTRIBUTING.md](CONTRIBUTING.md)** - Development setup, testing, contribution guidelines
|
|
410
|
+
- **[docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)** - Technical architecture and implementation details
|
|
411
|
+
- **[CLAUDE.md](CLAUDE.md)** - Quick reference for Claude Code CLI
|
|
412
|
+
|
|
413
|
+
For detailed technical documentation, see [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md).
|
|
414
|
+
|
|
415
|
+
---
|
|
416
|
+
|
|
417
|
+
## 🔧 Troubleshooting
|
|
418
|
+
|
|
419
|
+
### Error: "Must be on ho-release/* branch"
|
|
420
|
+
```bash
|
|
421
|
+
# Create release or switch to release branch
|
|
422
|
+
half_orm dev release create minor
|
|
423
|
+
# or
|
|
424
|
+
git checkout ho-release/0.17.0
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
### Error: "Must be on ho-patch/* branch"
|
|
428
|
+
|
|
429
|
+
```bash
|
|
430
|
+
# Solution: Create or switch to patch branch
|
|
431
|
+
# First ensure you're on ho-release/*
|
|
432
|
+
git checkout ho-release/0.17.0
|
|
433
|
+
half_orm dev patch create <patch_id>
|
|
434
|
+
# or
|
|
435
|
+
git checkout ho-patch/<patch_id>
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
### Error: "Patch not found in candidates file"
|
|
439
|
+
|
|
440
|
+
```bash
|
|
441
|
+
# Solution: Patch must be created from ho-release/* branch
|
|
442
|
+
# to be automatically added to candidates
|
|
443
|
+
git checkout ho-release/0.17.0
|
|
444
|
+
half_orm dev patch create <patch_id>
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
### Error: "Repository is not clean"
|
|
448
|
+
|
|
449
|
+
```bash
|
|
450
|
+
# Solution: Commit or stash changes
|
|
451
|
+
git status
|
|
452
|
+
git add .
|
|
453
|
+
git commit -m "Your message"
|
|
454
|
+
# or
|
|
455
|
+
git stash
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
### Error: "Repository not synced with origin"
|
|
459
|
+
|
|
460
|
+
```bash
|
|
461
|
+
# This should not happen - commands handle git operations automatically
|
|
462
|
+
# If it does occur:
|
|
463
|
+
git pull origin ho-prod
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
### Error: "No stage releases found"
|
|
467
|
+
|
|
468
|
+
```bash
|
|
469
|
+
# Solution: Prepare a release first
|
|
470
|
+
half_orm dev release new patch
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
### Error: "Active RC exists"
|
|
474
|
+
|
|
475
|
+
```bash
|
|
476
|
+
# Cannot promote different version while RC exists
|
|
477
|
+
# Solution: Promote current RC to production first
|
|
478
|
+
half_orm dev release promote prod
|
|
479
|
+
|
|
480
|
+
# Then promote your stage
|
|
481
|
+
half_orm dev release promote rc
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
### Error: "Tests failed for patch integration"
|
|
485
|
+
```bash
|
|
486
|
+
# Fix tests or code, then retry
|
|
487
|
+
half_orm dev patch apply # Test locally first
|
|
488
|
+
pytest # Verify tests pass
|
|
489
|
+
|
|
490
|
+
# Fix issues
|
|
491
|
+
vim Patches/123-feature/01_schema.sql
|
|
492
|
+
vim tests/test_feature.py
|
|
493
|
+
|
|
494
|
+
# Try again
|
|
495
|
+
git checkout ho-patch/123-feature
|
|
496
|
+
half_orm dev patch merge # Tests will run again
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
### Error: "Repository is not clean"
|
|
500
|
+
```bash
|
|
501
|
+
# Commit or stash changes
|
|
502
|
+
git status
|
|
503
|
+
git add .
|
|
504
|
+
git commit -m "Your message"
|
|
505
|
+
# or
|
|
506
|
+
git stash
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
For more troubleshooting, see [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md).
|
|
510
|
+
|
|
511
|
+
---
|
|
512
|
+
|
|
513
|
+
## 🤝 Contributing
|
|
514
|
+
|
|
515
|
+
Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and guidelines.
|
|
516
|
+
|
|
517
|
+
**Quick start for contributors:**
|
|
518
|
+
|
|
519
|
+
```bash
|
|
520
|
+
# Clone repository
|
|
521
|
+
git clone https://github.com/half-orm/half-orm-dev.git
|
|
522
|
+
cd half-orm-dev
|
|
523
|
+
|
|
524
|
+
# Create virtual environment
|
|
525
|
+
python -m venv .venv
|
|
526
|
+
source .venv/bin/activate
|
|
527
|
+
|
|
528
|
+
# Install in development mode
|
|
529
|
+
pip install -e .
|
|
530
|
+
|
|
531
|
+
# Run tests
|
|
532
|
+
pytest # All tests
|
|
533
|
+
pytest -m "not integration" # Unit tests only
|
|
534
|
+
pytest -m integration # Integration tests only
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
---
|
|
538
|
+
|
|
539
|
+
## 📞 Getting Help
|
|
540
|
+
|
|
541
|
+
- **Issues**: [GitHub Issues](https://github.com/half-orm/half-orm-dev/issues)
|
|
542
|
+
- **Documentation**: [CONTRIBUTING.md](CONTRIBUTING.md) and [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)
|
|
543
|
+
- **half-orm**: [half-orm Documentation](https://half-orm.github.io/half-orm/latest/)
|
|
544
|
+
|
|
545
|
+
---
|
|
546
|
+
|
|
547
|
+
## 📄 License
|
|
548
|
+
|
|
549
|
+
This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details.
|
|
550
|
+
|
|
551
|
+
---
|
|
552
|
+
|
|
553
|
+
**Made with ❤️ by the half-orm team**
|