half-orm-dev 1.0.0a24__tar.gz → 1.0.0a26__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 (82) hide show
  1. {half_orm_dev-1.0.0a24/half_orm_dev.egg-info → half_orm_dev-1.0.0a26}/PKG-INFO +1 -1
  2. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/cli/commands/release.py +4 -0
  3. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/migration_manager.py +6 -1
  4. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/modules.py +32 -22
  5. half_orm_dev-1.0.0a26/half_orm_dev/py.typed +0 -0
  6. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/templates/module_template_1 +2 -0
  7. half_orm_dev-1.0.0a26/half_orm_dev/version.txt +1 -0
  8. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26/half_orm_dev.egg-info}/PKG-INFO +1 -1
  9. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev.egg-info/SOURCES.txt +1 -0
  10. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/pyproject.toml +1 -0
  11. half_orm_dev-1.0.0a24/half_orm_dev/version.txt +0 -1
  12. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/AUTHORS +0 -0
  13. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/LICENSE +0 -0
  14. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/README.md +0 -0
  15. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/__init__.py +0 -0
  16. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/bootstrap_manager.py +0 -0
  17. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/cli/__init__.py +0 -0
  18. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/cli/commands/__init__.py +0 -0
  19. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/cli/commands/apply.py +0 -0
  20. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/cli/commands/bootstrap.py +0 -0
  21. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/cli/commands/check.py +0 -0
  22. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/cli/commands/clone.py +0 -0
  23. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/cli/commands/init.py +0 -0
  24. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/cli/commands/migrate.py +0 -0
  25. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/cli/commands/patch.py +0 -0
  26. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/cli/commands/restore.py +0 -0
  27. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/cli/commands/revert_migration.py +0 -0
  28. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/cli/commands/set_git_origin.py +0 -0
  29. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/cli/commands/sync.py +0 -0
  30. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/cli/commands/todo.py +0 -0
  31. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/cli/commands/undo.py +0 -0
  32. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/cli/commands/update.py +0 -0
  33. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/cli/commands/upgrade.py +0 -0
  34. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/cli/main.py +0 -0
  35. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/cli_extension.py +0 -0
  36. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/database.py +0 -0
  37. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/decorators.py +0 -0
  38. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/file_executor.py +0 -0
  39. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/hgit.py +0 -0
  40. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/migrations/0/17/1/00_move_to_hop.py +0 -0
  41. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/migrations/0/17/1/01_txt_to_toml.py +0 -0
  42. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/migrations/0/17/4/00_toml_dict_format.py +0 -0
  43. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/migrations/0/17/4/01_add_bootstrap_table.py +0 -0
  44. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/migrations/0/17/4/02_move_patches_to_subdirs.py +0 -0
  45. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/migrations/0/17/5/01_update_pyproject_dependency.py +0 -0
  46. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/migrations/0/18/0/00_add_async_support.py +0 -0
  47. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/migrations/0/18/0/01_update_default_tests.py +0 -0
  48. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/migrations/1/0/0/a20/01_update_gitignore.py +0 -0
  49. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/migrations/hop/BREAKING_CHANGES-1.0.0.md +0 -0
  50. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/patch_manager.py +0 -0
  51. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/patch_validator.py +0 -0
  52. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/patches/0/1/0/00_half_orm_meta.database.sql +0 -0
  53. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/patches/0/1/0/01_alter_half_orm_meta.hop_release.sql +0 -0
  54. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/patches/0/1/0/02_half_orm_meta.view.hop_penultimate_release.sql +0 -0
  55. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/patches/log +0 -0
  56. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/patches/sql/half_orm_meta.sql +0 -0
  57. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/release_file.py +0 -0
  58. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/release_manager.py +0 -0
  59. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/repo.py +0 -0
  60. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/scripts/repair-metadata.py +0 -0
  61. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/templates/.gitignore +0 -0
  62. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/templates/MANIFEST.in +0 -0
  63. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/templates/README +0 -0
  64. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/templates/conftest_template +0 -0
  65. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/templates/git-hooks/pre-commit +0 -0
  66. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/templates/git-hooks/pre-push +0 -0
  67. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/templates/git-hooks/prepare-commit-msg +0 -0
  68. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/templates/git-hooks/reference-transaction +0 -0
  69. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/templates/init_module_template +0 -0
  70. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/templates/module_template_2 +0 -0
  71. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/templates/module_template_3 +0 -0
  72. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/templates/pyproject.toml +0 -0
  73. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/templates/relation_test +0 -0
  74. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/templates/sql_adapter +0 -0
  75. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/templates/warning +0 -0
  76. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev/utils.py +0 -0
  77. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev.egg-info/dependency_links.txt +0 -0
  78. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev.egg-info/entry_points.txt +0 -0
  79. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev.egg-info/requires.txt +0 -0
  80. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/half_orm_dev.egg-info/top_level.txt +0 -0
  81. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/setup.cfg +0 -0
  82. {half_orm_dev-1.0.0a24 → half_orm_dev-1.0.0a26}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: half_orm_dev
3
- Version: 1.0.0a24
3
+ Version: 1.0.0a26
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
@@ -526,6 +526,10 @@ def release_attach_patch(patch_id: str, force: bool) -> None:
526
526
 
527
527
  version = current_branch.replace('ho-release/', '')
528
528
 
529
+ # Accept full branch name or short patch ID
530
+ if patch_id.startswith('ho-patch/'):
531
+ patch_id = patch_id[len('ho-patch/'):]
532
+
529
533
  # Confirmation
530
534
  if not force:
531
535
  click.echo(f"Attaching patch '{patch_id}' to release {version}")
@@ -624,7 +624,12 @@ class MigrationManager:
624
624
  b['name'] for b in branches_status.get('release_branches', [])
625
625
  if b.get('exists_on_remote', True)
626
626
  ]
627
- all_branches = ['ho-prod'] + release_branches + patch_branches
627
+ # ho-patch/* branches are excluded: their schema includes tables that
628
+ # don't yet exist in production, so restoring the production schema
629
+ # before generate() would delete the modules for those new tables and
630
+ # erase user-written code (Fkeys, business methods). The developer
631
+ # will re-run `hop patch apply` which regenerates with the correct schema.
632
+ all_branches = ['ho-prod'] + release_branches
628
633
 
629
634
  for branch in all_branches:
630
635
  try:
@@ -173,9 +173,11 @@ def __get_field_desc(field_name, field):
173
173
  field_desc = f'{field_desc.__module__}.{ext}'
174
174
  else:
175
175
  field_desc = field_desc.__name__
176
- value = 'dataclasses.field(default=None)'
177
176
  if field._metadata['fieldtype'][0] == '_':
178
177
  value = 'dataclasses.field(default_factory=list)'
178
+ else:
179
+ value = 'dataclasses.field(default=None)'
180
+ field_desc = f'Optional[{field_desc}]'
179
181
  field_desc = f'{field_desc} = {value}'
180
182
  field_desc = f" {field_name}: {field_desc}"
181
183
  error = utils.check_attribute_name(field_name)
@@ -188,10 +190,10 @@ def __gen_dataclass(relation, fkeys):
188
190
  rel = relation()
189
191
  dc_name = relation._ho_dataclass_name()
190
192
  fields = []
191
- post_init = [' def __post_init__(self):']
193
+ post_init = [' def __post_init__(self) -> None:']
192
194
  for field_name, field in rel._ho_fields.items():
193
195
  fields.append(__get_field_desc(field_name, field))
194
- post_init.append(f' self.{field_name}: Field = None')
196
+ post_init.append(f' self.{field_name}: Optional[Field] = None')
195
197
 
196
198
  # Invert user-defined aliases: constraint_name → alias
197
199
  aliases = {constraint: alias for alias, constraint in fkeys.items() if alias != ''}
@@ -518,15 +520,22 @@ def __update_this_module(
518
520
  fields = []
519
521
  kwargs = []
520
522
  arg_names = []
523
+ type_import_modules: set = set()
521
524
  for key, value in rel._ho_fields.items():
522
525
  error = utils.check_attribute_name(key)
523
526
  if not error:
524
527
  fields.append(f"self.{key}: Field = None")
525
528
  kwarg_type = 'typing.Any'
526
529
  if hasattr(value.py_type, '__name__'):
527
- kwarg_type = str(value.py_type.__name__)
528
- kwargs.append(f"{key}: '{kwarg_type}'=None")
530
+ mod = getattr(value.py_type, '__module__', 'builtins')
531
+ if mod and mod != 'builtins':
532
+ type_import_modules.add(mod)
533
+ kwarg_type = f'{mod}.{value.py_type.__name__}'
534
+ else:
535
+ kwarg_type = str(value.py_type.__name__)
536
+ kwargs.append(f"{key}: 'typing.Optional[{kwarg_type}]'=None")
529
537
  arg_names.append(f'{key}={key}')
538
+ type_imports = '\n'.join(f'import {m}' for m in sorted(type_import_modules))
530
539
  fields = "\n ".join(fields)
531
540
  kwargs.append('**kwargs')
532
541
  kwargs = ", ".join(kwargs)
@@ -575,6 +584,7 @@ def __update_this_module(
575
584
  fqtn=fqtn,
576
585
  kwargs=kwargs,
577
586
  arg_names=arg_names,
587
+ type_imports=type_imports,
578
588
  warning=WARNING_TEMPLATE.format(package_name=package_name)))
579
589
 
580
590
  # Generate test file in tests/ directory structure
@@ -641,7 +651,7 @@ def __gen_dc_relation() -> tuple:
641
651
  if is_classmethod:
642
652
  block.append(' @classmethod')
643
653
  prefix = ' async def' if is_async else ' def'
644
- block.append(f'{prefix} {name}{sig_str}:')
654
+ block.append(f'{prefix} {name}{sig_str}: # type: ignore[empty-body]')
645
655
  if doc:
646
656
  block.append(_fmt_doc(doc))
647
657
  block.append(' ...')
@@ -670,29 +680,29 @@ def __gen_baseclass(relation, fkeys) -> str:
670
680
 
671
681
  lines = [
672
682
  f"class {bc_name}(",
673
- f" MODEL.get_relation_class('{fqtn}', fields_aliases=None),",
683
+ f" MODEL.get_relation_class('{fqtn}', fields_aliases=None), # type: ignore[misc]",
674
684
  f" {dc_name}",
675
685
  f"):",
676
686
  f" def __iter__(self) -> Iterator[{d}]:",
677
- f" return super().__iter__()",
687
+ f" return super().__iter__() # type: ignore[return-value]",
678
688
  f"",
679
- f" def ho_select(self, *args, distinct: bool = False, order_by: str = None, limit: int = None, offset: int = None, json_agg=None) -> Iterator[{d}]:",
680
- f" return super().ho_select(*args, distinct=distinct, order_by=order_by, limit=limit, offset=offset, json_agg=json_agg)",
689
+ f" def ho_select(self, *args, distinct: bool = False, order_by: Optional[str] = None, limit: Optional[int] = None, offset: Optional[int] = None, json_agg=None) -> Iterator[{d}]:",
690
+ f" return super().ho_select(*args, distinct=distinct, order_by=order_by, limit=limit, offset=offset, json_agg=json_agg) # type: ignore[return-value]",
681
691
  f"",
682
- f" def ho_get(self, *args) -> {d}:",
683
- f" return super().ho_get(*args)",
692
+ f" def ho_get(self, *args) -> {d}: # type: ignore[override]",
693
+ f" return super().ho_get(*args) # type: ignore[return-value]",
684
694
  f"",
685
- f" def ho_insert(self, *args, upsert: Optional[bool] = False) -> {d}:",
686
- f" return super().ho_insert(*args, upsert=upsert)",
695
+ f" def ho_insert(self, *args, upsert: Optional[bool] = False) -> {d}: # type: ignore[override]",
696
+ f" return super().ho_insert(*args, upsert=upsert) # type: ignore[return-value]",
687
697
  f"",
688
- f" async def ho_aselect(self, *args, distinct: bool = False, order_by: str = None, limit: int = None, offset: int = None) -> List[{d}]:",
689
- f" return await super().ho_aselect(*args, distinct=distinct, order_by=order_by, limit=limit, offset=offset)",
698
+ f" async def ho_aselect(self, *args, distinct: bool = False, order_by: Optional[str] = None, limit: Optional[int] = None, offset: Optional[int] = None) -> List[{d}]:",
699
+ f" return await super().ho_aselect(*args, distinct=distinct, order_by=order_by, limit=limit, offset=offset) # type: ignore[return-value]",
690
700
  f"",
691
- f" async def ho_aget(self, *args) -> {d}:",
692
- f" return await super().ho_aget(*args)",
701
+ f" async def ho_aget(self, *args) -> {d}: # type: ignore[override]",
702
+ f" return await super().ho_aget(*args) # type: ignore[return-value]",
693
703
  f"",
694
- f" async def ho_ainsert(self, *args, upsert: bool = False) -> {d}:",
695
- f" return await super().ho_ainsert(*args, upsert=upsert)",
704
+ f" async def ho_ainsert(self, *args, upsert: bool = False) -> {d}: # type: ignore[override]",
705
+ f" return await super().ho_ainsert(*args, upsert=upsert) # type: ignore[return-value]",
696
706
  ]
697
707
  return '\n'.join(lines)
698
708
 
@@ -716,10 +726,10 @@ def __gen_baseclasses(package_dir, package_name):
716
726
  typing_names = sorted(dc_typing | {'Iterator', 'List', 'Optional', 'TYPE_CHECKING'})
717
727
  file_.write(f"from typing import {', '.join(typing_names)}\n")
718
728
  file_.write("import dataclasses\n")
719
- file_.write("from half_orm.field import Field\n")
729
+ file_.write("from half_orm.field import Field # type: ignore[import-not-found]\n")
720
730
  for mod in sorted(HO_DATACLASSES_IMPORTS):
721
731
  file_.write(f"import {mod}\n")
722
- file_.write(f"from {package_name} import MODEL\n")
732
+ file_.write(f"from {package_name} import MODEL # type: ignore[import-not-found]\n")
723
733
  if HO_BASECLASSES_DICT_NAMES:
724
734
  file_.write("if TYPE_CHECKING:\n")
725
735
  file_.write(f" from {package_name}.ho_typeddicts import (\n")
File without changes
@@ -6,6 +6,8 @@ WARNING!
6
6
 
7
7
  {warning}
8
8
  """
9
+ import typing
10
+ {type_imports}
9
11
  from half_orm.model import register
10
12
  from {package_name} import MODEL, ho_baseclasses
11
13
  {inheritance_import}
@@ -0,0 +1 @@
1
+ 1.0.0-a26
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: half_orm_dev
3
- Version: 1.0.0a24
3
+ Version: 1.0.0a26
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
@@ -14,6 +14,7 @@ half_orm_dev/migration_manager.py
14
14
  half_orm_dev/modules.py
15
15
  half_orm_dev/patch_manager.py
16
16
  half_orm_dev/patch_validator.py
17
+ half_orm_dev/py.typed
17
18
  half_orm_dev/release_file.py
18
19
  half_orm_dev/release_manager.py
19
20
  half_orm_dev/repo.py
@@ -45,6 +45,7 @@ include = ["half_orm_dev*"]
45
45
 
46
46
  [tool.setuptools.package-data]
47
47
  half_orm_dev = [
48
+ "py.typed",
48
49
  "templates/*",
49
50
  "templates/git-hooks/*",
50
51
  "templates/.gitignore",
@@ -1 +0,0 @@
1
- 1.0.0-a24
File without changes
File without changes