half-orm-dev 0.17.2a10__tar.gz → 0.17.3a1__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.2a10/half_orm_dev.egg-info → half_orm_dev-0.17.3a1}/PKG-INFO +2 -2
  2. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/cli/commands/migrate.py +31 -41
  3. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/cli/main.py +3 -19
  4. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/cli_extension.py +2 -2
  5. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/hgit.py +4 -0
  6. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/repo.py +3 -3
  7. half_orm_dev-0.17.3a1/half_orm_dev/version.txt +1 -0
  8. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1/half_orm_dev.egg-info}/PKG-INFO +2 -2
  9. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev.egg-info/requires.txt +1 -1
  10. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/setup.py +22 -4
  11. half_orm_dev-0.17.2a10/half_orm_dev/version.txt +0 -1
  12. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/AUTHORS +0 -0
  13. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/LICENSE +0 -0
  14. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/README.md +0 -0
  15. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/__init__.py +0 -0
  16. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/cli/__init__.py +0 -0
  17. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/cli/commands/__init__.py +0 -0
  18. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/cli/commands/apply.py +0 -0
  19. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/cli/commands/check.py +0 -0
  20. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/cli/commands/clone.py +0 -0
  21. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/cli/commands/init.py +0 -0
  22. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/cli/commands/patch.py +0 -0
  23. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/cli/commands/release.py +0 -0
  24. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/cli/commands/restore.py +0 -0
  25. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/cli/commands/sync.py +0 -0
  26. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/cli/commands/todo.py +0 -0
  27. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/cli/commands/undo.py +0 -0
  28. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/cli/commands/update.py +0 -0
  29. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/cli/commands/upgrade.py +0 -0
  30. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/database.py +0 -0
  31. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/decorators.py +0 -0
  32. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/migration_manager.py +0 -0
  33. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/migrations/0/17/1/00_move_to_hop.py +0 -0
  34. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/migrations/0/17/1/01_txt_to_toml.py +0 -0
  35. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/modules.py +0 -0
  36. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/patch_manager.py +0 -0
  37. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/patch_validator.py +0 -0
  38. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/patches/0/1/0/00_half_orm_meta.database.sql +0 -0
  39. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/patches/0/1/0/01_alter_half_orm_meta.hop_release.sql +0 -0
  40. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/patches/0/1/0/02_half_orm_meta.view.hop_penultimate_release.sql +0 -0
  41. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/patches/log +0 -0
  42. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/patches/sql/half_orm_meta.sql +0 -0
  43. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/release_file.py +0 -0
  44. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/release_manager.py +0 -0
  45. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/templates/.gitignore +0 -0
  46. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/templates/MANIFEST.in +0 -0
  47. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/templates/Pipfile +0 -0
  48. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/templates/README +0 -0
  49. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/templates/conftest_template +0 -0
  50. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/templates/git-hooks/pre-commit +0 -0
  51. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/templates/git-hooks/prepare-commit-msg +0 -0
  52. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/templates/init_module_template +0 -0
  53. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/templates/module_template_1 +0 -0
  54. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/templates/module_template_2 +0 -0
  55. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/templates/module_template_3 +0 -0
  56. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/templates/pyproject.toml +0 -0
  57. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/templates/relation_test +0 -0
  58. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/templates/sql_adapter +0 -0
  59. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/templates/warning +0 -0
  60. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev/utils.py +0 -0
  61. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev.egg-info/SOURCES.txt +0 -0
  62. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev.egg-info/dependency_links.txt +0 -0
  63. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/half_orm_dev.egg-info/top_level.txt +0 -0
  64. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/pyproject.toml +0 -0
  65. {half_orm_dev-0.17.2a10 → half_orm_dev-0.17.3a1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: half_orm_dev
3
- Version: 0.17.2a10
3
+ Version: 0.17.3a1
4
4
  Summary: half_orm development Framework.
5
5
  Author-email: Joël Maïzi <joel.maizi@collorg.org>
6
6
  License-Expression: GPL-3.0-or-later
@@ -23,7 +23,7 @@ Requires-Dist: GitPython
23
23
  Requires-Dist: click
24
24
  Requires-Dist: pydash
25
25
  Requires-Dist: pytest
26
- Requires-Dist: half_orm<0.18.0,>=0.17.0
26
+ Requires-Dist: half_orm<0.18.0,>=0.17.1
27
27
  Requires-Dist: tomli>=2.0.0; python_version < "3.11"
28
28
  Requires-Dist: tomli_w>=1.0.0
29
29
  Dynamic: license-file
@@ -27,6 +27,7 @@ def migrate(verbose: bool) -> None:
27
27
  • Must be on ho-prod branch
28
28
  • Repository must be clean (no uncommitted changes)
29
29
 
30
+ \b
30
31
  Process:
31
32
  1. Detects version mismatch between installed half_orm_dev and repository
32
33
  2. Applies any migration scripts for intermediate versions
@@ -34,6 +35,7 @@ def migrate(verbose: bool) -> None:
34
35
  4. Creates migration commit on ho-prod
35
36
  5. Syncs .hop/ directory to all active branches
36
37
 
38
+ \b
37
39
  Examples:
38
40
  # After upgrading half_orm_dev
39
41
  $ pip install --upgrade half_orm_dev
@@ -41,11 +43,13 @@ def migrate(verbose: bool) -> None:
41
43
  ⚠️ Migration needed: half_orm_dev 0.17.2 → 0.18.0
42
44
  Current branch: ho-prod
43
45
 
46
+ \b
44
47
  Running migrations...
45
48
  ✓ Applied migration: 0.17.2 → 0.18.0
46
49
  ✓ Updated .hop/config: hop_version = 0.18.0
47
50
  ✓ Synced .hop/ to active branches
48
51
 
52
+ \b
49
53
  # View detailed migration info
50
54
  $ half_orm dev migrate --verbose
51
55
  """
@@ -62,25 +66,6 @@ def migrate(verbose: bool) -> None:
62
66
  installed_version = hop_version()
63
67
  config_version = repo._Repo__config.hop_version if hasattr(repo, '_Repo__config') else '0.0.0'
64
68
 
65
- # Check if migration is needed
66
- comparison = repo.compare_versions(installed_version, config_version)
67
-
68
- if comparison == 0:
69
- # Versions are equal - no migration needed
70
- click.echo(f"✓ {utils.Color.green('Repository is up to date')}")
71
- click.echo(f" Repository version: {config_version}")
72
- click.echo(f" Installed version: {installed_version}")
73
- return
74
-
75
- elif comparison < 0:
76
- # Installed version is OLDER than repository version
77
- click.echo(f"⚠️ {utils.Color.red('Installed half_orm_dev is older than repository version')}", err=True)
78
- click.echo(f"\n Repository version: {config_version}", err=True)
79
- click.echo(f" Installed version: {installed_version}", err=True)
80
- click.echo(f"\n Please upgrade half_orm_dev:", err=True)
81
- click.echo(f" pip install --upgrade half_orm_dev\n", err=True)
82
- raise click.Abort()
83
-
84
69
  # Migration needed (comparison > 0)
85
70
  click.echo(f"⚠️ {utils.Color.bold('Migration needed:')}")
86
71
  click.echo(f" half_orm_dev {config_version} → {installed_version}")
@@ -90,29 +75,34 @@ def migrate(verbose: bool) -> None:
90
75
  click.echo(f" Current branch: {current_branch}")
91
76
  click.echo()
92
77
 
93
- # Run migrations
94
- click.echo(f" Running migrations...")
95
-
96
- try:
97
- result = repo.run_migrations_if_needed(silent=False)
98
-
99
- if result['migration_run']:
100
- click.echo(f"\n✓ {utils.Color.green('Migration completed successfully')}")
101
- click.echo(f" Updated .hop/config: hop_version = {installed_version}")
102
78
 
103
- if verbose and result.get('errors'):
104
- click.echo(f"\n⚠️ Warnings during migration:")
105
- for error in result['errors']:
106
- click.echo(f" {error}")
107
-
108
- click.echo(f"\n✓ Synced .hop/ to active branches")
109
- else:
110
- click.echo(f" {utils.Color.green('Repository is up to date')}")
111
-
112
- except RepoError as e:
113
- # Migration failed or branch check failed
114
- click.echo(utils.Color.red(f"\n❌ {e}"), err=True)
115
- raise click.Abort()
79
+ # Run migrations
80
+ if not click.confirm("Do you want to proceed?", default=False):
81
+ click.echo()
82
+ click.echo("If you want to revert half_orm_dev run:")
83
+ click.echo(f" pip install half-orm-dev=={config_version}")
84
+ else:
85
+ try:
86
+ click.echo(f" Running migrations...")
87
+ result = repo.run_migrations_if_needed(silent=False)
88
+
89
+ if result['migration_run']:
90
+ click.echo(f"\n✓ {utils.Color.green('Migration completed successfully')}")
91
+ click.echo(f" Updated .hop/config: hop_version = {installed_version}")
92
+
93
+ if verbose and result.get('errors'):
94
+ click.echo(f"\n⚠️ Warnings during migration:")
95
+ for error in result['errors']:
96
+ click.echo(f" • {error}")
97
+
98
+ click.echo(f"\n✓ Synced .hop/ to active branches")
99
+ else:
100
+ click.echo(f"✓ {utils.Color.green('Repository is up to date')}")
101
+
102
+ except RepoError as e:
103
+ # Migration failed or branch check failed
104
+ click.echo(utils.Color.red(f"\n❌ {e}"), err=True)
105
+ raise click.Abort()
116
106
 
117
107
  except RepoError as e:
118
108
  click.echo(utils.Color.red(f"❌ Error: {e}"), err=True)
@@ -4,6 +4,7 @@ Main CLI module - Creates and configures the CLI group
4
4
 
5
5
  import click
6
6
  import functools
7
+ import sys
7
8
  from half_orm_dev.repo import Repo, OutdatedHalfORMDevError
8
9
  from half_orm import utils
9
10
  from .commands import ALL_COMMANDS
@@ -118,8 +119,9 @@ def create_cli_group():
118
119
  click.echo(f"\n Your installed version is OLDER than the repository requirement.", err=True)
119
120
  click.echo(f" All commands are blocked for safety.", err=True)
120
121
  click.echo(f"\n Please upgrade half_orm_dev:", err=True)
121
- click.echo(f" {utils.Color.bold('pip install --upgrade half_orm_dev')}", err=True)
122
+ click.echo(f" {utils.Color.bold(f'pip install --upgrade half_orm_dev=={error.required_version}')}", err=True)
122
123
  click.echo("\n" + "=" * 70 + "\n", err=True)
124
+ sys.exit(1)
123
125
  raise click.Abort()
124
126
  return f(*args, **kwargs)
125
127
  return wrapper
@@ -132,24 +134,6 @@ def create_cli_group():
132
134
  cmd.callback = check_version_before_invoke(cmd.callback)
133
135
  super().add_command(cmd, name)
134
136
 
135
- def resolve_command(self, ctx, args):
136
- """Override to show available commands when command not found."""
137
- try:
138
- return super().resolve_command(ctx, args)
139
- except click.UsageError as e:
140
- if 'No such command' in str(e):
141
- # Command not found - show available commands
142
- click.echo(f"\n❌ {str(e)}", err=True)
143
- click.echo(f"\n{utils.Color.bold('Available commands:')}")
144
- for cmd_name in hop.available_commands:
145
- cmd = self.commands.get(cmd_name)
146
- if cmd:
147
- help_text = cmd.help or cmd.short_help or ""
148
- first_line = help_text.split('\n')[0] if help_text else ""
149
- click.echo(f" • {utils.Color.bold(cmd_name)}: {first_line}")
150
- click.echo(f"\nTry {utils.Color.bold('half_orm dev <command> --help')} for more information.\n")
151
- raise
152
-
153
137
  @click.group(cls=VersionCheckGroup, invoke_without_command=True)
154
138
  @click.pass_context
155
139
  @check_version_before_invoke
@@ -9,7 +9,7 @@ Generates/Patches/Synchronizes a hop Python package with a PostgreSQL database.
9
9
  """
10
10
 
11
11
  import sys
12
- from half_orm.cli_utils import create_and_register_extension
12
+ from half_orm.cli import CustomGroup
13
13
  from .cli import create_cli_group
14
14
 
15
15
 
@@ -25,7 +25,7 @@ def add_commands(main_group):
25
25
  dev_group = create_cli_group()
26
26
 
27
27
  # Register it as an extension
28
- @create_and_register_extension(main_group, sys.modules[__name__])
28
+ @main_group.group(name='dev', cls=CustomGroup)
29
29
  def dev():
30
30
  """halfORM development tools - project management, patches, and database synchronization"""
31
31
  pass
@@ -113,6 +113,10 @@ class HGit:
113
113
  f'Something went wrong initializing git repo in {base_dir}\n{err}\n', exit_code=1)
114
114
  return self
115
115
 
116
+ @property
117
+ def git_repo(self):
118
+ return self.__git_repo
119
+
116
120
  @property
117
121
  def branch(self):
118
122
  "Returns the active branch"
@@ -452,7 +452,7 @@ class Repo:
452
452
 
453
453
  if not self.hgit or self.hgit.branch != 'ho-prod':
454
454
  # Check if working directory is clean
455
- if self.hgit and self.hgit.repo.is_dirty(untracked_files=False):
455
+ if self.hgit and self.hgit.git_repo.is_dirty(untracked_files=False):
456
456
  config_version = self.__config.hop_version if hasattr(self, '_Repo__config') else '0.0.0'
457
457
  raise RepoError(
458
458
  f"Repository migration required but working directory has uncommitted changes.\n\n"
@@ -761,7 +761,7 @@ class Repo:
761
761
  current_branch = None
762
762
  git_repo = None
763
763
  try:
764
- git_repo = self.hgit.repo
764
+ git_repo = self.hgit.git_repo
765
765
  current_branch = git_repo.active_branch.name
766
766
 
767
767
  # Check if working directory is clean
@@ -1429,7 +1429,7 @@ class Repo:
1429
1429
  current_branch = None
1430
1430
  git_repo = None
1431
1431
  try:
1432
- git_repo = self.hgit.repo
1432
+ git_repo = self.hgit.git_repo
1433
1433
  current_branch = git_repo.active_branch.name
1434
1434
 
1435
1435
  # Check if working directory is clean (only in non-silent mode)
@@ -0,0 +1 @@
1
+ 0.17.3-a1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: half_orm_dev
3
- Version: 0.17.2a10
3
+ Version: 0.17.3a1
4
4
  Summary: half_orm development Framework.
5
5
  Author-email: Joël Maïzi <joel.maizi@collorg.org>
6
6
  License-Expression: GPL-3.0-or-later
@@ -23,7 +23,7 @@ Requires-Dist: GitPython
23
23
  Requires-Dist: click
24
24
  Requires-Dist: pydash
25
25
  Requires-Dist: pytest
26
- Requires-Dist: half_orm<0.18.0,>=0.17.0
26
+ Requires-Dist: half_orm<0.18.0,>=0.17.1
27
27
  Requires-Dist: tomli>=2.0.0; python_version < "3.11"
28
28
  Requires-Dist: tomli_w>=1.0.0
29
29
  Dynamic: license-file
@@ -2,7 +2,7 @@ GitPython
2
2
  click
3
3
  pydash
4
4
  pytest
5
- half_orm<0.18.0,>=0.17.0
5
+ half_orm<0.18.0,>=0.17.1
6
6
  tomli_w>=1.0.0
7
7
 
8
8
  [:python_version < "3.11"]
@@ -11,11 +11,21 @@ from pathlib import Path
11
11
  from setuptools import setup
12
12
 
13
13
 
14
+ # Special minimum version requirements for half_orm
15
+ # List of (major, minor, min_patch, max_patch, required_half_orm_version)
16
+ # Example: (0, 17, 3, 5, '0.17.1') means:
17
+ # for half_orm_dev 0.17.x where 3 <= x < 5, require half_orm >= 0.17.1
18
+ HALF_ORM_MIN_VERSIONS = [
19
+ (0, 17, 3, None, '0.17.1'), # 0.17.3+ requires half_orm >= 0.17.1 (CustomGroup support)
20
+ ]
21
+
22
+
14
23
  def get_half_orm_version_constraint():
15
24
  """
16
25
  Calculate half_orm version constraint from half_orm_dev version.
17
26
 
18
- For version X.Y.Z[-xxx], returns: half_orm>=X.Y.0,<X.(Y+1).0
27
+ For version X.Y.Z[-xxx], returns: half_orm>=X.Y.MIN,<X.(Y+1).0
28
+ where MIN is determined by HALF_ORM_MIN_VERSIONS or defaults to 0
19
29
  """
20
30
  version_file = Path(__file__).parent / "half_orm_dev" / "version.txt"
21
31
  version_text = version_file.read_text(encoding="utf-8").strip()
@@ -27,10 +37,18 @@ def get_half_orm_version_constraint():
27
37
  raise ValueError(f"Invalid version format in version.txt: {version_text}")
28
38
 
29
39
  major, minor, patch = match.groups()
30
- major, minor = int(major), int(minor)
40
+ major, minor, patch = int(major), int(minor), int(patch)
41
+
42
+ # Check for special minimum version requirements
43
+ min_version = f"{major}.{minor}.0" # Default
44
+ for req_major, req_minor, min_patch, max_patch, required_version in HALF_ORM_MIN_VERSIONS:
45
+ if major == req_major and minor == req_minor:
46
+ # Check if patch is in range [min_patch, max_patch)
47
+ if patch >= min_patch:
48
+ if max_patch is None or patch < max_patch:
49
+ min_version = required_version
50
+ break
31
51
 
32
- # Generate constraint: half_orm>=X.Y.0,<X.(Y+1).0
33
- min_version = f"{major}.{minor}.0"
34
52
  max_version = f"{major}.{minor + 1}.0"
35
53
 
36
54
  return f"half_orm>={min_version},<{max_version}"
@@ -1 +0,0 @@
1
- 0.17.2-a10