half-orm-dev 1.2.0a1__py3-none-any.whl → 2.0.0a1__py3-none-any.whl
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/cli/commands/migrate.py +54 -36
- half_orm_dev/cli/main.py +41 -4
- half_orm_dev/file_executor.py +7 -0
- half_orm_dev/migration_manager.py +52 -33
- half_orm_dev/migrations/0/17/4/00_toml_dict_format.py +1 -4
- half_orm_dev/modules.py +133 -11
- half_orm_dev/release_file.py +1 -5
- half_orm_dev/release_manager.py +103 -0
- half_orm_dev/repo.py +9 -3
- half_orm_dev/templates/pyproject.toml +2 -3
- half_orm_dev/utils.py +24 -0
- half_orm_dev/version.txt +1 -1
- {half_orm_dev-1.2.0a1.dist-info → half_orm_dev-2.0.0a1.dist-info}/METADATA +6 -9
- {half_orm_dev-1.2.0a1.dist-info → half_orm_dev-2.0.0a1.dist-info}/RECORD +19 -19
- {half_orm_dev-1.2.0a1.dist-info → half_orm_dev-2.0.0a1.dist-info}/WHEEL +0 -0
- {half_orm_dev-1.2.0a1.dist-info → half_orm_dev-2.0.0a1.dist-info}/entry_points.txt +0 -0
- {half_orm_dev-1.2.0a1.dist-info → half_orm_dev-2.0.0a1.dist-info}/licenses/AUTHORS +0 -0
- {half_orm_dev-1.2.0a1.dist-info → half_orm_dev-2.0.0a1.dist-info}/licenses/LICENSE +0 -0
- {half_orm_dev-1.2.0a1.dist-info → half_orm_dev-2.0.0a1.dist-info}/top_level.txt +0 -0
|
@@ -7,10 +7,61 @@ is newer than the repository's hop_version in .hop/config.
|
|
|
7
7
|
|
|
8
8
|
import click
|
|
9
9
|
from half_orm_dev.repo import Repo, RepoError
|
|
10
|
-
from half_orm_dev.migration_manager import
|
|
10
|
+
from half_orm_dev.migration_manager import (
|
|
11
|
+
MigrationManager, HALF_ORM_BREAKING_CHANGES_URL)
|
|
11
12
|
from half_orm import utils
|
|
12
13
|
|
|
13
14
|
|
|
15
|
+
def announce_breaking_changes(repo, config_version: str, installed_version: str) -> bool:
|
|
16
|
+
"""Say what a migration breaks, before it is confirmed.
|
|
17
|
+
|
|
18
|
+
Two kinds of breaking change, shown differently:
|
|
19
|
+
|
|
20
|
+
* half-orm's, when its major version changes: what the application's
|
|
21
|
+
code must change. They are documented on half-orm's site, so a link
|
|
22
|
+
is enough -- migrating happens on a development machine.
|
|
23
|
+
* half_orm_dev's: what the migration about to run does to the
|
|
24
|
+
repository. Shown in full, since that is what is being confirmed.
|
|
25
|
+
|
|
26
|
+
Returns:
|
|
27
|
+
True when there was something to announce, and the migration calls
|
|
28
|
+
for an explicit "yes" rather than a y/n.
|
|
29
|
+
"""
|
|
30
|
+
mgr = MigrationManager(repo)
|
|
31
|
+
major_change = mgr.half_orm_major_change(config_version, installed_version)
|
|
32
|
+
notes = mgr.get_breaking_changes(config_version, installed_version)
|
|
33
|
+
|
|
34
|
+
if major_change:
|
|
35
|
+
from_major, to_major = major_change
|
|
36
|
+
click.echo(utils.Color.bold(
|
|
37
|
+
f"⚠️ half-orm {from_major}.x → {to_major}.x: a major release, "
|
|
38
|
+
"which may require changes to your code."))
|
|
39
|
+
click.echo(" Read what changed, and what to write instead, before going on:")
|
|
40
|
+
click.echo(f" {HALF_ORM_BREAKING_CHANGES_URL.format(major=to_major)}")
|
|
41
|
+
click.echo()
|
|
42
|
+
|
|
43
|
+
if notes:
|
|
44
|
+
width = 70
|
|
45
|
+
label = 'half-orm-dev'
|
|
46
|
+
lines = ['━' * width, " ⚠️ BREAKING CHANGES", '━' * width]
|
|
47
|
+
for note in notes:
|
|
48
|
+
lines.append(
|
|
49
|
+
f"\n ━━━ {label} {installed_version} "
|
|
50
|
+
f"{'━' * max(0, width - len(label) - len(installed_version) - 7)}")
|
|
51
|
+
lines.extend(f" {line}" for line in note['content'].splitlines())
|
|
52
|
+
lines.append(f"\n{'━' * width}")
|
|
53
|
+
click.echo_via_pager('\n'.join(lines) + '\n')
|
|
54
|
+
|
|
55
|
+
return bool(major_change or notes)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def confirm_breaking_migration() -> bool:
|
|
59
|
+
"Ask for the explicit \"yes\" a breaking migration calls for."
|
|
60
|
+
click.echo("Type \"yes\" to confirm you have read the breaking changes and want to proceed.")
|
|
61
|
+
answer = click.prompt("Proceed?", default="no")
|
|
62
|
+
return answer.strip().lower() == "yes"
|
|
63
|
+
|
|
64
|
+
|
|
14
65
|
@click.command()
|
|
15
66
|
@click.option(
|
|
16
67
|
'--verbose', '-v',
|
|
@@ -77,41 +128,8 @@ def migrate(verbose: bool) -> None:
|
|
|
77
128
|
click.echo()
|
|
78
129
|
|
|
79
130
|
# Check for breaking changes between current and target version
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
needs_explicit_confirm = False
|
|
84
|
-
if breaking_changes:
|
|
85
|
-
import importlib.metadata
|
|
86
|
-
try:
|
|
87
|
-
half_orm_installed = importlib.metadata.version('half-orm')
|
|
88
|
-
except importlib.metadata.PackageNotFoundError:
|
|
89
|
-
half_orm_installed = None
|
|
90
|
-
|
|
91
|
-
width = 70
|
|
92
|
-
lines = []
|
|
93
|
-
lines.append('━' * width)
|
|
94
|
-
lines.append(f" ⚠️ BREAKING CHANGES")
|
|
95
|
-
lines.append('━' * width)
|
|
96
|
-
for bc in breaking_changes:
|
|
97
|
-
if bc['component'] == 'hop':
|
|
98
|
-
label = 'half-orm-dev'
|
|
99
|
-
display_version = installed_version
|
|
100
|
-
else:
|
|
101
|
-
label = 'half-orm'
|
|
102
|
-
display_version = half_orm_installed or bc['version']
|
|
103
|
-
lines.append(f"\n ━━━ {label} {display_version} {'━' * max(0, width - len(label) - len(display_version) - 7)}")
|
|
104
|
-
for line in bc['content'].splitlines():
|
|
105
|
-
lines.append(f" {line}")
|
|
106
|
-
lines.append(f"\n{'━' * width}")
|
|
107
|
-
click.echo_via_pager('\n'.join(lines) + '\n')
|
|
108
|
-
needs_explicit_confirm = True
|
|
109
|
-
|
|
110
|
-
# Run migrations
|
|
111
|
-
if needs_explicit_confirm:
|
|
112
|
-
click.echo("Type \"yes\" to confirm you have read the breaking changes and want to proceed.")
|
|
113
|
-
answer = click.prompt("Proceed?", default="no")
|
|
114
|
-
confirmed = answer.strip().lower() == "yes"
|
|
131
|
+
if announce_breaking_changes(repo, config_version, installed_version):
|
|
132
|
+
confirmed = confirm_breaking_migration()
|
|
115
133
|
else:
|
|
116
134
|
confirmed = click.confirm("Do you want to proceed?", default=False)
|
|
117
135
|
|
half_orm_dev/cli/main.py
CHANGED
|
@@ -10,7 +10,7 @@ import sys
|
|
|
10
10
|
from pathlib import Path
|
|
11
11
|
|
|
12
12
|
import half_orm_dev as _half_orm_dev
|
|
13
|
-
from half_orm_dev.utils import hop_version
|
|
13
|
+
from half_orm_dev.utils import hop_version, is_production_checkout
|
|
14
14
|
from half_orm_dev.repo import Repo, OutdatedHalfORMDevError
|
|
15
15
|
from half_orm import utils
|
|
16
16
|
from .commands import ALL_COMMANDS
|
|
@@ -141,10 +141,27 @@ def create_cli_group():
|
|
|
141
141
|
cmd = super().get_command(ctx, cmd_name)
|
|
142
142
|
if cmd is not None:
|
|
143
143
|
return cmd
|
|
144
|
+
if hop.needs_hop_upgrade:
|
|
145
|
+
# No command is registered while half_orm_dev is too old, so
|
|
146
|
+
# `half_orm dev upgrade` answered "No such command 'upgrade'"
|
|
147
|
+
# before the group callback could say why -- and install the
|
|
148
|
+
# right version, or refuse to on a production server. Resolve
|
|
149
|
+
# the name to a placeholder, and let the callback speak.
|
|
150
|
+
@click.command(
|
|
151
|
+
cmd_name,
|
|
152
|
+
context_settings={
|
|
153
|
+
'allow_extra_args': True,
|
|
154
|
+
'ignore_unknown_options': True,
|
|
155
|
+
},
|
|
156
|
+
)
|
|
157
|
+
def _outdated():
|
|
158
|
+
sys.exit(1) # not reached: the callback exits or restarts
|
|
159
|
+
|
|
160
|
+
return _outdated
|
|
144
161
|
# Unknown command — show a specific message when migration is needed.
|
|
145
162
|
if hop.repo_checked and hop._Hop__repo.needs_migration():
|
|
146
163
|
installed_version = hop_version()
|
|
147
|
-
config_version = hop._Hop__repo.
|
|
164
|
+
config_version = hop._Hop__repo.config.hop_version
|
|
148
165
|
|
|
149
166
|
@click.command(
|
|
150
167
|
cmd_name,
|
|
@@ -193,6 +210,16 @@ def create_cli_group():
|
|
|
193
210
|
error = hop.hop_upgrade_error
|
|
194
211
|
required = error.required_version
|
|
195
212
|
installed = error.installed_version
|
|
213
|
+
if error.base_dir and is_production_checkout(error.base_dir):
|
|
214
|
+
# Nothing is installed behind an operator's back on a
|
|
215
|
+
# production server: the version is a decision.
|
|
216
|
+
click.echo(utils.Color.red(
|
|
217
|
+
f"\n This repository requires half-orm-dev {required} "
|
|
218
|
+
f"(installed: {installed})."), err=True)
|
|
219
|
+
click.echo(" Production server: nothing is installed automatically.", err=True)
|
|
220
|
+
click.echo(" Install it, then run the command again:", err=True)
|
|
221
|
+
click.echo(f" pip install half-orm-dev=={required}", err=True)
|
|
222
|
+
sys.exit(1)
|
|
196
223
|
click.echo(f"\n This repository requires half-orm-dev {required} "
|
|
197
224
|
f"(installed: {installed}).")
|
|
198
225
|
click.echo(f" Installing the required version...")
|
|
@@ -217,7 +244,7 @@ def create_cli_group():
|
|
|
217
244
|
# Propose automatic migration
|
|
218
245
|
from half_orm_dev.repo import RepoError
|
|
219
246
|
installed_version = hop_version()
|
|
220
|
-
config_version = hop._Hop__repo.
|
|
247
|
+
config_version = hop._Hop__repo.config.hop_version
|
|
221
248
|
current_branch = hop._Hop__repo.hgit.branch if hop._Hop__repo.hgit else 'unknown'
|
|
222
249
|
|
|
223
250
|
click.echo(f"\n{'='*70}")
|
|
@@ -234,8 +261,18 @@ def create_cli_group():
|
|
|
234
261
|
click.echo(f"\n 💡 You can interrupt (Ctrl+C) to backup .git/ if needed.")
|
|
235
262
|
click.echo(f"\n{'='*70}\n")
|
|
236
263
|
|
|
264
|
+
# What the migration breaks, if anything: this path used
|
|
265
|
+
# to migrate without showing any breaking change at all.
|
|
266
|
+
from half_orm_dev.cli.commands.migrate import (
|
|
267
|
+
announce_breaking_changes, confirm_breaking_migration)
|
|
268
|
+
if announce_breaking_changes(
|
|
269
|
+
hop._Hop__repo, config_version, installed_version):
|
|
270
|
+
apply = confirm_breaking_migration()
|
|
271
|
+
else:
|
|
272
|
+
apply = click.confirm("Apply migration now?", default=True)
|
|
273
|
+
|
|
237
274
|
# Ask for confirmation
|
|
238
|
-
if
|
|
275
|
+
if apply:
|
|
239
276
|
click.echo()
|
|
240
277
|
|
|
241
278
|
# Switch to ho-prod if needed
|
half_orm_dev/file_executor.py
CHANGED
|
@@ -107,6 +107,11 @@ def execute_python_file(
|
|
|
107
107
|
text=True,
|
|
108
108
|
check=True
|
|
109
109
|
)
|
|
110
|
+
# A script that succeeds can still have something to say - notably
|
|
111
|
+
# the generated package logging a relation missing from the database.
|
|
112
|
+
# Dropping its stderr would make that warning unobservable.
|
|
113
|
+
if result.stderr:
|
|
114
|
+
sys.stderr.write(result.stderr)
|
|
110
115
|
return result.stdout.strip()
|
|
111
116
|
|
|
112
117
|
except subprocess.CalledProcessError as e:
|
|
@@ -170,6 +175,8 @@ def _execute_via_venv_runner(
|
|
|
170
175
|
text=True,
|
|
171
176
|
check=True
|
|
172
177
|
)
|
|
178
|
+
if result.stderr:
|
|
179
|
+
sys.stderr.write(result.stderr)
|
|
173
180
|
return result.stdout.strip()
|
|
174
181
|
except subprocess.CalledProcessError as e:
|
|
175
182
|
error_msg = f"Python execution failed in {file_path.name}"
|
|
@@ -34,10 +34,9 @@ from typing import List, Dict, Optional, Tuple
|
|
|
34
34
|
from half_orm import utils
|
|
35
35
|
from half_orm_dev.decorators import with_dynamic_branch_lock
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
get_breaking_changes_dir = None # type: ignore[assignment]
|
|
37
|
+
# Where half-orm documents what a major release requires of the code.
|
|
38
|
+
HALF_ORM_BREAKING_CHANGES_URL = (
|
|
39
|
+
'https://half-orm.github.io/half-orm/latest/breaking-changes/#breaking-{major}-0-0')
|
|
41
40
|
|
|
42
41
|
|
|
43
42
|
class MigrationManagerError(Exception):
|
|
@@ -721,13 +720,14 @@ class MigrationManager:
|
|
|
721
720
|
|
|
722
721
|
def get_breaking_changes(self, current_version: str, target_version: str) -> List[Dict]:
|
|
723
722
|
"""
|
|
724
|
-
Collect breaking-changes
|
|
723
|
+
Collect half_orm_dev's breaking-changes notes for ]current, target].
|
|
725
724
|
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
725
|
+
These describe what the migration about to run does to the
|
|
726
|
+
repository -- the .hop/ layout, a command, the generated code -- and
|
|
727
|
+
are shown in full before it runs. half-orm's own notes are not
|
|
728
|
+
collected: see half_orm_major_change().
|
|
729
729
|
|
|
730
|
-
|
|
730
|
+
Files live in migrations/hop/ as BREAKING_CHANGES-X.Y.Z.md.
|
|
731
731
|
|
|
732
732
|
Args:
|
|
733
733
|
current_version: Current hop version (exclusive lower bound)
|
|
@@ -735,7 +735,7 @@ class MigrationManager:
|
|
|
735
735
|
|
|
736
736
|
Returns:
|
|
737
737
|
List of dicts ordered by version, each with keys:
|
|
738
|
-
- component: 'hop'
|
|
738
|
+
- component: 'hop'
|
|
739
739
|
- version: version string from filename
|
|
740
740
|
- content: file content
|
|
741
741
|
"""
|
|
@@ -751,30 +751,49 @@ class MigrationManager:
|
|
|
751
751
|
except Exception:
|
|
752
752
|
return results
|
|
753
753
|
|
|
754
|
-
|
|
755
|
-
if
|
|
754
|
+
bc_dir = self._migrations_root / 'hop'
|
|
755
|
+
if not bc_dir.is_dir():
|
|
756
|
+
return results
|
|
757
|
+
for bc_file in sorted(bc_dir.glob('BREAKING_CHANGES-*.md')):
|
|
758
|
+
# filename: BREAKING_CHANGES-X.Y.Z.md (hyphens in pre-release OK)
|
|
759
|
+
raw = bc_file.stem[len('BREAKING_CHANGES-'):] # e.g. '1.0.0' or '1.0.0-rc1'
|
|
756
760
|
try:
|
|
757
|
-
|
|
761
|
+
file_version = version.parse(raw)
|
|
758
762
|
except Exception:
|
|
759
|
-
pass # older half-orm — ignore silently
|
|
760
|
-
|
|
761
|
-
for component, bc_dir in component_dirs.items():
|
|
762
|
-
if not bc_dir.is_dir():
|
|
763
763
|
continue
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
results.append({
|
|
773
|
-
'component': component,
|
|
774
|
-
'version': raw,
|
|
775
|
-
'content': bc_file.read_text(encoding='utf-8'),
|
|
776
|
-
})
|
|
777
|
-
|
|
778
|
-
# Sort by version, then by component for a stable display order
|
|
779
|
-
results.sort(key=lambda r: (version.parse(r['version']), r['component']))
|
|
764
|
+
if current_base < file_version <= target_base:
|
|
765
|
+
results.append({
|
|
766
|
+
'component': 'hop',
|
|
767
|
+
'version': raw,
|
|
768
|
+
'content': bc_file.read_text(encoding='utf-8'),
|
|
769
|
+
})
|
|
770
|
+
|
|
771
|
+
results.sort(key=lambda r: version.parse(r['version']))
|
|
780
772
|
return results
|
|
773
|
+
|
|
774
|
+
@staticmethod
|
|
775
|
+
def half_orm_major_change(current_version: str, target_version: str) -> Optional[Tuple[int, int]]:
|
|
776
|
+
"""
|
|
777
|
+
The half-orm major versions a migration moves between, if it does.
|
|
778
|
+
|
|
779
|
+
half-orm follows Semantic Versioning: only a major release requires
|
|
780
|
+
changes to the application's code, and its notes are on half-orm's
|
|
781
|
+
documentation, where a developer -- the one running this, on a
|
|
782
|
+
machine with a browser -- is pointed. half_orm_dev's major version
|
|
783
|
+
is half-orm's (its CLI loads nothing else), so a change of
|
|
784
|
+
half_orm_dev's major version is a change of half-orm's.
|
|
785
|
+
|
|
786
|
+
Args:
|
|
787
|
+
current_version: Current hop version
|
|
788
|
+
target_version: Target hop version
|
|
789
|
+
|
|
790
|
+
Returns:
|
|
791
|
+
``(from_major, to_major)``, or None when the major version does
|
|
792
|
+
not move forward or a version cannot be read.
|
|
793
|
+
"""
|
|
794
|
+
try:
|
|
795
|
+
current = version.parse(current_version).major
|
|
796
|
+
target = version.parse(target_version).major
|
|
797
|
+
except Exception:
|
|
798
|
+
return None
|
|
799
|
+
return (current, target) if target > current else None
|
half_orm_dev/modules.py
CHANGED
|
@@ -93,6 +93,37 @@ def _to_valid_identifier(name: str) -> str:
|
|
|
93
93
|
return sanitized
|
|
94
94
|
|
|
95
95
|
|
|
96
|
+
def _safe_identifier(name: str) -> str:
|
|
97
|
+
"""Return `name` if it can be written as a Python identifier, else a
|
|
98
|
+
sanitized form of it.
|
|
99
|
+
|
|
100
|
+
Schema, relation and constraint names are read from the database, and
|
|
101
|
+
PostgreSQL accepts anything in a quoted name -- a quote, a slash, a
|
|
102
|
+
newline. Written as they are into a class statement, an attribute or a
|
|
103
|
+
path, they are code or a directory of the database's choosing rather than
|
|
104
|
+
a name. A name that already is an identifier is returned untouched, so
|
|
105
|
+
what is generated for an ordinary schema does not change.
|
|
106
|
+
"""
|
|
107
|
+
name = str(name)
|
|
108
|
+
if name.isidentifier() and not iskeyword(name):
|
|
109
|
+
return name
|
|
110
|
+
return _to_valid_identifier(name) or '_'
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def _docstring_safe(text: str) -> str:
|
|
114
|
+
"""Escape `text` so that it can only ever be the content of a
|
|
115
|
+
triple-quoted docstring.
|
|
116
|
+
|
|
117
|
+
Relation and column comments end up in the docstring of the generated
|
|
118
|
+
class. A comment holding three quotes used to close it, and the rest of
|
|
119
|
+
the comment became statements of the class body, run at import. The
|
|
120
|
+
backslash is escaped first: it would otherwise undo the escaping of the
|
|
121
|
+
quotes -- and was already turning a comment such as `C:\new` into a
|
|
122
|
+
line break.
|
|
123
|
+
"""
|
|
124
|
+
return str(text).replace('\\', '\\\\').replace('"""', '\\"\\"\\"')
|
|
125
|
+
|
|
126
|
+
|
|
96
127
|
def __get_test_directory_path(schema_name, table_name, base_dir):
|
|
97
128
|
"""
|
|
98
129
|
Calculate the test directory path for a given schema and table.
|
|
@@ -153,7 +184,29 @@ def __get_test_file_path(schema_name, table_name, base_dir, package_name):
|
|
|
153
184
|
def __get_full_class_name(schemaname, relationname):
|
|
154
185
|
schemaname = ''.join([elt.capitalize() for elt in schemaname.split('.')])
|
|
155
186
|
relationname = ''.join([elt.capitalize() for elt in relationname.split('_')])
|
|
156
|
-
|
|
187
|
+
# Every generated class name is built on this one: DC_*, BC_*, *Dict.
|
|
188
|
+
return _safe_identifier(f'{schemaname}{relationname}')
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def __get_dataclass_name(relation) -> str:
|
|
192
|
+
"""Name of the DC_* class of `relation`.
|
|
193
|
+
|
|
194
|
+
Same formula as Relation._ho_dataclass_name(), through
|
|
195
|
+
__get_full_class_name so that the result is always an identifier.
|
|
196
|
+
"""
|
|
197
|
+
return f'DC_{__get_full_class_name(*list(relation._t_fqrn)[1:])}'
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def __attribute_line(indent: str, attr_name: str, statement: str) -> str:
|
|
201
|
+
"""Return `statement`, or a comment in its place when `attr_name` cannot
|
|
202
|
+
be an attribute.
|
|
203
|
+
|
|
204
|
+
The name is shown through repr(): a name holding a line break must not
|
|
205
|
+
get to end the comment it is quoted in.
|
|
206
|
+
"""
|
|
207
|
+
if attr_name.isidentifier() and not iskeyword(attr_name):
|
|
208
|
+
return f'{indent}{statement}'
|
|
209
|
+
return f'{indent}# FIX ME! {attr_name!r} is not a valid identifier in Python.'
|
|
157
210
|
|
|
158
211
|
|
|
159
212
|
def __get_field_desc(field_name, field):
|
|
@@ -188,7 +241,7 @@ def __get_field_desc(field_name, field):
|
|
|
188
241
|
|
|
189
242
|
def __gen_dataclass(relation, fkeys):
|
|
190
243
|
rel = relation()
|
|
191
|
-
dc_name = relation
|
|
244
|
+
dc_name = __get_dataclass_name(relation)
|
|
192
245
|
fields = []
|
|
193
246
|
post_init = [' def __post_init__(self) -> None:']
|
|
194
247
|
for field_name, field in rel._ho_fields.items():
|
|
@@ -209,7 +262,9 @@ def __gen_dataclass(relation, fkeys):
|
|
|
209
262
|
fdc_name = f'DC_{__get_full_class_name(fk_fqrn[1], fk_fqrn[2])}'
|
|
210
263
|
except Exception:
|
|
211
264
|
fdc_name = dc_name # fallback: host class
|
|
212
|
-
|
|
265
|
+
# A constraint may be named anything, and so may an alias.
|
|
266
|
+
post_init.append(__attribute_line(
|
|
267
|
+
' ', attr_name, f"self.{attr_name} = {fdc_name}"))
|
|
213
268
|
return '\n'.join([f'@dataclasses.dataclass\nclass {dc_name}(DC_Relation):'] + fields + post_init)
|
|
214
269
|
|
|
215
270
|
|
|
@@ -273,6 +328,13 @@ def __gen_json_typedicts(name_prefix: str, schema) -> tuple:
|
|
|
273
328
|
fields = []
|
|
274
329
|
|
|
275
330
|
for key, val in schema.items():
|
|
331
|
+
# The keys come from a column comment. One that is not an identifier
|
|
332
|
+
# cannot be a TypedDict field, and written as it is would be a
|
|
333
|
+
# statement of the class body.
|
|
334
|
+
if not isinstance(key, str) or not key.isidentifier() or iskeyword(key):
|
|
335
|
+
fields.append(
|
|
336
|
+
f" # FIX ME! {key!r} is not a valid identifier in Python.")
|
|
337
|
+
continue
|
|
276
338
|
if isinstance(val, str):
|
|
277
339
|
type_str = __json_scalar_type(val)
|
|
278
340
|
fields.append(f" {key}: Optional[{type_str}]")
|
|
@@ -297,7 +359,10 @@ def __gen_json_typedicts(name_prefix: str, schema) -> tuple:
|
|
|
297
359
|
fields.append(f" {key}: Optional[Any]")
|
|
298
360
|
|
|
299
361
|
class_name = f'{name_prefix}Dict'
|
|
300
|
-
|
|
362
|
+
if not any(not line.lstrip().startswith('#') for line in fields):
|
|
363
|
+
# Nothing but comments, or nothing at all: a class needs a statement.
|
|
364
|
+
fields.append(' pass')
|
|
365
|
+
body = '\n'.join(fields)
|
|
301
366
|
classes.append(f'class {class_name}(TypedDict, total=False):\n{body}')
|
|
302
367
|
return classes, class_name
|
|
303
368
|
|
|
@@ -449,9 +514,11 @@ def __apply_fkey_aliases_to_doc(documentation: str, rel, existing_fkeys: dict) -
|
|
|
449
514
|
lines.append(" }")
|
|
450
515
|
new_block = '\n'.join(lines)
|
|
451
516
|
|
|
517
|
+
# A function, not the string: in a replacement string a backslash is an
|
|
518
|
+
# escape, and constraint names are not ours to vouch for.
|
|
452
519
|
return re.sub(
|
|
453
520
|
r' Fkeys = \{[^}]*\}',
|
|
454
|
-
new_block,
|
|
521
|
+
lambda _match: new_block,
|
|
455
522
|
documentation,
|
|
456
523
|
flags=re.DOTALL,
|
|
457
524
|
)
|
|
@@ -524,7 +591,10 @@ def __update_this_module(
|
|
|
524
591
|
arg_names = ", ".join(arg_names)
|
|
525
592
|
|
|
526
593
|
path[0] = package_dir
|
|
527
|
-
|
|
594
|
+
# One directory per dotted part of the schema name, each of them a name
|
|
595
|
+
# and nothing else: left as it was, a schema called `/tmp/x` sent the
|
|
596
|
+
# module there, os.path.join dropping everything before an absolute part.
|
|
597
|
+
path[1] = os.sep.join(_safe_identifier(part) for part in path[1].split('.'))
|
|
528
598
|
|
|
529
599
|
path = [_to_valid_identifier(elt).lower() if i >= 2 else elt for i, elt in enumerate(path)]
|
|
530
600
|
class_name = camel_case(path[-1])
|
|
@@ -552,11 +622,13 @@ def __update_this_module(
|
|
|
552
622
|
file_.write(
|
|
553
623
|
module_template.format(
|
|
554
624
|
hop_release = hop_version(),
|
|
555
|
-
|
|
625
|
+
# Both land inside a docstring, and both are database text:
|
|
626
|
+
# the relation's comment, and its qualified name.
|
|
627
|
+
module=_docstring_safe(f"{package_name}.{fqtn}"),
|
|
556
628
|
package_name=package_name,
|
|
557
|
-
documentation=documentation,
|
|
629
|
+
documentation=_docstring_safe(documentation),
|
|
558
630
|
class_name=class_name,
|
|
559
|
-
dc_name=rel
|
|
631
|
+
dc_name=__get_dataclass_name(rel),
|
|
560
632
|
dict_class_name=dict_class_name,
|
|
561
633
|
bc_name=bc_name,
|
|
562
634
|
fqtn=fqtn,
|
|
@@ -703,6 +775,51 @@ def _bc_override(name: str, return_annotation: str, override_ignore: bool) -> st
|
|
|
703
775
|
])
|
|
704
776
|
|
|
705
777
|
|
|
778
|
+
# Emitted near the top of every generated ho_baseclasses.py.
|
|
779
|
+
#
|
|
780
|
+
# ho_baseclasses.py builds one base class per relation *at import time*, from
|
|
781
|
+
# the schema as it stood at the last generation — and the database does not
|
|
782
|
+
# always match. `patch apply` rebuilds it from the production baseline and
|
|
783
|
+
# replays the staged patches one by one, so a table created by a later patch
|
|
784
|
+
# is still missing while an earlier patch's Python script imports the package.
|
|
785
|
+
# Resolving that base eagerly aborted the whole apply with UnknownRelation.
|
|
786
|
+
#
|
|
787
|
+
# A missing relation now degrades to a placeholder that raises only if
|
|
788
|
+
# something actually instantiates it, and every occurrence is logged, so the
|
|
789
|
+
# drift is never silent.
|
|
790
|
+
BC_BASE_HELPER = '''def _bc_base(fqrn: str):
|
|
791
|
+
"""Base class for *fqrn*, or a placeholder when it is not in the database.
|
|
792
|
+
|
|
793
|
+
The generated code describes the schema as of the last generation; the
|
|
794
|
+
database it runs against may be older (mid-migration, or rebuilt from the
|
|
795
|
+
production baseline by `half_orm dev patch apply`).
|
|
796
|
+
"""
|
|
797
|
+
try:
|
|
798
|
+
return MODEL.get_relation_class(fqrn, fields_aliases=None)
|
|
799
|
+
except UnknownRelation as exc:
|
|
800
|
+
# Bind it under a name that survives the except block, so the
|
|
801
|
+
# placeholder below can re-raise it from its closure.
|
|
802
|
+
error = exc
|
|
803
|
+
sys.stderr.write(
|
|
804
|
+
f"half-orm: relation '{fqrn}' is not in the database - generated code "
|
|
805
|
+
f"is ahead of the schema. Using a placeholder base class.\\n")
|
|
806
|
+
|
|
807
|
+
class _MissingRelation:
|
|
808
|
+
"""Stands in for a relation absent from the database.
|
|
809
|
+
|
|
810
|
+
Importing the module keeps working; using the class does not.
|
|
811
|
+
"""
|
|
812
|
+
_ho_missing_fqrn = fqrn
|
|
813
|
+
|
|
814
|
+
def __init__(self, *args, **kwargs):
|
|
815
|
+
# Re-raise half_orm's own error: it carries the message
|
|
816
|
+
# built from the (dbname, schema, relation) triple.
|
|
817
|
+
raise error
|
|
818
|
+
|
|
819
|
+
return _MissingRelation
|
|
820
|
+
'''
|
|
821
|
+
|
|
822
|
+
|
|
706
823
|
def __gen_baseclass(relation, fkeys) -> str:
|
|
707
824
|
"""Generate a BC_* base class string with TypedDict-typed method overrides."""
|
|
708
825
|
rel = relation()
|
|
@@ -710,13 +827,14 @@ def __gen_baseclass(relation, fkeys) -> str:
|
|
|
710
827
|
full_name = __get_full_class_name(*t_qrn)
|
|
711
828
|
fqtn = '.'.join(t_qrn)
|
|
712
829
|
bc_name = f'BC_{full_name}'
|
|
713
|
-
dc_name = rel
|
|
830
|
+
dc_name = __get_dataclass_name(rel)
|
|
714
831
|
d = f'{full_name}Dict'
|
|
715
832
|
HO_BASECLASSES_DICT_NAMES.add(d)
|
|
716
833
|
|
|
717
834
|
header = [
|
|
718
835
|
f"class {bc_name}(",
|
|
719
|
-
|
|
836
|
+
# repr(): a quote in a schema or relation name closed the literal.
|
|
837
|
+
f" _bc_base({fqtn!r}), # type: ignore[misc]",
|
|
720
838
|
f" {dc_name}",
|
|
721
839
|
f"):",
|
|
722
840
|
]
|
|
@@ -751,7 +869,9 @@ def __gen_baseclasses(package_dir, package_name):
|
|
|
751
869
|
typing_names = sorted(dc_typing | {'Iterator', 'List', 'Optional', 'TYPE_CHECKING'})
|
|
752
870
|
file_.write(f"from typing import {', '.join(typing_names)}\n")
|
|
753
871
|
file_.write("import dataclasses\n")
|
|
872
|
+
file_.write("import sys\n")
|
|
754
873
|
file_.write("from half_orm.field import Field # type: ignore[import-not-found]\n")
|
|
874
|
+
file_.write("from half_orm.model_errors import UnknownRelation # type: ignore[import-not-found]\n")
|
|
755
875
|
for mod in sorted(HO_DATACLASSES_IMPORTS):
|
|
756
876
|
file_.write(f"import {mod}\n")
|
|
757
877
|
file_.write(f"from {package_name} import MODEL # type: ignore[import-not-found]\n")
|
|
@@ -762,6 +882,8 @@ def __gen_baseclasses(package_dir, package_name):
|
|
|
762
882
|
file_.write(f" {name},\n")
|
|
763
883
|
file_.write(" )\n")
|
|
764
884
|
file_.write("\n\n")
|
|
885
|
+
file_.write(BC_BASE_HELPER)
|
|
886
|
+
file_.write("\n")
|
|
765
887
|
file_.write(dc_relation_str)
|
|
766
888
|
for dc in HO_DATACLASSES:
|
|
767
889
|
file_.write(f"\n\n{dc}\n")
|
half_orm_dev/release_file.py
CHANGED
|
@@ -7,12 +7,8 @@ during development (candidate and staged status).
|
|
|
7
7
|
|
|
8
8
|
from pathlib import Path
|
|
9
9
|
from typing import List, Optional, Dict
|
|
10
|
-
import sys
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
import tomllib as tomli
|
|
14
|
-
else:
|
|
15
|
-
import tomli
|
|
11
|
+
import tomllib as tomli
|
|
16
12
|
|
|
17
13
|
try:
|
|
18
14
|
import tomli_w
|
half_orm_dev/release_manager.py
CHANGED
|
@@ -1595,6 +1595,10 @@ class ReleaseManager:
|
|
|
1595
1595
|
# Upgrade to latest (all releases)
|
|
1596
1596
|
upgrade_path = update_info['upgrade_path']
|
|
1597
1597
|
|
|
1598
|
+
# Before anything is written -- snapshot, backup, or the dry run's
|
|
1599
|
+
# report: a release is applied by the half_orm_dev it was made with.
|
|
1600
|
+
self._check_tool_version_for_releases(upgrade_path)
|
|
1601
|
+
|
|
1598
1602
|
# === DRY RUN - Stop here and return simulation ===
|
|
1599
1603
|
if dry_run:
|
|
1600
1604
|
# Build patches_would_apply dict
|
|
@@ -1807,6 +1811,105 @@ class ReleaseManager:
|
|
|
1807
1811
|
return backup_file
|
|
1808
1812
|
|
|
1809
1813
|
|
|
1814
|
+
def _release_hop_version(self, version: str) -> Optional[str]:
|
|
1815
|
+
"""The half_orm_dev version release `version` was made with.
|
|
1816
|
+
|
|
1817
|
+
Read from the .hop/config of its ho-prod-X.Y.Z branch, without
|
|
1818
|
+
checking it out. The branch is fetched first: a production server
|
|
1819
|
+
cloned with --single-branch only tracks ho-prod.
|
|
1820
|
+
|
|
1821
|
+
Returns:
|
|
1822
|
+
The hop_version, or None when the branch or its configuration
|
|
1823
|
+
cannot be read.
|
|
1824
|
+
"""
|
|
1825
|
+
from configparser import ConfigParser, Error as ConfigParserError
|
|
1826
|
+
git_repo = self._repo.hgit._HGit__git_repo
|
|
1827
|
+
branch = f"ho-prod-{version}"
|
|
1828
|
+
try:
|
|
1829
|
+
git_repo.git.fetch('origin', f'{branch}:refs/remotes/origin/{branch}')
|
|
1830
|
+
except Exception:
|
|
1831
|
+
pass # offline, or only known locally: read what is there
|
|
1832
|
+
for ref in (f'origin/{branch}', branch):
|
|
1833
|
+
try:
|
|
1834
|
+
text = git_repo.git.show(f'{ref}:.hop/config')
|
|
1835
|
+
except Exception:
|
|
1836
|
+
continue
|
|
1837
|
+
parser = ConfigParser()
|
|
1838
|
+
try:
|
|
1839
|
+
parser.read_string(text)
|
|
1840
|
+
return parser['halfORM'].get('hop_version', '').strip() or None
|
|
1841
|
+
except (ConfigParserError, KeyError):
|
|
1842
|
+
return None
|
|
1843
|
+
return None
|
|
1844
|
+
|
|
1845
|
+
def _check_tool_version_for_releases(self, upgrade_path: List[str]) -> None:
|
|
1846
|
+
"""Refuse to apply a release made with another half_orm_dev.
|
|
1847
|
+
|
|
1848
|
+
A release is prepared, migrated and tested on a development machine
|
|
1849
|
+
with one version of half_orm_dev, recorded in its .hop/config. On a
|
|
1850
|
+
production server it is applied by that version and no other: an
|
|
1851
|
+
older one does not know what the release's repository looks like, a
|
|
1852
|
+
newer one has not been tested with it -- and with half_orm_dev comes
|
|
1853
|
+
the half-orm it depends on.
|
|
1854
|
+
|
|
1855
|
+
The installed version used to be compared only with the release
|
|
1856
|
+
already in production, at startup; the releases about to be applied
|
|
1857
|
+
were never checked.
|
|
1858
|
+
|
|
1859
|
+
Raises:
|
|
1860
|
+
ReleaseManagerError: if a release of the path was made with
|
|
1861
|
+
another version, saying how far the installed one can go and
|
|
1862
|
+
what to install for the rest. Nothing has been applied.
|
|
1863
|
+
"""
|
|
1864
|
+
from half_orm_dev.utils import hop_version
|
|
1865
|
+
installed = hop_version()
|
|
1866
|
+
|
|
1867
|
+
def same(a, b):
|
|
1868
|
+
try:
|
|
1869
|
+
return Version(a) == Version(b)
|
|
1870
|
+
except InvalidVersion:
|
|
1871
|
+
return a == b
|
|
1872
|
+
|
|
1873
|
+
required = {version: self._release_hop_version(version) for version in upgrade_path}
|
|
1874
|
+
applicable = []
|
|
1875
|
+
for version in upgrade_path:
|
|
1876
|
+
if required[version] is None or not same(required[version], installed):
|
|
1877
|
+
break
|
|
1878
|
+
applicable.append(version)
|
|
1879
|
+
if len(applicable) == len(upgrade_path):
|
|
1880
|
+
return
|
|
1881
|
+
|
|
1882
|
+
blocking = upgrade_path[len(applicable)]
|
|
1883
|
+
needed = required[blocking]
|
|
1884
|
+
lines = [
|
|
1885
|
+
"This upgrade needs another version of half_orm_dev.",
|
|
1886
|
+
f" Installed: {installed}",
|
|
1887
|
+
]
|
|
1888
|
+
if needed is None:
|
|
1889
|
+
lines.append(
|
|
1890
|
+
f" Release {blocking}: no half_orm_dev version could be read from "
|
|
1891
|
+
f"ho-prod-{blocking}:.hop/config")
|
|
1892
|
+
lines.append(" Check that the branch exists on origin and is reachable.")
|
|
1893
|
+
else:
|
|
1894
|
+
lines.append(f" Release {blocking} was made with half_orm_dev {needed}")
|
|
1895
|
+
if applicable:
|
|
1896
|
+
lines += [
|
|
1897
|
+
"",
|
|
1898
|
+
f"The installed version can apply up to {applicable[-1]}. Run, in order:",
|
|
1899
|
+
f" half_orm dev upgrade --to-release {applicable[-1]}",
|
|
1900
|
+
f" pip install half-orm-dev=={needed}",
|
|
1901
|
+
" half_orm dev upgrade",
|
|
1902
|
+
]
|
|
1903
|
+
else:
|
|
1904
|
+
lines += [
|
|
1905
|
+
"",
|
|
1906
|
+
"Install it, then run the upgrade again:",
|
|
1907
|
+
f" pip install half-orm-dev=={needed}",
|
|
1908
|
+
" half_orm dev upgrade",
|
|
1909
|
+
]
|
|
1910
|
+
lines += ["", "Nothing was applied."]
|
|
1911
|
+
raise ReleaseManagerError('\n'.join(lines))
|
|
1912
|
+
|
|
1810
1913
|
def _validate_production_upgrade(self) -> None:
|
|
1811
1914
|
"""
|
|
1812
1915
|
Validate production environment before upgrade.
|
half_orm_dev/repo.py
CHANGED
|
@@ -85,9 +85,13 @@ class RepoError(Exception):
|
|
|
85
85
|
|
|
86
86
|
class OutdatedHalfORMDevError(RepoError):
|
|
87
87
|
"""Raised when installed half_orm_dev version is older than repository requirement."""
|
|
88
|
-
def __init__(self, required_version: str, installed_version: str):
|
|
88
|
+
def __init__(self, required_version: str, installed_version: str, base_dir=None):
|
|
89
89
|
self.required_version = required_version
|
|
90
90
|
self.installed_version = installed_version
|
|
91
|
+
# The repository that asked: what the CLI does about it -- install the
|
|
92
|
+
# version on a development machine, refuse on a production server --
|
|
93
|
+
# depends on what kind of checkout it is.
|
|
94
|
+
self.base_dir = base_dir
|
|
91
95
|
super().__init__(
|
|
92
96
|
f"Repository requires half_orm_dev == {required_version} "
|
|
93
97
|
f"but {installed_version} is installed.\n"
|
|
@@ -404,7 +408,8 @@ class Repo:
|
|
|
404
408
|
try:
|
|
405
409
|
# Use centralized comparison method
|
|
406
410
|
if self.compare_versions(installed_version, required_version) < 0:
|
|
407
|
-
raise OutdatedHalfORMDevError(
|
|
411
|
+
raise OutdatedHalfORMDevError(
|
|
412
|
+
required_version, installed_version, self.__base_dir)
|
|
408
413
|
except OutdatedHalfORMDevError:
|
|
409
414
|
# Re-raise downgrade errors immediately
|
|
410
415
|
raise
|
|
@@ -1120,7 +1125,8 @@ class Repo:
|
|
|
1120
1125
|
# Raise only when installed < required (tool too old).
|
|
1121
1126
|
# When installed > required, needs_migration() handles it via the CLI.
|
|
1122
1127
|
if self.compare_versions(installed_version, required_version) < 0:
|
|
1123
|
-
raise OutdatedHalfORMDevError(
|
|
1128
|
+
raise OutdatedHalfORMDevError(
|
|
1129
|
+
required_version, installed_version, self.__base_dir)
|
|
1124
1130
|
|
|
1125
1131
|
except RepoError:
|
|
1126
1132
|
# Re-raise RepoError (dirty working directory)
|
|
@@ -32,14 +32,13 @@ classifiers = [
|
|
|
32
32
|
"Topic :: Software Development :: Build Tools",
|
|
33
33
|
|
|
34
34
|
# Specify the Python versions you support here
|
|
35
|
-
"Programming Language :: Python :: 3.9",
|
|
36
|
-
"Programming Language :: Python :: 3.10",
|
|
37
35
|
"Programming Language :: Python :: 3.11",
|
|
38
36
|
"Programming Language :: Python :: 3.12",
|
|
39
37
|
"Programming Language :: Python :: 3.13",
|
|
40
38
|
"Programming Language :: Python :: 3.14",
|
|
39
|
+
"Programming Language :: Python :: 3.15",
|
|
41
40
|
]
|
|
42
|
-
requires-python = ">=3.
|
|
41
|
+
requires-python = ">=3.11"
|
|
43
42
|
dependencies = [
|
|
44
43
|
"half_orm_dev=={half_orm_dev_version}",
|
|
45
44
|
]
|
half_orm_dev/utils.py
CHANGED
|
@@ -13,6 +13,30 @@ def hop_version():
|
|
|
13
13
|
hop_v = version.read().strip()
|
|
14
14
|
return hop_v
|
|
15
15
|
|
|
16
|
+
def is_production_checkout(base_dir) -> bool:
|
|
17
|
+
"""Whether `base_dir` is the checkout of a production server.
|
|
18
|
+
|
|
19
|
+
Readable without a database connection, which is what the CLI needs
|
|
20
|
+
before it has one. Two marks, either of which is enough -- a production
|
|
21
|
+
server must not be taken for a development machine:
|
|
22
|
+
|
|
23
|
+
* ``.hop/production``, written by ``clone --production`` and read by
|
|
24
|
+
the git hooks;
|
|
25
|
+
* ``production = true`` in the connection file, which is what
|
|
26
|
+
half_orm_dev goes by once connected.
|
|
27
|
+
"""
|
|
28
|
+
if (Path(base_dir) / '.hop' / 'production').exists():
|
|
29
|
+
return True
|
|
30
|
+
try:
|
|
31
|
+
from half_orm.model import CONF_DIR
|
|
32
|
+
parser = configparser.ConfigParser()
|
|
33
|
+
if not parser.read(os.path.join(CONF_DIR, resolve_database_config_name(base_dir))):
|
|
34
|
+
return False
|
|
35
|
+
return parser.getboolean('database', 'production', fallback=False)
|
|
36
|
+
except (configparser.Error, ValueError, OSError):
|
|
37
|
+
return False
|
|
38
|
+
|
|
39
|
+
|
|
16
40
|
def resolve_database_config_name(base_dir):
|
|
17
41
|
"""
|
|
18
42
|
Resolve database configuration name with backward compatibility.
|
half_orm_dev/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
2.0.0-a1
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: half_orm_dev
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.0a1
|
|
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
|
|
@@ -9,13 +9,12 @@ Keywords: postgres,relation-object mapping
|
|
|
9
9
|
Classifier: Development Status :: 3 - Alpha
|
|
10
10
|
Classifier: Intended Audience :: Developers
|
|
11
11
|
Classifier: Topic :: Software Development :: Build Tools
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
14
12
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
16
14
|
Classifier: Programming Language :: Python :: 3.13
|
|
17
15
|
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
-
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
17
|
+
Requires-Python: >=3.11
|
|
19
18
|
Description-Content-Type: text/markdown
|
|
20
19
|
License-File: LICENSE
|
|
21
20
|
License-File: AUTHORS
|
|
@@ -25,11 +24,9 @@ Requires-Dist: packaging
|
|
|
25
24
|
Requires-Dist: pydash
|
|
26
25
|
Requires-Dist: pytest
|
|
27
26
|
Requires-Dist: pytest-asyncio
|
|
28
|
-
Requires-Dist:
|
|
29
|
-
Requires-Dist: tomli>=2.0.0; python_version < "3.11"
|
|
27
|
+
Requires-Dist: half-orm<3,>=2.0.0
|
|
30
28
|
Requires-Dist: tomli_w>=1.0.0
|
|
31
29
|
Dynamic: license-file
|
|
32
|
-
Dynamic: requires-dist
|
|
33
30
|
|
|
34
31
|
# half-orm-dev
|
|
35
32
|
|
|
@@ -39,7 +36,7 @@ Dynamic: requires-dist
|
|
|
39
36
|
|
|
40
37
|
**Git-centric patch management and PostgreSQL database versioning for half-orm projects**
|
|
41
38
|
|
|
42
|
-
[](https://www.python.org/downloads/)
|
|
43
40
|
[](https://www.gnu.org/licenses/gpl-3.0)
|
|
44
41
|
[](https://github.com/half-orm/half-orm)
|
|
45
42
|
[](https://pepy.tech/projects/half-orm-dev)
|
|
@@ -120,7 +117,7 @@ half_orm dev patch merge
|
|
|
120
117
|
|
|
121
118
|
### Prerequisites
|
|
122
119
|
|
|
123
|
-
- **Python**: [Active versions](https://devguide.python.org/versions/) (currently 3.
|
|
120
|
+
- **Python**: [Active versions](https://devguide.python.org/versions/) (currently 3.11+)
|
|
124
121
|
- **PostgreSQL**: [Supported versions](https://www.postgresql.org/support/versioning/) (currently 13+)
|
|
125
122
|
- **Git** for version control
|
|
126
123
|
|
|
@@ -3,27 +3,27 @@ half_orm_dev/_bootstrap_runner.py,sha256=6SyAXEMvALMA3MFtkoCxQ8hAIDHk_SOmjv8yTsM
|
|
|
3
3
|
half_orm_dev/cli_extension.py,sha256=AZ5BxNGzXZcM3_Q7FdRvCNL9Qgr2RYS00GiTgj7cARo,1325
|
|
4
4
|
half_orm_dev/database.py,sha256=1oD8tW-vefS_XWvuG50r-99ogwiwZYpgEYRhTh3LjO8,61777
|
|
5
5
|
half_orm_dev/decorators.py,sha256=xz04vhz34bOLC8tS_0Pd_dr0oScr7lC9VDfPmIcMOp0,6825
|
|
6
|
-
half_orm_dev/file_executor.py,sha256=
|
|
6
|
+
half_orm_dev/file_executor.py,sha256=g_cYNKwDvPoYA-A8tmUCdsfTQaVTJTpENhEEtmB0HJQ,12036
|
|
7
7
|
half_orm_dev/hgit.py,sha256=Uw24OQ__O7ViNMJsIgYocaKFpKLkIYGr_RJat87AbGA,71346
|
|
8
|
-
half_orm_dev/migration_manager.py,sha256=
|
|
9
|
-
half_orm_dev/modules.py,sha256=
|
|
8
|
+
half_orm_dev/migration_manager.py,sha256=53fwf7be_mf-XVByW5lpS7xUCXkci1poIwX12WsAAIY,31624
|
|
9
|
+
half_orm_dev/modules.py,sha256=H3hfxgqIGaonsnG0TEpnc_akP-FBhVKGfbgxocFR2bw,38593
|
|
10
10
|
half_orm_dev/patch_manager.py,sha256=k1bICZx3zGYqroSqJy4hXlwUOiTlrQ7pgwiEb0F8fyI,124300
|
|
11
11
|
half_orm_dev/patch_validator.py,sha256=QNe1L6k_xwsnrOTcb3vkW2D0LbqrCRcZOGPnVyspVRk,10871
|
|
12
12
|
half_orm_dev/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
-
half_orm_dev/release_file.py,sha256=
|
|
14
|
-
half_orm_dev/release_manager.py,sha256=
|
|
15
|
-
half_orm_dev/repo.py,sha256=
|
|
16
|
-
half_orm_dev/utils.py,sha256=
|
|
13
|
+
half_orm_dev/release_file.py,sha256=Z22_daoomLv9nKdZ_kKa-jPugPhjoLlIvhqH0Lns9_Q,12272
|
|
14
|
+
half_orm_dev/release_manager.py,sha256=fgyJxlO2LGerZdtITGopGFBdu77M-KtPc_YCRbSkbmo,140016
|
|
15
|
+
half_orm_dev/repo.py,sha256=dpLuqXi0WGSdQEfwmhERAIoOLte-xjK1frVQLemrGYk,124760
|
|
16
|
+
half_orm_dev/utils.py,sha256=ePAgOnXstk7LlYW1cqsrCfeSbsqTedjKR_Eh7wV2hkY,2599
|
|
17
17
|
half_orm_dev/venv_setup.py,sha256=baC8KWzrJ1pll1HL1QMy7zceilMVBduhLuPpC4VMKTc,2238
|
|
18
|
-
half_orm_dev/version.txt,sha256=
|
|
18
|
+
half_orm_dev/version.txt,sha256=MOGt5KjK5gTHOU_EwvQLegNvTFMSP6uspEQLXbjS-V0,9
|
|
19
19
|
half_orm_dev/cli/__init__.py,sha256=0CbMj8OIhZmglWakK7NhYPn302erUTEg2VHOdm1hRTQ,163
|
|
20
|
-
half_orm_dev/cli/main.py,sha256=
|
|
20
|
+
half_orm_dev/cli/main.py,sha256=6doPubtvgXpv4q9Oc3-Ttt7AI8sDW0EoBSweg4C3n-c,16832
|
|
21
21
|
half_orm_dev/cli/commands/__init__.py,sha256=X-0RWsRIeqTBV03G_VK0fAmeZUcWdNy_LCkEeyNHBQs,1669
|
|
22
22
|
half_orm_dev/cli/commands/apply.py,sha256=6Sne5T6DQlPmHzY_9XR6srjAQnDNguB-jbA2IEDnzCk,211
|
|
23
23
|
half_orm_dev/cli/commands/check.py,sha256=6Dyk8NC-wC7e5gdUBEi9E94nCxU5hX_HYlGOrvJV97w,22443
|
|
24
24
|
half_orm_dev/cli/commands/clone.py,sha256=z2vH4Zxvjwrcos0gGdZl138LuxJoJI9ma2BDqqCoY_k,4624
|
|
25
25
|
half_orm_dev/cli/commands/init.py,sha256=t3WDqnHQHEO1Spx4dqxuaePo_dzGKs47WE_QvRCo9B0,13515
|
|
26
|
-
half_orm_dev/cli/commands/migrate.py,sha256=
|
|
26
|
+
half_orm_dev/cli/commands/migrate.py,sha256=ZozJKkjkD4ZBSccgj_MuY7RZFWNct2p2GgPRoO1s7nM,6699
|
|
27
27
|
half_orm_dev/cli/commands/patch.py,sha256=wmR3XmOIdJB3nzXd181yOdyxlxBsA2ZIQ6Ed4Mv_dg4,16704
|
|
28
28
|
half_orm_dev/cli/commands/recover.py,sha256=SZrM84CgaBxmkDAgjU1YGp0LMw6C1WSteh1FybB0ppc,1553
|
|
29
29
|
half_orm_dev/cli/commands/release.py,sha256=x1M-GCoFnQ6CJR8H19zWd6_v1229U0-d2dELn00iSeQ,19913
|
|
@@ -37,7 +37,7 @@ half_orm_dev/cli/commands/undo.py,sha256=GWUawPd71YPpY5Lx4E7zyoGlY0ZD4c8zIbh-ddo
|
|
|
37
37
|
half_orm_dev/cli/commands/upgrade.py,sha256=NcVjR_zbM9S3vrx-fRCk_K6JfZo24EvmYkAjw2KoRTg,7210
|
|
38
38
|
half_orm_dev/migrations/0/17/1/00_move_to_hop.py,sha256=esXYcdgNUJfUQUCtD_BBxHbdQi7_s4nWJ8bJYNIUfY4,4000
|
|
39
39
|
half_orm_dev/migrations/0/17/1/01_txt_to_toml.py,sha256=CJQo4-DTI0tPBD6VXNo0HsNkG2fkSxHAcQ-5cwXVt_4,4995
|
|
40
|
-
half_orm_dev/migrations/0/17/4/00_toml_dict_format.py,sha256=
|
|
40
|
+
half_orm_dev/migrations/0/17/4/00_toml_dict_format.py,sha256=KW2thLIFEqWZdhlkJ4Cb_KfdpdwpHMA7V0NCAHxLHp4,6178
|
|
41
41
|
half_orm_dev/migrations/0/17/4/02_move_patches_to_subdirs.py,sha256=gkDzc3RtxL5ZQHlNH3mKpt7mfKt8Pgz4hBnb_cS4Pjg,6015
|
|
42
42
|
half_orm_dev/migrations/0/17/5/01_update_pyproject_dependency.py,sha256=GKY4Ya0W0cd4sg4bQw1k1UqwleZxUCl69mlDW-0b9uM,4120
|
|
43
43
|
half_orm_dev/migrations/0/18/0/00_add_async_support.py,sha256=DL2eixXVNcPywW14BWmoOWS7NnTZPU1NeiV5l8PkyFg,6101
|
|
@@ -61,7 +61,7 @@ half_orm_dev/templates/init_module_template,sha256=NNrPwEhVERO1eJgfGvL3ZOSDhX5Fs
|
|
|
61
61
|
half_orm_dev/templates/module_template_1,sha256=q0Zxva_dZr532jfZF0aDb8ROb6sREJPqbO_mfF9yQXo,279
|
|
62
62
|
half_orm_dev/templates/module_template_2,sha256=-1HrycvYbBlK2YVObEM87qn1fUTjWSQNsIVZQ3aiag8,90
|
|
63
63
|
half_orm_dev/templates/module_template_3,sha256=yjpQYT0EsIA6TI8KeyFaw_nHP9zCBma6o7g3P1MDs_M,187
|
|
64
|
-
half_orm_dev/templates/pyproject.toml,sha256=
|
|
64
|
+
half_orm_dev/templates/pyproject.toml,sha256=XnEAmt-wK-HG5kEAgEB8YmxgXo8ceokrNIDlKHh0jzo,1573
|
|
65
65
|
half_orm_dev/templates/relation_test,sha256=99UIRhjP8fV141f_yoyC7HAZ4May7TPKzotHEcFfLpA,1189
|
|
66
66
|
half_orm_dev/templates/sql_adapter,sha256=kAP5y7Qml3DKsbZLUeoVpeXjbQcWltHjkDznEDKNpek,190
|
|
67
67
|
half_orm_dev/templates/warning,sha256=4hlZ_rRdpmkXxOeRoVd9xnXBARYXn95e-iXrD1f2u7k,490
|
|
@@ -69,10 +69,10 @@ half_orm_dev/templates/git-hooks/pre-commit,sha256=V0uFzmxDK1jAYZzY_qWx6VuUwTUPI
|
|
|
69
69
|
half_orm_dev/templates/git-hooks/pre-push,sha256=7TsdE7oo7eMT7R_Tlu5P_WhHAx1aTHVFb9y-RdRB1q0,660
|
|
70
70
|
half_orm_dev/templates/git-hooks/prepare-commit-msg,sha256=zknOGGoaWKC97zfga2Xl2i_psnNo9MJbrEBuN91eHNw,1070
|
|
71
71
|
half_orm_dev/templates/git-hooks/reference-transaction,sha256=NfOCL7GOVpUPydNd3KxNKrZcLL1xfyPIPnH-hym1Ezc,908
|
|
72
|
-
half_orm_dev-
|
|
73
|
-
half_orm_dev-
|
|
74
|
-
half_orm_dev-
|
|
75
|
-
half_orm_dev-
|
|
76
|
-
half_orm_dev-
|
|
77
|
-
half_orm_dev-
|
|
78
|
-
half_orm_dev-
|
|
72
|
+
half_orm_dev-2.0.0a1.dist-info/licenses/AUTHORS,sha256=eWxqzRdLOt2gX0FMQj_wui03Od3jdlwa8xNe9tl84g0,113
|
|
73
|
+
half_orm_dev-2.0.0a1.dist-info/licenses/LICENSE,sha256=ufhxlSi6mttkGQTsGWrEoB3WA_fCPJ6-k07GSVBgyPw,644
|
|
74
|
+
half_orm_dev-2.0.0a1.dist-info/METADATA,sha256=eY2FEKGY75YhJESTf_fZPv_hE1DhETbqvznWovF7E0k,18870
|
|
75
|
+
half_orm_dev-2.0.0a1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
76
|
+
half_orm_dev-2.0.0a1.dist-info/entry_points.txt,sha256=nqKmPzobb2XqO-y-rsh0nKL4peBvzLmo2mQID9Jrxpw,47
|
|
77
|
+
half_orm_dev-2.0.0a1.dist-info/top_level.txt,sha256=M5hEsWfn5Kw0HL-VnNmS6Jw-3cwRyjims5a8cr18eTM,13
|
|
78
|
+
half_orm_dev-2.0.0a1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|