half-orm-dev 0.17.0a2__tar.gz → 0.17.0a4__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.
Files changed (65) hide show
  1. {half_orm_dev-0.17.0a2/half_orm_dev.egg-info → half_orm_dev-0.17.0a4}/PKG-INFO +1 -1
  2. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/release_manager.py +45 -3
  3. half_orm_dev-0.17.0a4/half_orm_dev/templates/git-hooks/pre-commit +100 -0
  4. half_orm_dev-0.17.0a4/half_orm_dev/templates/git-hooks/prepare-commit-msg +37 -0
  5. half_orm_dev-0.17.0a4/half_orm_dev/version.txt +1 -0
  6. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4/half_orm_dev.egg-info}/PKG-INFO +1 -1
  7. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev.egg-info/SOURCES.txt +2 -0
  8. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/setup.py +1 -1
  9. half_orm_dev-0.17.0a2/half_orm_dev/version.txt +0 -1
  10. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/AUTHORS +0 -0
  11. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/LICENSE +0 -0
  12. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/README.md +0 -0
  13. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/__init__.py +0 -0
  14. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/cli/__init__.py +0 -0
  15. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/cli/commands/__init__.py +0 -0
  16. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/cli/commands/apply.py +0 -0
  17. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/cli/commands/check.py +0 -0
  18. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/cli/commands/clone.py +0 -0
  19. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/cli/commands/init.py +0 -0
  20. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/cli/commands/new.py +0 -0
  21. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/cli/commands/patch.py +0 -0
  22. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/cli/commands/release.py +0 -0
  23. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/cli/commands/restore.py +0 -0
  24. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/cli/commands/sync.py +0 -0
  25. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/cli/commands/todo.py +0 -0
  26. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/cli/commands/undo.py +0 -0
  27. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/cli/commands/update.py +0 -0
  28. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/cli/commands/upgrade.py +0 -0
  29. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/cli/main.py +0 -0
  30. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/cli_extension.py +0 -0
  31. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/database.py +0 -0
  32. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/decorators.py +0 -0
  33. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/hgit.py +0 -0
  34. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/hop.py +0 -0
  35. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/manifest.py +0 -0
  36. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/modules.py +0 -0
  37. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/patch.py +0 -0
  38. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/patch_manager.py +0 -0
  39. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/patch_validator.py +0 -0
  40. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/patches/0/1/0/00_half_orm_meta.database.sql +0 -0
  41. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/patches/0/1/0/01_alter_half_orm_meta.hop_release.sql +0 -0
  42. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/patches/0/1/0/02_half_orm_meta.view.hop_penultimate_release.sql +0 -0
  43. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/patches/log +0 -0
  44. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/patches/sql/half_orm_meta.sql +0 -0
  45. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/repo.py +0 -0
  46. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/templates/.gitignore +0 -0
  47. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/templates/MANIFEST.in +0 -0
  48. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/templates/Pipfile +0 -0
  49. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/templates/README +0 -0
  50. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/templates/conftest_template +0 -0
  51. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/templates/init_module_template +0 -0
  52. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/templates/module_template_1 +0 -0
  53. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/templates/module_template_2 +0 -0
  54. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/templates/module_template_3 +0 -0
  55. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/templates/relation_test +0 -0
  56. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/templates/setup.py +0 -0
  57. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/templates/sql_adapter +0 -0
  58. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/templates/warning +0 -0
  59. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev/utils.py +0 -0
  60. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev.egg-info/dependency_links.txt +0 -0
  61. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev.egg-info/requires.txt +0 -0
  62. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/half_orm_dev.egg-info/top_level.txt +0 -0
  63. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/setup.cfg +0 -0
  64. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/tests/__init__.py +0 -0
  65. {half_orm_dev-0.17.0a2 → half_orm_dev-0.17.0a4}/tests/conftest.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: half_orm_dev
3
- Version: 0.17.0a2
3
+ Version: 0.17.0a4
4
4
  Summary: half_orm development Framework.
5
5
  Home-page: https://github.com/collorg/halfORM_dev
6
6
  Author: Joël Maïzi
@@ -2520,10 +2520,26 @@ class ReleaseManager:
2520
2520
  rc_tag = f"v{version}-rc{rc_number}" # Use v prefix and rc1 for first RC
2521
2521
 
2522
2522
  try:
2523
- # Checkout release branch
2523
+ # 1. Apply patches to database (for validation)
2524
+ # 1.1. Restore database from baseline
2525
+ self._repo.restore_database_from_schema()
2526
+
2527
+ # 1.2. Apply all previous RC patches in order
2528
+ rc_files = self.get_rc_files(version)
2529
+ for rc_file_name in rc_files:
2530
+ rc_patches = self.read_release_patches(rc_file_name)
2531
+ for patch_id in rc_patches:
2532
+ self._repo.patch_manager.apply_patch_files(patch_id, self._repo.model)
2533
+
2534
+ # 1.3. Apply stage patches
2535
+ stage_patches = self.read_release_patches(f"{version}-stage.txt")
2536
+ for patch_id in stage_patches:
2537
+ self._repo.patch_manager.apply_patch_files(patch_id, self._repo.model)
2538
+
2539
+ # 2. Checkout release branch
2524
2540
  self._repo.hgit.checkout(release_branch)
2525
2541
 
2526
- # Create RC tag on release branch
2542
+ # 3. Create RC tag on release branch
2527
2543
  self._repo.hgit.create_tag(rc_tag, f"Release Candidate {version}")
2528
2544
 
2529
2545
  # Push tag
@@ -2630,7 +2646,33 @@ class ReleaseManager:
2630
2646
  "ho-prod has been restored to its previous state."
2631
2647
  )
2632
2648
 
2633
- # 3. Rename rc file to prod
2649
+ # 3. Apply patches and generate schema
2650
+ # 3.1. Restore database from baseline
2651
+ self._repo.restore_database_from_schema()
2652
+
2653
+ # 3.2. Apply all RC patches in order
2654
+ rc_files = self.get_rc_files(version)
2655
+ for rc_file in rc_files:
2656
+ rc_patches = self.read_release_patches(rc_file)
2657
+ for patch_id in rc_patches:
2658
+ self._repo.patch_manager.apply_patch_files(patch_id, self._repo.model)
2659
+
2660
+ # 3.3. Apply stage patches (before renaming to prod)
2661
+ stage_patches = self.read_release_patches(f"{version}-stage.txt")
2662
+ for patch_id in stage_patches:
2663
+ self._repo.patch_manager.apply_patch_files(patch_id, self._repo.model)
2664
+
2665
+ # 3.4. Generate schema dump for this version
2666
+ from pathlib import Path
2667
+ model_dir = Path(self._repo.base_dir) / "model"
2668
+ self._repo.database._generate_schema_sql(version, model_dir)
2669
+
2670
+ # 3.5. Commit schema files
2671
+ self._repo.hgit.add(str(model_dir / f"schema-{version}.sql"))
2672
+ self._repo.hgit.add(str(model_dir / f"metadata-{version}.sql"))
2673
+ self._repo.hgit.add(str(model_dir / "schema.sql")) # symlink
2674
+
2675
+ # 4. Rename stage file to prod
2634
2676
  prod_file = self._releases_dir / f"{version}.txt"
2635
2677
  stage_file.rename(prod_file)
2636
2678
  self._repo.hgit.add(str(stage_file)) # Old path
@@ -0,0 +1,100 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Half-ORM pre-commit hook
4
+ # 1. Checks if current ho-* branch exists on remote origin
5
+ # 2. Protects ho-prod branch from direct commits
6
+ # Generated by half_orm_dev
7
+
8
+ # Get current branch
9
+ CURRENT_BRANCH=$(git symbolic-ref --short HEAD 2>/dev/null)
10
+
11
+ # Check if current ho-* branch (except ho-prod) still exists on remote origin
12
+ # This prevents committing to ho-* branches that were deleted remotely
13
+ if [[ "$CURRENT_BRANCH" == ho-* ]] && [ "$CURRENT_BRANCH" != "ho-prod" ]; then
14
+ # Fetch remote refs quietly (only updates remote tracking, doesn't modify local branches)
15
+ git fetch origin --prune --quiet 2>/dev/null || true
16
+
17
+ # Check if branch exists on remote
18
+ if ! git show-ref --verify --quiet "refs/remotes/origin/$CURRENT_BRANCH"; then
19
+ cat << EOF
20
+ ❌ Branch '$CURRENT_BRANCH' no longer exists on remote origin
21
+
22
+ This Half-ORM branch was deleted on the remote repository (likely cleaned up
23
+ after a release promotion). You cannot commit to a branch that doesn't exist
24
+ remotely.
25
+
26
+ Common causes:
27
+ • ho-release/<version>/<patch_id> branches are deleted after promotion to prod
28
+ • ho-patch/<patch_id> branches are renamed to ho-release/<version>/<patch_id> after integration
29
+ • Branch was manually deleted by another team member
30
+
31
+ What to do:
32
+ 1. Save your changes if needed:
33
+ $ git stash
34
+
35
+ 2. Switch to ho-prod:
36
+ $ git checkout ho-prod
37
+
38
+ 3. Delete this stale local branch:
39
+ $ git branch -D $CURRENT_BRANCH
40
+
41
+ 4. Create a new patch and restore your changes if you stashed them:
42
+ $ git stash pop
43
+
44
+ For more information about branch lifecycle, see Half-ORM documentation.
45
+
46
+ EOF
47
+ exit 1
48
+ fi
49
+ fi
50
+
51
+ # Check if we're on ho-prod branch
52
+ if [ "$CURRENT_BRANCH" != "ho-prod" ]; then
53
+ # Not on ho-prod, allow commit
54
+ exit 0
55
+ fi
56
+
57
+ # Check if this is a temporary validation tag commit (allows automated promotion)
58
+ CURRENT_TAG=$(git describe --exact-match --tags HEAD 2>/dev/null | grep -E '^temp-valid-')
59
+
60
+ if [ -n "$CURRENT_TAG" ]; then
61
+ # This is an automated promotion commit with temp tag, allow it
62
+ exit 0
63
+ fi
64
+
65
+ # Check if there's an active lock on ho-prod
66
+ # Lock tags follow pattern: lock-ho-prod-{timestamp}
67
+ LOCK_TAG=$(git tag -l 'lock-ho-prod-*' 2>/dev/null | head -n 1)
68
+
69
+ if [ -n "$LOCK_TAG" ]; then
70
+ # Lock is active, allow commit from Half-ORM workflow
71
+ exit 0
72
+ fi
73
+
74
+ # Direct commit on ho-prod is not allowed
75
+ cat << 'EOF'
76
+ ❌ Direct commits on 'ho-prod' are not allowed
77
+
78
+ The ho-prod branch is a protected production branch. Changes must be
79
+ promoted through the official Half-ORM release workflow.
80
+
81
+ To create a patch:
82
+ $ half_orm dev patch new <patch_id>
83
+
84
+ To add a patch to a release:
85
+ $ half_orm dev patch <patch_id> add-to-release [release]
86
+
87
+ To promote a stage release to rc/production:
88
+ $ half_orm dev release promote <rc|prod>
89
+
90
+ This workflow ensures:
91
+ • All patches are validated and tested
92
+ • Code is properly merged from patch branches
93
+ • Active patch branches are notified to rebase
94
+ • Production deploys are tracked and auditable
95
+
96
+ For more information, see the Half-ORM documentation on release management.
97
+
98
+ EOF
99
+
100
+ exit 1
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Half-ORM prepare-commit-msg hook
4
+ # Automatically appends ticket reference (#N) to commit messages
5
+ # when on ho-patch/{N}-... branches
6
+ # Generated by half_orm_dev
7
+
8
+ COMMIT_MSG_FILE=$1
9
+
10
+ # Get current branch
11
+ CURRENT_BRANCH=$(git symbolic-ref --short HEAD 2>/dev/null)
12
+
13
+ # Check if on ho-patch branch
14
+ if [[ "$CURRENT_BRANCH" == ho-patch/* ]]; then
15
+ # Extract patch_id from ho-patch/{patch_id}
16
+ PATCH_ID="${CURRENT_BRANCH#ho-patch/}"
17
+
18
+ # Extract ticket number (first part before '-')
19
+ TICKET_NUMBER="${PATCH_ID%%-*}"
20
+
21
+ # Remove leading zeros for consistency
22
+ TICKET_NUMBER=$(echo "$TICKET_NUMBER" | sed 's/^0*//')
23
+
24
+ # Handle edge case where ticket is "0" or empty after stripping
25
+ if [ -z "$TICKET_NUMBER" ]; then
26
+ TICKET_NUMBER="0"
27
+ fi
28
+
29
+ # Check if message already contains the reference
30
+ if ! grep -q "#$TICKET_NUMBER\b" "$COMMIT_MSG_FILE"; then
31
+ # Append ticket reference to commit message
32
+ echo "" >> "$COMMIT_MSG_FILE"
33
+ echo "Refs #$TICKET_NUMBER" >> "$COMMIT_MSG_FILE"
34
+ fi
35
+ fi
36
+
37
+ exit 0
@@ -0,0 +1 @@
1
+ 0.17.0-a4
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: half_orm_dev
3
- Version: 0.17.0a2
3
+ Version: 0.17.0a4
4
4
  Summary: half_orm development Framework.
5
5
  Home-page: https://github.com/collorg/halfORM_dev
6
6
  Author: Joël Maïzi
@@ -56,5 +56,7 @@ half_orm_dev/templates/relation_test
56
56
  half_orm_dev/templates/setup.py
57
57
  half_orm_dev/templates/sql_adapter
58
58
  half_orm_dev/templates/warning
59
+ half_orm_dev/templates/git-hooks/pre-commit
60
+ half_orm_dev/templates/git-hooks/prepare-commit-msg
59
61
  tests/__init__.py
60
62
  tests/conftest.py
@@ -44,7 +44,7 @@ setup(
44
44
  license='GNU General Public License v3 (GPLv3)',
45
45
  packages=find_packages(),
46
46
  package_data={'half_orm_dev': [
47
- 'templates/*', 'templates/.gitignore', 'db_patch_system/*', 'patches/**/*', 'version.txt']},
47
+ 'templates/*', 'templates/git-hooks/*', 'templates/.gitignore', 'db_patch_system/*', 'patches/**/*', 'version.txt']},
48
48
  install_requires=[
49
49
  'GitPython',
50
50
  'click',
@@ -1 +0,0 @@
1
- 0.17.0-a2
File without changes
File without changes