half-orm-dev 0.16.0a1__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.
Potentially problematic release.
This version of half-orm-dev might be problematic. Click here for more details.
- half_orm_dev-0.16.0a1/AUTHORS +3 -0
- half_orm_dev-0.16.0a1/LICENSE +14 -0
- half_orm_dev-0.16.0a1/PKG-INFO +314 -0
- half_orm_dev-0.16.0a1/README.md +278 -0
- half_orm_dev-0.16.0a1/half_orm_dev/__init__.py +0 -0
- half_orm_dev-0.16.0a1/half_orm_dev/changelog.py +117 -0
- half_orm_dev-0.16.0a1/half_orm_dev/cli_extension.py +171 -0
- half_orm_dev-0.16.0a1/half_orm_dev/database.py +127 -0
- half_orm_dev-0.16.0a1/half_orm_dev/db_conn.py +134 -0
- half_orm_dev-0.16.0a1/half_orm_dev/hgit.py +202 -0
- half_orm_dev-0.16.0a1/half_orm_dev/hop.py +167 -0
- half_orm_dev-0.16.0a1/half_orm_dev/manifest.py +43 -0
- half_orm_dev-0.16.0a1/half_orm_dev/modules.py +357 -0
- half_orm_dev-0.16.0a1/half_orm_dev/patch.py +348 -0
- half_orm_dev-0.16.0a1/half_orm_dev/patches/0/1/0/00_half_orm_meta.database.sql +34 -0
- half_orm_dev-0.16.0a1/half_orm_dev/patches/0/1/0/01_alter_half_orm_meta.hop_release.sql +2 -0
- half_orm_dev-0.16.0a1/half_orm_dev/patches/0/1/0/02_half_orm_meta.view.hop_penultimate_release.sql +3 -0
- half_orm_dev-0.16.0a1/half_orm_dev/patches/log +2 -0
- half_orm_dev-0.16.0a1/half_orm_dev/patches/sql/half_orm_meta.sql +208 -0
- half_orm_dev-0.16.0a1/half_orm_dev/repo.py +266 -0
- half_orm_dev-0.16.0a1/half_orm_dev/templates/.gitignore +14 -0
- half_orm_dev-0.16.0a1/half_orm_dev/templates/MANIFEST.in +1 -0
- half_orm_dev-0.16.0a1/half_orm_dev/templates/Pipfile +13 -0
- half_orm_dev-0.16.0a1/half_orm_dev/templates/README +25 -0
- half_orm_dev-0.16.0a1/half_orm_dev/templates/base_test +26 -0
- half_orm_dev-0.16.0a1/half_orm_dev/templates/init_module_template +6 -0
- half_orm_dev-0.16.0a1/half_orm_dev/templates/module_template_1 +12 -0
- half_orm_dev-0.16.0a1/half_orm_dev/templates/module_template_2 +5 -0
- half_orm_dev-0.16.0a1/half_orm_dev/templates/module_template_3 +3 -0
- half_orm_dev-0.16.0a1/half_orm_dev/templates/relation_test +19 -0
- half_orm_dev-0.16.0a1/half_orm_dev/templates/setup.py +81 -0
- half_orm_dev-0.16.0a1/half_orm_dev/templates/sql_adapter +9 -0
- half_orm_dev-0.16.0a1/half_orm_dev/templates/warning +12 -0
- half_orm_dev-0.16.0a1/half_orm_dev/utils.py +12 -0
- half_orm_dev-0.16.0a1/half_orm_dev/version.txt +1 -0
- half_orm_dev-0.16.0a1/half_orm_dev.egg-info/PKG-INFO +314 -0
- half_orm_dev-0.16.0a1/half_orm_dev.egg-info/SOURCES.txt +41 -0
- half_orm_dev-0.16.0a1/half_orm_dev.egg-info/dependency_links.txt +1 -0
- half_orm_dev-0.16.0a1/half_orm_dev.egg-info/entry_points.txt +2 -0
- half_orm_dev-0.16.0a1/half_orm_dev.egg-info/requires.txt +5 -0
- half_orm_dev-0.16.0a1/half_orm_dev.egg-info/top_level.txt +1 -0
- half_orm_dev-0.16.0a1/setup.cfg +4 -0
- half_orm_dev-0.16.0a1/setup.py +57 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
This file is part of half_orm_dev.
|
|
2
|
+
|
|
3
|
+
half_orm_dev is free software: you can redistribute it and/or modify
|
|
4
|
+
it under the terms of the GNU General Public License as published by
|
|
5
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
6
|
+
(at your option) any later version.
|
|
7
|
+
|
|
8
|
+
half_orm is distributed in the hope that it will be useful,
|
|
9
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
10
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
11
|
+
GNU General Public License for more details.
|
|
12
|
+
|
|
13
|
+
You should have received a copy of the GNU General Public License
|
|
14
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: half_orm_dev
|
|
3
|
+
Version: 0.16.0a1
|
|
4
|
+
Summary: half_orm development Framework.
|
|
5
|
+
Home-page: https://github.com/collorg/halfORM_dev
|
|
6
|
+
Author: Joël Maïzi
|
|
7
|
+
Author-email: joel.maizi@collorg.org
|
|
8
|
+
License: GNU General Public License v3 (GPLv3)
|
|
9
|
+
Keywords: postgres,relation-object mapping
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
13
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
License-File: AUTHORS
|
|
20
|
+
Requires-Dist: GitPython
|
|
21
|
+
Requires-Dist: click
|
|
22
|
+
Requires-Dist: pydash
|
|
23
|
+
Requires-Dist: half_orm>=0.14.0
|
|
24
|
+
Requires-Dist: pytest
|
|
25
|
+
Dynamic: author
|
|
26
|
+
Dynamic: author-email
|
|
27
|
+
Dynamic: classifier
|
|
28
|
+
Dynamic: description
|
|
29
|
+
Dynamic: description-content-type
|
|
30
|
+
Dynamic: home-page
|
|
31
|
+
Dynamic: keywords
|
|
32
|
+
Dynamic: license
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
Dynamic: requires-dist
|
|
35
|
+
Dynamic: summary
|
|
36
|
+
|
|
37
|
+
# halfORM packager (early alpha stage)
|
|
38
|
+
|
|
39
|
+
> **📢 Project Evolution Notice**
|
|
40
|
+
>
|
|
41
|
+
> **halfORM_dev is being redesigned to integrate with halfORM 0.16's new extension system.**
|
|
42
|
+
>
|
|
43
|
+
> This project will be refactored as `half-orm-dev` to provide development tools through the unified `half_orm` CLI interface. The core functionality (project management, database patches, code generation) will remain the same, but the integration and command structure will be modernized.
|
|
44
|
+
>
|
|
45
|
+
> **Current Status:**
|
|
46
|
+
> - halfORM core 0.16 with extension is about to be released
|
|
47
|
+
> - halfORM_dev refactoring will start soon
|
|
48
|
+
> - New `half-orm-dev` extension planned for Q3 2025
|
|
49
|
+
>
|
|
50
|
+
> **What's Changing:**
|
|
51
|
+
> - Commands will integrate with `half_orm dev` instead of standalone `hop`
|
|
52
|
+
> - Extension auto-discovery and security model
|
|
53
|
+
> - Simplified installation and configuration
|
|
54
|
+
> - Consistent CLI experience across all halfORM tools
|
|
55
|
+
>
|
|
56
|
+
> **For Current Users:**
|
|
57
|
+
> The existing halfORM_dev will continue to work as-is. The new extension will provide a migration path when ready.
|
|
58
|
+
>
|
|
59
|
+
> **Stay Updated:**
|
|
60
|
+
> Follow progress in [halfORM Discussions](https://github.com/collorg/halfORM/discussions) and [halfORM Issues](https://github.com/collorg/halfORM/issues).
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
THIS DOC IS A WORK IN PROGRESS...
|
|
65
|
+
|
|
66
|
+
This package allows you to patch/test a PostgreSQL model and its associated
|
|
67
|
+
Python code using the `hop` command.
|
|
68
|
+
|
|
69
|
+
It is based on the [half_orm](https://github.com/collorg/halfORM)
|
|
70
|
+
PostgreSQL → Python relation object mapper.
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
## Installation
|
|
74
|
+
|
|
75
|
+
Run `pip install half_orm_dev`.
|
|
76
|
+
|
|
77
|
+
## help
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
$ hop --help
|
|
81
|
+
Usage: hop [OPTIONS] COMMAND [ARGS]...
|
|
82
|
+
|
|
83
|
+
Generates/Synchronises/Patches a python package from a PostgreSQL database
|
|
84
|
+
|
|
85
|
+
Options:
|
|
86
|
+
-v, --version
|
|
87
|
+
--help Show this message and exit.
|
|
88
|
+
|
|
89
|
+
Commands:
|
|
90
|
+
new Creates a new hop project named <package_name>.
|
|
91
|
+
patch Applies the next patch
|
|
92
|
+
test Tests some common pitfalls.
|
|
93
|
+
update Updates the Python code with the changes made to the model.
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Create a new package for your database: *`hop new`*
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
hop new <package name>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**WARNING!** The `hop new` command will add to your database
|
|
103
|
+
two new schemas: `half_orm_meta` and "`half_orm_meta.view`".
|
|
104
|
+
The table `half_orm_meta.release` will containt the patch history
|
|
105
|
+
of your model (see `hop patch` bellow).
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
$ hop new pagila
|
|
110
|
+
HALFORM_CONF_DIR: /home/joel/.halform
|
|
111
|
+
Using '/home/joel/.halform/pagila' file for connexion.
|
|
112
|
+
Initializing git with a 'main' branch.
|
|
113
|
+
Initializing the patch system for the 'pagila' database.
|
|
114
|
+
Patch system initialized at release '0.0.0'.
|
|
115
|
+
|
|
116
|
+
The hop project 'pagila' has been created.
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
The tree command shows you the repartition of the modules in your package.
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
$ tree pagila
|
|
123
|
+
pagila
|
|
124
|
+
├── Backups
|
|
125
|
+
│ └── pagila-pre-patch.sql
|
|
126
|
+
├── pagila
|
|
127
|
+
│ ├── base_test.py
|
|
128
|
+
│ ├── db_connector.py
|
|
129
|
+
│ ├── __init__.py
|
|
130
|
+
│ └── public
|
|
131
|
+
│ ├── actor_info.py
|
|
132
|
+
│ ├── actor_info_test.py
|
|
133
|
+
│ ├── actor.py
|
|
134
|
+
│ ├── actor_test.py
|
|
135
|
+
│ ├── address.py
|
|
136
|
+
│ ├── address_test.py
|
|
137
|
+
│ ├── category.py
|
|
138
|
+
│ ├── category_test.py
|
|
139
|
+
│ ├── city.py
|
|
140
|
+
│ ├── city_test.py
|
|
141
|
+
│ ├── country.py
|
|
142
|
+
│ ├── country_test.py
|
|
143
|
+
│ ├── customer_list.py
|
|
144
|
+
│ ├── customer_list_test.py
|
|
145
|
+
│ ├── customer.py
|
|
146
|
+
│ ├── customer_test.py
|
|
147
|
+
│ ├── film_actor.py
|
|
148
|
+
│ ├── film_actor_test.py
|
|
149
|
+
│ ├── film_category.py
|
|
150
|
+
│ ├── film_category_test.py
|
|
151
|
+
│ ├── film_list.py
|
|
152
|
+
│ ├── film_list_test.py
|
|
153
|
+
│ ├── film.py
|
|
154
|
+
│ ├── film_test.py
|
|
155
|
+
│ ├── __init__.py
|
|
156
|
+
│ ├── inventory.py
|
|
157
|
+
│ ├── inventory_test.py
|
|
158
|
+
│ ├── language.py
|
|
159
|
+
│ ├── language_test.py
|
|
160
|
+
│ ├── nicer_but_slower_film_list.py
|
|
161
|
+
│ ├── nicer_but_slower_film_list_test.py
|
|
162
|
+
│ ├── payment_p2020_01.py
|
|
163
|
+
│ ├── payment_p2020_01_test.py
|
|
164
|
+
│ ├── payment_p2020_02.py
|
|
165
|
+
│ ├── payment_p2020_02_test.py
|
|
166
|
+
│ ├── payment_p2020_03.py
|
|
167
|
+
│ ├── payment_p2020_03_test.py
|
|
168
|
+
│ ├── payment_p2020_04.py
|
|
169
|
+
│ ├── payment_p2020_04_test.py
|
|
170
|
+
│ ├── payment_p2020_05.py
|
|
171
|
+
│ ├── payment_p2020_05_test.py
|
|
172
|
+
│ ├── payment_p2020_06.py
|
|
173
|
+
│ ├── payment_p2020_06_test.py
|
|
174
|
+
│ ├── payment.py
|
|
175
|
+
│ ├── payment_test.py
|
|
176
|
+
│ ├── rental.py
|
|
177
|
+
│ ├── rental_test.py
|
|
178
|
+
│ ├── sales_by_film_category.py
|
|
179
|
+
│ ├── sales_by_film_category_test.py
|
|
180
|
+
│ ├── sales_by_store.py
|
|
181
|
+
│ ├── sales_by_store_test.py
|
|
182
|
+
│ ├── staff_list.py
|
|
183
|
+
│ ├── staff_list_test.py
|
|
184
|
+
│ ├── staff.py
|
|
185
|
+
│ ├── staff_test.py
|
|
186
|
+
│ ├── store.py
|
|
187
|
+
│ └── store_test.py
|
|
188
|
+
├── Patches
|
|
189
|
+
│ └── README
|
|
190
|
+
├── Pipfile
|
|
191
|
+
├── README.md
|
|
192
|
+
└── setup.py
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Once created, go to the newly created directory
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
cd pagila
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## The organisation
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
$ tree -d
|
|
205
|
+
.
|
|
206
|
+
├── Backups
|
|
207
|
+
├── pagila
|
|
208
|
+
│ └── public
|
|
209
|
+
└── Patches
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
You will now be able to manage your package with the `hop` command.
|
|
213
|
+
|
|
214
|
+
## Get the status of your package: *`hop`*
|
|
215
|
+
|
|
216
|
+
```
|
|
217
|
+
$ hop
|
|
218
|
+
STATUS
|
|
219
|
+
|
|
220
|
+
connection_file_name: pagila
|
|
221
|
+
package_name: pagila
|
|
222
|
+
|
|
223
|
+
CURRENT RELEASE: 0.0.0: 2021-09-03 at 11:54:22+02:00
|
|
224
|
+
No new release to apply after 0.0.0.
|
|
225
|
+
Next possible releases: 0.0.1, 0.1.0, 1.0.0.
|
|
226
|
+
hop --help to get help.
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Patch your model: *`hop patch`*
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
$ hop patch
|
|
233
|
+
No new release to apply after 0.0.0.
|
|
234
|
+
Next possible releases: 0.0.1, 0.1.0, 1.0.0.
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
The patch system will try to find a next suitable patch to apply from the
|
|
238
|
+
last release number. If the last patch is X.Y.Z, `hop patch` will try in order
|
|
239
|
+
X.Y.<Z+1>, X.<Y+1>.Z, <X+1>.Y.Z.
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
To prepare a new patch, run `hop patch -p <patch_level>` where patch_level is one
|
|
243
|
+
of ['patch', 'minor', 'major']. The command will create a directory in
|
|
244
|
+
`Patches/X/Y/Z` with a CHANGELOG.md description file. You can add in this
|
|
245
|
+
directory a series of patches scripts.
|
|
246
|
+
The scripts are applied in alphabetical order and can only be of two types:
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
* SQL with .sql extension
|
|
250
|
+
* Python with .py extension
|
|
251
|
+
|
|
252
|
+
If there is a suitable patch to apply, hop will create a branch `hop_<release>`,
|
|
253
|
+
backup the database in `Backups/<dbname>-<release>.sql`, apply the patch and
|
|
254
|
+
update the Python code.
|
|
255
|
+
|
|
256
|
+
In development, you will frequently need to adjust a patch.
|
|
257
|
+
To replay a patch, simply run `hop patch` again.
|
|
258
|
+
|
|
259
|
+
To revert to the previous patch run `hop patch -r`.
|
|
260
|
+
If your git repo is not clean, `hop patch` will complain. You can use `hop patch -f`
|
|
261
|
+
to avoid the warning.
|
|
262
|
+
|
|
263
|
+
You can use git as you wish during this phase.
|
|
264
|
+
## Generate a release (CI): *`hop release`* NotImplented
|
|
265
|
+
|
|
266
|
+
* `hop release -a` for alpha
|
|
267
|
+
* `hop release -c` for release candidate
|
|
268
|
+
* `hop release -p` for production
|
|
269
|
+
|
|
270
|
+
## Test your code
|
|
271
|
+
|
|
272
|
+
Each `hop patch` should test and report any error.
|
|
273
|
+
|
|
274
|
+
The package is test ready. For each module there is a test
|
|
275
|
+
|
|
276
|
+
```
|
|
277
|
+
$ pytest pagila/
|
|
278
|
+
================= test session starts =================
|
|
279
|
+
platform linux -- Python 3.8.5, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
|
|
280
|
+
rootdir: /home/joel/Dev/halfORM_packager/tmp/pagila
|
|
281
|
+
collected 28 items
|
|
282
|
+
|
|
283
|
+
pagila/public/actor_info_test.py . [ 3%]
|
|
284
|
+
pagila/public/actor_test.py . [ 7%]
|
|
285
|
+
pagila/public/address_test.py . [ 10%]
|
|
286
|
+
pagila/public/category_test.py . [ 14%]
|
|
287
|
+
pagila/public/city_test.py . [ 17%]
|
|
288
|
+
pagila/public/country_test.py . [ 21%]
|
|
289
|
+
pagila/public/customer_list_test.py . [ 25%]
|
|
290
|
+
pagila/public/customer_test.py . [ 28%]
|
|
291
|
+
pagila/public/film_actor_test.py . [ 32%]
|
|
292
|
+
pagila/public/film_category_test.py . [ 35%]
|
|
293
|
+
pagila/public/film_list_test.py . [ 39%]
|
|
294
|
+
pagila/public/film_test.py . [ 42%]
|
|
295
|
+
pagila/public/inventory_test.py . [ 46%]
|
|
296
|
+
pagila/public/language_test.py . [ 50%]
|
|
297
|
+
pagila/public/nicer_but_slower_film_list_test.py . [ 53%]
|
|
298
|
+
[ 53%]
|
|
299
|
+
pagila/public/payment_p2020_01_test.py . [ 57%]
|
|
300
|
+
pagila/public/payment_p2020_02_test.py . [ 60%]
|
|
301
|
+
pagila/public/payment_p2020_03_test.py . [ 64%]
|
|
302
|
+
pagila/public/payment_p2020_04_test.py . [ 67%]
|
|
303
|
+
pagila/public/payment_p2020_05_test.py . [ 71%]
|
|
304
|
+
pagila/public/payment_p2020_06_test.py . [ 75%]
|
|
305
|
+
pagila/public/payment_test.py . [ 78%]
|
|
306
|
+
pagila/public/rental_test.py . [ 82%]
|
|
307
|
+
pagila/public/sales_by_film_category_test.py . [ 85%]
|
|
308
|
+
pagila/public/sales_by_store_test.py . [ 89%]
|
|
309
|
+
pagila/public/staff_list_test.py . [ 92%]
|
|
310
|
+
pagila/public/staff_test.py . [ 96%]
|
|
311
|
+
pagila/public/store_test.py . [100%]
|
|
312
|
+
|
|
313
|
+
================= 28 passed in 0.18s ==================
|
|
314
|
+
```
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
# halfORM packager (early alpha stage)
|
|
2
|
+
|
|
3
|
+
> **📢 Project Evolution Notice**
|
|
4
|
+
>
|
|
5
|
+
> **halfORM_dev is being redesigned to integrate with halfORM 0.16's new extension system.**
|
|
6
|
+
>
|
|
7
|
+
> This project will be refactored as `half-orm-dev` to provide development tools through the unified `half_orm` CLI interface. The core functionality (project management, database patches, code generation) will remain the same, but the integration and command structure will be modernized.
|
|
8
|
+
>
|
|
9
|
+
> **Current Status:**
|
|
10
|
+
> - halfORM core 0.16 with extension is about to be released
|
|
11
|
+
> - halfORM_dev refactoring will start soon
|
|
12
|
+
> - New `half-orm-dev` extension planned for Q3 2025
|
|
13
|
+
>
|
|
14
|
+
> **What's Changing:**
|
|
15
|
+
> - Commands will integrate with `half_orm dev` instead of standalone `hop`
|
|
16
|
+
> - Extension auto-discovery and security model
|
|
17
|
+
> - Simplified installation and configuration
|
|
18
|
+
> - Consistent CLI experience across all halfORM tools
|
|
19
|
+
>
|
|
20
|
+
> **For Current Users:**
|
|
21
|
+
> The existing halfORM_dev will continue to work as-is. The new extension will provide a migration path when ready.
|
|
22
|
+
>
|
|
23
|
+
> **Stay Updated:**
|
|
24
|
+
> Follow progress in [halfORM Discussions](https://github.com/collorg/halfORM/discussions) and [halfORM Issues](https://github.com/collorg/halfORM/issues).
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
THIS DOC IS A WORK IN PROGRESS...
|
|
29
|
+
|
|
30
|
+
This package allows you to patch/test a PostgreSQL model and its associated
|
|
31
|
+
Python code using the `hop` command.
|
|
32
|
+
|
|
33
|
+
It is based on the [half_orm](https://github.com/collorg/halfORM)
|
|
34
|
+
PostgreSQL → Python relation object mapper.
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
Run `pip install half_orm_dev`.
|
|
40
|
+
|
|
41
|
+
## help
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
$ hop --help
|
|
45
|
+
Usage: hop [OPTIONS] COMMAND [ARGS]...
|
|
46
|
+
|
|
47
|
+
Generates/Synchronises/Patches a python package from a PostgreSQL database
|
|
48
|
+
|
|
49
|
+
Options:
|
|
50
|
+
-v, --version
|
|
51
|
+
--help Show this message and exit.
|
|
52
|
+
|
|
53
|
+
Commands:
|
|
54
|
+
new Creates a new hop project named <package_name>.
|
|
55
|
+
patch Applies the next patch
|
|
56
|
+
test Tests some common pitfalls.
|
|
57
|
+
update Updates the Python code with the changes made to the model.
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Create a new package for your database: *`hop new`*
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
hop new <package name>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**WARNING!** The `hop new` command will add to your database
|
|
67
|
+
two new schemas: `half_orm_meta` and "`half_orm_meta.view`".
|
|
68
|
+
The table `half_orm_meta.release` will containt the patch history
|
|
69
|
+
of your model (see `hop patch` bellow).
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
$ hop new pagila
|
|
74
|
+
HALFORM_CONF_DIR: /home/joel/.halform
|
|
75
|
+
Using '/home/joel/.halform/pagila' file for connexion.
|
|
76
|
+
Initializing git with a 'main' branch.
|
|
77
|
+
Initializing the patch system for the 'pagila' database.
|
|
78
|
+
Patch system initialized at release '0.0.0'.
|
|
79
|
+
|
|
80
|
+
The hop project 'pagila' has been created.
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The tree command shows you the repartition of the modules in your package.
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
$ tree pagila
|
|
87
|
+
pagila
|
|
88
|
+
├── Backups
|
|
89
|
+
│ └── pagila-pre-patch.sql
|
|
90
|
+
├── pagila
|
|
91
|
+
│ ├── base_test.py
|
|
92
|
+
│ ├── db_connector.py
|
|
93
|
+
│ ├── __init__.py
|
|
94
|
+
│ └── public
|
|
95
|
+
│ ├── actor_info.py
|
|
96
|
+
│ ├── actor_info_test.py
|
|
97
|
+
│ ├── actor.py
|
|
98
|
+
│ ├── actor_test.py
|
|
99
|
+
│ ├── address.py
|
|
100
|
+
│ ├── address_test.py
|
|
101
|
+
│ ├── category.py
|
|
102
|
+
│ ├── category_test.py
|
|
103
|
+
│ ├── city.py
|
|
104
|
+
│ ├── city_test.py
|
|
105
|
+
│ ├── country.py
|
|
106
|
+
│ ├── country_test.py
|
|
107
|
+
│ ├── customer_list.py
|
|
108
|
+
│ ├── customer_list_test.py
|
|
109
|
+
│ ├── customer.py
|
|
110
|
+
│ ├── customer_test.py
|
|
111
|
+
│ ├── film_actor.py
|
|
112
|
+
│ ├── film_actor_test.py
|
|
113
|
+
│ ├── film_category.py
|
|
114
|
+
│ ├── film_category_test.py
|
|
115
|
+
│ ├── film_list.py
|
|
116
|
+
│ ├── film_list_test.py
|
|
117
|
+
│ ├── film.py
|
|
118
|
+
│ ├── film_test.py
|
|
119
|
+
│ ├── __init__.py
|
|
120
|
+
│ ├── inventory.py
|
|
121
|
+
│ ├── inventory_test.py
|
|
122
|
+
│ ├── language.py
|
|
123
|
+
│ ├── language_test.py
|
|
124
|
+
│ ├── nicer_but_slower_film_list.py
|
|
125
|
+
│ ├── nicer_but_slower_film_list_test.py
|
|
126
|
+
│ ├── payment_p2020_01.py
|
|
127
|
+
│ ├── payment_p2020_01_test.py
|
|
128
|
+
│ ├── payment_p2020_02.py
|
|
129
|
+
│ ├── payment_p2020_02_test.py
|
|
130
|
+
│ ├── payment_p2020_03.py
|
|
131
|
+
│ ├── payment_p2020_03_test.py
|
|
132
|
+
│ ├── payment_p2020_04.py
|
|
133
|
+
│ ├── payment_p2020_04_test.py
|
|
134
|
+
│ ├── payment_p2020_05.py
|
|
135
|
+
│ ├── payment_p2020_05_test.py
|
|
136
|
+
│ ├── payment_p2020_06.py
|
|
137
|
+
│ ├── payment_p2020_06_test.py
|
|
138
|
+
│ ├── payment.py
|
|
139
|
+
│ ├── payment_test.py
|
|
140
|
+
│ ├── rental.py
|
|
141
|
+
│ ├── rental_test.py
|
|
142
|
+
│ ├── sales_by_film_category.py
|
|
143
|
+
│ ├── sales_by_film_category_test.py
|
|
144
|
+
│ ├── sales_by_store.py
|
|
145
|
+
│ ├── sales_by_store_test.py
|
|
146
|
+
│ ├── staff_list.py
|
|
147
|
+
│ ├── staff_list_test.py
|
|
148
|
+
│ ├── staff.py
|
|
149
|
+
│ ├── staff_test.py
|
|
150
|
+
│ ├── store.py
|
|
151
|
+
│ └── store_test.py
|
|
152
|
+
├── Patches
|
|
153
|
+
│ └── README
|
|
154
|
+
├── Pipfile
|
|
155
|
+
├── README.md
|
|
156
|
+
└── setup.py
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Once created, go to the newly created directory
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
cd pagila
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## The organisation
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
$ tree -d
|
|
169
|
+
.
|
|
170
|
+
├── Backups
|
|
171
|
+
├── pagila
|
|
172
|
+
│ └── public
|
|
173
|
+
└── Patches
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
You will now be able to manage your package with the `hop` command.
|
|
177
|
+
|
|
178
|
+
## Get the status of your package: *`hop`*
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
$ hop
|
|
182
|
+
STATUS
|
|
183
|
+
|
|
184
|
+
connection_file_name: pagila
|
|
185
|
+
package_name: pagila
|
|
186
|
+
|
|
187
|
+
CURRENT RELEASE: 0.0.0: 2021-09-03 at 11:54:22+02:00
|
|
188
|
+
No new release to apply after 0.0.0.
|
|
189
|
+
Next possible releases: 0.0.1, 0.1.0, 1.0.0.
|
|
190
|
+
hop --help to get help.
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Patch your model: *`hop patch`*
|
|
194
|
+
|
|
195
|
+
```
|
|
196
|
+
$ hop patch
|
|
197
|
+
No new release to apply after 0.0.0.
|
|
198
|
+
Next possible releases: 0.0.1, 0.1.0, 1.0.0.
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
The patch system will try to find a next suitable patch to apply from the
|
|
202
|
+
last release number. If the last patch is X.Y.Z, `hop patch` will try in order
|
|
203
|
+
X.Y.<Z+1>, X.<Y+1>.Z, <X+1>.Y.Z.
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
To prepare a new patch, run `hop patch -p <patch_level>` where patch_level is one
|
|
207
|
+
of ['patch', 'minor', 'major']. The command will create a directory in
|
|
208
|
+
`Patches/X/Y/Z` with a CHANGELOG.md description file. You can add in this
|
|
209
|
+
directory a series of patches scripts.
|
|
210
|
+
The scripts are applied in alphabetical order and can only be of two types:
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
* SQL with .sql extension
|
|
214
|
+
* Python with .py extension
|
|
215
|
+
|
|
216
|
+
If there is a suitable patch to apply, hop will create a branch `hop_<release>`,
|
|
217
|
+
backup the database in `Backups/<dbname>-<release>.sql`, apply the patch and
|
|
218
|
+
update the Python code.
|
|
219
|
+
|
|
220
|
+
In development, you will frequently need to adjust a patch.
|
|
221
|
+
To replay a patch, simply run `hop patch` again.
|
|
222
|
+
|
|
223
|
+
To revert to the previous patch run `hop patch -r`.
|
|
224
|
+
If your git repo is not clean, `hop patch` will complain. You can use `hop patch -f`
|
|
225
|
+
to avoid the warning.
|
|
226
|
+
|
|
227
|
+
You can use git as you wish during this phase.
|
|
228
|
+
## Generate a release (CI): *`hop release`* NotImplented
|
|
229
|
+
|
|
230
|
+
* `hop release -a` for alpha
|
|
231
|
+
* `hop release -c` for release candidate
|
|
232
|
+
* `hop release -p` for production
|
|
233
|
+
|
|
234
|
+
## Test your code
|
|
235
|
+
|
|
236
|
+
Each `hop patch` should test and report any error.
|
|
237
|
+
|
|
238
|
+
The package is test ready. For each module there is a test
|
|
239
|
+
|
|
240
|
+
```
|
|
241
|
+
$ pytest pagila/
|
|
242
|
+
================= test session starts =================
|
|
243
|
+
platform linux -- Python 3.8.5, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
|
|
244
|
+
rootdir: /home/joel/Dev/halfORM_packager/tmp/pagila
|
|
245
|
+
collected 28 items
|
|
246
|
+
|
|
247
|
+
pagila/public/actor_info_test.py . [ 3%]
|
|
248
|
+
pagila/public/actor_test.py . [ 7%]
|
|
249
|
+
pagila/public/address_test.py . [ 10%]
|
|
250
|
+
pagila/public/category_test.py . [ 14%]
|
|
251
|
+
pagila/public/city_test.py . [ 17%]
|
|
252
|
+
pagila/public/country_test.py . [ 21%]
|
|
253
|
+
pagila/public/customer_list_test.py . [ 25%]
|
|
254
|
+
pagila/public/customer_test.py . [ 28%]
|
|
255
|
+
pagila/public/film_actor_test.py . [ 32%]
|
|
256
|
+
pagila/public/film_category_test.py . [ 35%]
|
|
257
|
+
pagila/public/film_list_test.py . [ 39%]
|
|
258
|
+
pagila/public/film_test.py . [ 42%]
|
|
259
|
+
pagila/public/inventory_test.py . [ 46%]
|
|
260
|
+
pagila/public/language_test.py . [ 50%]
|
|
261
|
+
pagila/public/nicer_but_slower_film_list_test.py . [ 53%]
|
|
262
|
+
[ 53%]
|
|
263
|
+
pagila/public/payment_p2020_01_test.py . [ 57%]
|
|
264
|
+
pagila/public/payment_p2020_02_test.py . [ 60%]
|
|
265
|
+
pagila/public/payment_p2020_03_test.py . [ 64%]
|
|
266
|
+
pagila/public/payment_p2020_04_test.py . [ 67%]
|
|
267
|
+
pagila/public/payment_p2020_05_test.py . [ 71%]
|
|
268
|
+
pagila/public/payment_p2020_06_test.py . [ 75%]
|
|
269
|
+
pagila/public/payment_test.py . [ 78%]
|
|
270
|
+
pagila/public/rental_test.py . [ 82%]
|
|
271
|
+
pagila/public/sales_by_film_category_test.py . [ 85%]
|
|
272
|
+
pagila/public/sales_by_store_test.py . [ 89%]
|
|
273
|
+
pagila/public/staff_list_test.py . [ 92%]
|
|
274
|
+
pagila/public/staff_test.py . [ 96%]
|
|
275
|
+
pagila/public/store_test.py . [100%]
|
|
276
|
+
|
|
277
|
+
================= 28 passed in 0.18s ==================
|
|
278
|
+
```
|
|
File without changes
|