dmart 1.4.14__py3-none-any.whl → 1.4.16__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.
bundler.py CHANGED
@@ -36,9 +36,12 @@ args = [
36
36
  '--runtime-tmpdir=.',
37
37
  '--distpath=.',
38
38
  '--add-data=./info.json:.',
39
+ '--add-data=dmart_migrations:dmart_migrations',
40
+ '--add-data=alembic.ini:.',
39
41
  '--noconfirm',
40
42
  '--collect-submodules=concurrent_log_handler',
41
43
  '--collect-submodules=pythonjsonlogger',
44
+ '--collect-all=alembic',
42
45
  '--clean',
43
46
  ]
44
47
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dmart
3
- Version: 1.4.14
3
+ Version: 1.4.16
4
4
  Requires-Python: >=3.11
5
5
  Requires-Dist: fastapi
6
6
  Requires-Dist: pydantic
@@ -1,7 +1,7 @@
1
1
  alembic.ini,sha256=zs8d8VhH9TRwZrPK697EZPBCfaKvI4SqTuGuG0FAm2Y,3747
2
- bundler.py,sha256=so8ZJResb1PcOH5vboa_mpFAdYr_T8u8DbbFXd570Lg,1704
2
+ bundler.py,sha256=MDTUTVS0WL7gb-i1rDcS4i37KTqaW88TluL4L3rwjRw,1817
3
3
  data_generator.py,sha256=CnE-VHEeX7-lAXtqCgbRqR9WHjTuOgeiZcviYrHAmho,2287
4
- dmart.py,sha256=HHCKuf_JomcSCwWs2QWH4FKNhCZa-r5kgbk0r6vcAEQ,24117
4
+ dmart.py,sha256=M6ALx41TSjzpcEczkx39aA9qdmWZk_CS2jRpU61-aEY,23288
5
5
  get_settings.py,sha256=Sbe2WCoiK398E7HY4SNLfDN_GmE8knR4M-YJWF31jcg,153
6
6
  info.json,sha256=hXQWl19lfMkEj_zXdehGeKjiKGNJ7emY4S7d4pIqJ1E,123
7
7
  main.py,sha256=KZGhIL6AnEm5ZAPy4IvhBDpzSTjuodilV7NafNOyhzM,19676
@@ -282,8 +282,8 @@ utils/ticket_sys_utils.py,sha256=9QAlW2iiy8KyxQRBDj_WmzS5kKb0aYJmGwd4qzmGVqo,700
282
282
  utils/web_notifier.py,sha256=QM87VVid2grC5lK3NdS1yzz0z1wXljr4GChJOeK86W4,843
283
283
  utils/templates/activation.html.j2,sha256=XAMKCdoqONoc4ZQucD0yV-Pg5DlHHASZrTVItNS-iBE,640
284
284
  utils/templates/reminder.html.j2,sha256=aoS8bTs56q4hjAZKsb0jV9c-PIURBELuBOpT_qPZNVU,639
285
- dmart-1.4.14.dist-info/METADATA,sha256=H9gFXc-9yiV-o41d2QeSLIcFWjIJn041SLM6Ktc5_oY,2069
286
- dmart-1.4.14.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
287
- dmart-1.4.14.dist-info/entry_points.txt,sha256=GjfoGh1bpxuU9HHGJzbtCFPNptHv9TryxHMN3uBSKpg,37
288
- dmart-1.4.14.dist-info/top_level.txt,sha256=XELQhaIfj-qupnyBrir39qFRh8ncu1RXkCHeitzqLLg,275
289
- dmart-1.4.14.dist-info/RECORD,,
285
+ dmart-1.4.16.dist-info/METADATA,sha256=Q_DCo5Avjc2w6n4CaUtDwCoiyzesOI9Ss3GZV-7n6OQ,2069
286
+ dmart-1.4.16.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
287
+ dmart-1.4.16.dist-info/entry_points.txt,sha256=GjfoGh1bpxuU9HHGJzbtCFPNptHv9TryxHMN3uBSKpg,37
288
+ dmart-1.4.16.dist-info/top_level.txt,sha256=XELQhaIfj-qupnyBrir39qFRh8ncu1RXkCHeitzqLLg,275
289
+ dmart-1.4.16.dist-info/RECORD,,
dmart.py CHANGED
@@ -18,6 +18,13 @@ from pathlib import Path
18
18
  from hypercorn.config import Config
19
19
  from hypercorn.run import run
20
20
 
21
+ try:
22
+ from alembic import command as alembic_command
23
+ from alembic.config import Config as AlembicConfig
24
+ HAS_ALEMBIC = True
25
+ except ImportError:
26
+ HAS_ALEMBIC = False
27
+
21
28
  from data_adapters.file.archive import archive
22
29
  from data_adapters.file.create_index import main as create_index
23
30
  from data_adapters.file.health_check import main as health_check
@@ -551,36 +558,16 @@ def main():
551
558
  sys.exit(1)
552
559
 
553
560
  try:
554
- # Check if alembic library is installed using importlib.metadata
555
- import importlib.metadata
556
- try:
557
- importlib.metadata.version('alembic')
558
- except importlib.metadata.PackageNotFoundError:
561
+ # Check if alembic library is installed
562
+ if not HAS_ALEMBIC:
559
563
  print("Error: 'alembic' library not found. Please install it with 'pip install alembic'.")
560
564
  sys.exit(1)
561
565
 
562
- import tempfile
563
- import re
564
- # Create a temporary alembic.ini to override script_location with absolute path
565
- with tempfile.NamedTemporaryFile(mode='w', suffix='.ini', delete=False) as tf:
566
- with open(original_ini_path, 'r') as f:
567
- content = f.read()
568
-
569
- content = re.sub(r'^script_location\s*=.*$', f'script_location = {alembic_dir.as_posix()}', content, flags=re.MULTILINE)
570
- tf.write(content)
571
- temp_ini_path = tf.name
572
-
573
- try:
574
- # Run alembic upgrade head
575
- result = subprocess.run(
576
- [sys.executable, "-m", "alembic", "-c", temp_ini_path, "upgrade", "head"],
577
- cwd=pkg_dir
578
- )
579
- if result.returncode != 0:
580
- sys.exit(result.returncode)
581
- finally:
582
- if os.path.exists(temp_ini_path):
583
- os.unlink(temp_ini_path)
566
+ alembic_cfg = AlembicConfig(str(original_ini_path))
567
+ alembic_cfg.set_main_option("script_location", alembic_dir.as_posix())
568
+
569
+ # Run alembic upgrade head
570
+ alembic_command.upgrade(alembic_cfg, "head")
584
571
 
585
572
  except Exception as e:
586
573
  print(f"Error running migration: {e}")
File without changes