pum 1.1.3__py3-none-any.whl → 1.1.4__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.
pum/config_model.py CHANGED
@@ -26,6 +26,12 @@ class ParameterDefinitionModel(PumCustomBaseModel):
26
26
  default: Optional[Any] = None
27
27
  description: Optional[str] = None
28
28
 
29
+ @model_validator(mode="before")
30
+ def validate_default(cls, values):
31
+ if values.get("type") == ParameterType.BOOLEAN:
32
+ values["default"] = values.get("default", False) in (1, "1", "true", "TRUE", True)
33
+ return values
34
+
29
35
 
30
36
  class HookModel(PumCustomBaseModel):
31
37
  """
pum/pum_config.py CHANGED
@@ -25,7 +25,7 @@ try:
25
25
  except importlib.metadata.PackageNotFoundError:
26
26
  # Fallback: try to read from pum-*.dist-info/METADATA
27
27
  dist_info_dirs = glob.glob(os.path.join(os.path.dirname(__file__), "..", "pum-*.dist-info"))
28
- version = None
28
+ versions = []
29
29
  for dist_info in dist_info_dirs:
30
30
  metadata_path = os.path.join(dist_info, "METADATA")
31
31
  if os.path.isfile(metadata_path):
@@ -33,11 +33,11 @@ except importlib.metadata.PackageNotFoundError:
33
33
  for line in f:
34
34
  if line.startswith("Version:"):
35
35
  version = line.split(":", 1)[1].strip()
36
+ versions.append(version)
36
37
  break
37
- if version:
38
- break
39
- if version:
40
- PUM_VERSION = packaging.version.Version(version)
38
+ if versions:
39
+ # Pick the highest version
40
+ PUM_VERSION = max((packaging.version.Version(v) for v in versions))
41
41
  else:
42
42
  PUM_VERSION = packaging.version.Version("0.0.0")
43
43
 
@@ -137,6 +137,17 @@ class PumConfig:
137
137
  """Return the base path used for configuration and changelogs."""
138
138
  return self._base_path
139
139
 
140
+ def parameters(self) -> list[ParameterDefinition]:
141
+ """Return a list of migration parameters.
142
+
143
+ Returns:
144
+ list[ParameterDefinition]: A list of migration parameter definitions.
145
+
146
+ """
147
+ return [
148
+ ParameterDefinition(**parameter.model_dump()) for parameter in self.config.parameters
149
+ ]
150
+
140
151
  def parameter(self, name: str) -> ParameterDefinition:
141
152
  """Get a specific migration parameter by name.
142
153
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pum
3
- Version: 1.1.3
3
+ Version: 1.1.4
4
4
  Summary: Pum stands for "Postgres Upgrades Manager". It is a Database migration management tool very similar to flyway-db or Liquibase, based on metadata tables.
5
5
  Author-email: Denis Rouzaud <denis@opengis.ch>
6
6
  License-Expression: GPL-2.0-or-later
@@ -2,22 +2,22 @@ pum/__init__.py,sha256=P-NHd6_SYpk9aypefLI62QCZ3f5APOMCwSzrFFCKAew,759
2
2
  pum/changelog.py,sha256=yDc5swmMd5gb2vCEAlenoq5gs-ZEGc4uXicBtiGxkOk,3692
3
3
  pum/checker.py,sha256=GT2v7793HP1g94dv0mL6CHtQfblQwAyeFHEWCy44lkc,14379
4
4
  pum/cli.py,sha256=nnuApRDXgWaiBZXw2F3iwUxI5nzfIqyMdwhTXS-Jde8,14045
5
- pum/config_model.py,sha256=8FREAJpnm6-4Mby_udKpNo4WPbgn-4ZL1e-02a2FUFY,6147
5
+ pum/config_model.py,sha256=piSQBYp29gnzqmtN50_OUw5o9d7Q5dEzj4q6G7cIFik,6396
6
6
  pum/dependency_handler.py,sha256=34wvDGWlI-vsMFm1z0XcSDN2cnL_VFAh61GWmeYEzk4,3841
7
7
  pum/dumper.py,sha256=EJZ8T44JM0GKgdqw1ENOfhZ-RI89OQ4DNdoTZKtLdEw,3404
8
8
  pum/exceptions.py,sha256=xyzzY4ht1nKfrVt59Giulflpmu83nJhxoTygrqiqPlw,1137
9
9
  pum/hook.py,sha256=L4Cnr34zrgPzxso9CdsUYWmtuOXRmFccQZ9Lp4IYCBM,9326
10
10
  pum/info.py,sha256=VSCUZJJ_ae-khKaudwbgqszZXBMKB_yskuQo5Mc1PgY,1024
11
11
  pum/parameter.py,sha256=e9f80kMZpART9laeImW_YECeTvwDyDSmZlTeJGvpS_8,2449
12
- pum/pum_config.py,sha256=CpvYWstLTlb7S1VW4O2vIKF2WKP7EYSLwMq7mmA1DGs,10823
12
+ pum/pum_config.py,sha256=xTEdYh-628pnkoqH56NoPIuhIQauc1d6hksM8hcCCU4,11232
13
13
  pum/role_manager.py,sha256=yr-fmytflGqANY3IZIpgJBoMOK98ynTWfemIBhAy79A,10131
14
14
  pum/schema_migrations.py,sha256=FiaqAbhFX7vd3Rk_R43kd7-QWfil-Q5587EU8xSLBkA,10504
15
15
  pum/sql_content.py,sha256=gwgvcdXOXxNz3RvLtL8Bqr5WO3KKq3sluhbj4OAEnQs,9756
16
16
  pum/upgrader.py,sha256=jvl6vmpgxGyYiw8rrWC_bDC7Zd4wHJqGLXCK8EMt9wY,7109
17
17
  pum/conf/pum_config_example.yaml,sha256=_nwV_7z6S_Se-mejh_My0JFLY-A0Q4nigeLGPZAfcqg,424
18
- pum-1.1.3.dist-info/licenses/LICENSE,sha256=2ylvL381vKOhdO-w6zkrOxe9lLNBhRQpo9_0EbHC_HM,18046
19
- pum-1.1.3.dist-info/METADATA,sha256=by7AyhgM96XfhiZo3bKomPlDD19sewYqORvTIdn26w8,3138
20
- pum-1.1.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
21
- pum-1.1.3.dist-info/entry_points.txt,sha256=U6dmxSpKs1Pe9vWiR29VPhJMDjrmZeJCSxvfLGR8BD4,36
22
- pum-1.1.3.dist-info/top_level.txt,sha256=ddiI4HLBhY6ql-NNm0Ez0JhoOHdWDIzrHeCdHmmagcc,4
23
- pum-1.1.3.dist-info/RECORD,,
18
+ pum-1.1.4.dist-info/licenses/LICENSE,sha256=2ylvL381vKOhdO-w6zkrOxe9lLNBhRQpo9_0EbHC_HM,18046
19
+ pum-1.1.4.dist-info/METADATA,sha256=eZOs5rKpdCVJJR1BSQKeTjMdhneE57kZMrNaTnv-US8,3138
20
+ pum-1.1.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
21
+ pum-1.1.4.dist-info/entry_points.txt,sha256=U6dmxSpKs1Pe9vWiR29VPhJMDjrmZeJCSxvfLGR8BD4,36
22
+ pum-1.1.4.dist-info/top_level.txt,sha256=ddiI4HLBhY6ql-NNm0Ez0JhoOHdWDIzrHeCdHmmagcc,4
23
+ pum-1.1.4.dist-info/RECORD,,
File without changes