dmart 1.4.20__py3-none-any.whl → 1.4.22__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dmart
3
- Version: 1.4.20
3
+ Version: 1.4.22
4
4
  Requires-Python: >=3.11
5
5
  Requires-Dist: fastapi
6
6
  Requires-Dist: pydantic
@@ -1,6 +1,6 @@
1
1
  bundler.py,sha256=MDTUTVS0WL7gb-i1rDcS4i37KTqaW88TluL4L3rwjRw,1817
2
2
  data_generator.py,sha256=CnE-VHEeX7-lAXtqCgbRqR9WHjTuOgeiZcviYrHAmho,2287
3
- dmart.py,sha256=mG4TCkITYoUajlHsPJ_BZUBMu2G8gxvB7bidYfKoSHA,24498
3
+ dmart.py,sha256=T63eUgBZXSWYIi6GRaRBdHQvnZ4HGam46naY0gTlI4c,24705
4
4
  get_settings.py,sha256=Sbe2WCoiK398E7HY4SNLfDN_GmE8knR4M-YJWF31jcg,153
5
5
  info.json,sha256=hXQWl19lfMkEj_zXdehGeKjiKGNJ7emY4S7d4pIqJ1E,123
6
6
  main.py,sha256=KZGhIL6AnEm5ZAPy4IvhBDpzSTjuodilV7NafNOyhzM,19676
@@ -272,8 +272,8 @@ utils/ticket_sys_utils.py,sha256=9QAlW2iiy8KyxQRBDj_WmzS5kKb0aYJmGwd4qzmGVqo,700
272
272
  utils/web_notifier.py,sha256=QM87VVid2grC5lK3NdS1yzz0z1wXljr4GChJOeK86W4,843
273
273
  utils/templates/activation.html.j2,sha256=XAMKCdoqONoc4ZQucD0yV-Pg5DlHHASZrTVItNS-iBE,640
274
274
  utils/templates/reminder.html.j2,sha256=aoS8bTs56q4hjAZKsb0jV9c-PIURBELuBOpT_qPZNVU,639
275
- dmart-1.4.20.dist-info/METADATA,sha256=MTGSY6tBlgUmFtLj4RP40CIZbMsFGbMGG2Jo41hv_hY,2149
276
- dmart-1.4.20.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
277
- dmart-1.4.20.dist-info/entry_points.txt,sha256=GjfoGh1bpxuU9HHGJzbtCFPNptHv9TryxHMN3uBSKpg,37
278
- dmart-1.4.20.dist-info/top_level.txt,sha256=S-gfX1pLerapNXiHZ8lvPYoV7sgwSX2_NCZ6xfzDUHM,267
279
- dmart-1.4.20.dist-info/RECORD,,
275
+ dmart-1.4.22.dist-info/METADATA,sha256=Et0n5lf20vuttHiL3AOs-psMuNhC883LbbQQGZ0yMTE,2149
276
+ dmart-1.4.22.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
277
+ dmart-1.4.22.dist-info/entry_points.txt,sha256=GjfoGh1bpxuU9HHGJzbtCFPNptHv9TryxHMN3uBSKpg,37
278
+ dmart-1.4.22.dist-info/top_level.txt,sha256=S-gfX1pLerapNXiHZ8lvPYoV7sgwSX2_NCZ6xfzDUHM,267
279
+ dmart-1.4.22.dist-info/RECORD,,
dmart.py CHANGED
@@ -18,10 +18,9 @@ from pathlib import Path
18
18
  from hypercorn.config import Config
19
19
  from hypercorn.run import run
20
20
 
21
+ # Try to import alembic
21
22
  try:
22
- # Try to import alembic
23
23
  import alembic
24
-
25
24
  # Check if we are importing the local alembic directory which is likely a leftover
26
25
  if hasattr(alembic, '__path__'):
27
26
  local_alembic_path = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'alembic'))
@@ -38,7 +37,10 @@ try:
38
37
  import alembic
39
38
  except Exception:
40
39
  pass
40
+ except ImportError:
41
+ pass
41
42
 
43
+ try:
42
44
  from alembic import command as alembic_command
43
45
  from alembic.config import Config as AlembicConfig
44
46
  HAS_ALEMBIC = True
@@ -412,27 +414,29 @@ def hypercorn_main() -> int:
412
414
 
413
415
 
414
416
  def main():
415
- sys.argv = sys.argv[1:]
416
- if len(sys.argv) == 0:
417
+ global sys
418
+
419
+ args = sys.argv[1:]
420
+ if len(args) == 0:
417
421
  print("You must provide a command to run:")
418
422
  print(commands)
419
423
  sys.exit(1)
420
424
 
421
- match sys.argv[0]:
425
+ match args[0]:
422
426
  case "hyper":
423
427
  hypercorn_main()
424
428
  case "server" | "serve":
425
429
  open_cxb = False
426
- if "--open-cxb" in sys.argv:
430
+ if "--open-cxb" in args:
427
431
  open_cxb = True
428
- sys.argv.remove("--open-cxb")
432
+ args.remove("--open-cxb")
429
433
 
430
- if "--cxb-config" in sys.argv:
431
- idx = sys.argv.index("--cxb-config")
432
- if idx + 1 < len(sys.argv):
433
- os.environ["DMART_CXB_CONFIG"] = sys.argv[idx + 1]
434
- sys.argv.pop(idx + 1)
435
- sys.argv.pop(idx)
434
+ if "--cxb-config" in args:
435
+ idx = args.index("--cxb-config")
436
+ if idx + 1 < len(args):
437
+ os.environ["DMART_CXB_CONFIG"] = args[idx + 1]
438
+ args.pop(idx + 1)
439
+ args.pop(idx)
436
440
 
437
441
  if open_cxb:
438
442
  url = f"http://{settings.listening_host}:{settings.listening_port}/cxb/"
@@ -443,6 +447,7 @@ def main():
443
447
  import threading
444
448
  threading.Thread(target=open_browser, daemon=True).start()
445
449
 
450
+ sys.argv = [sys.argv[0]] + args
446
451
  asyncio.run(server())
447
452
  case "health-check":
448
453
  parser = argparse.ArgumentParser(
@@ -453,9 +458,9 @@ def main():
453
458
  parser.add_argument("-s", "--space", help="hit the target space or pass (all) to make the full health check")
454
459
  parser.add_argument("-m", "--schemas", nargs="*", help="hit the target schema inside the space")
455
460
 
456
- args = parser.parse_args()
461
+ args_parsed = parser.parse_args(args[1:])
457
462
  before_time = time.time()
458
- asyncio.run(health_check(args.type, args.space, args.schemas))
463
+ asyncio.run(health_check(args_parsed.type, args_parsed.space, args_parsed.schemas))
459
464
  print(f'total time: {"{:.2f}".format(time.time() - before_time)} sec')
460
465
  case "create-index":
461
466
  parser = argparse.ArgumentParser(
@@ -473,9 +478,9 @@ def main():
473
478
  "--flushall", action='store_true', help="FLUSHALL data on Redis"
474
479
  )
475
480
 
476
- args = parser.parse_args()
481
+ args_parsed = parser.parse_args(args[1:])
477
482
 
478
- asyncio.run(create_index(args.space, args.schemas, args.subpaths, args.flushall))
483
+ asyncio.run(create_index(args_parsed.space, args_parsed.schemas, args_parsed.subpaths, args_parsed.flushall))
479
484
  case "export":
480
485
  parser = argparse.ArgumentParser()
481
486
  parser.add_argument(
@@ -492,24 +497,24 @@ def main():
492
497
  "--since",
493
498
  help="Export entries created/updated since the provided timestamp",
494
499
  )
495
- args = parser.parse_args()
500
+ args_parsed = parser.parse_args(args[1:])
496
501
  since = None
497
502
  output_path = ""
498
- if args.output:
499
- output_path = args.output
503
+ if args_parsed.output:
504
+ output_path = args_parsed.output
500
505
 
501
- if args.since:
502
- since = int(round(float(args.since) * 1000))
506
+ if args_parsed.since:
507
+ since = int(round(float(args_parsed.since) * 1000))
503
508
 
504
- if not os.path.isdir(args.spaces):
505
- exit_with_error(f"The spaces folder {args.spaces} is not found.")
509
+ if not os.path.isdir(args_parsed.spaces):
510
+ exit_with_error(f"The spaces folder {args_parsed.spaces} is not found.")
506
511
 
507
512
  out_path = os.path.join(output_path, OUTPUT_FOLDER_NAME)
508
513
  if os.path.isdir(out_path):
509
514
  shutil.rmtree(out_path)
510
515
 
511
516
  tasks = []
512
- with open(args.config, "r") as f:
517
+ with open(args_parsed.config, "r") as f:
513
518
  config_objs = json.load(f)
514
519
 
515
520
  for config_obj in config_objs:
@@ -521,7 +526,7 @@ def main():
521
526
  config_obj.get("schema_shortname", ""),
522
527
  config_obj.get("included_meta_fields", {}),
523
528
  config_obj.get("excluded_payload_fields", {}),
524
- args.spaces, output_path, since))
529
+ args_parsed.spaces, output_path, since))
525
530
 
526
531
  asyncio.run(exporter(tasks))
527
532
 
@@ -550,11 +555,11 @@ def main():
550
555
  help="The number of day, older than which, the entries will be archived (based on updated_at)",
551
556
  )
552
557
 
553
- args = parser.parse_args()
554
- space = args.space
555
- subpath = args.subpath
556
- olderthan = args.olderthan
557
- schema = args.schema or "meta"
558
+ args_parsed = parser.parse_args(args[1:])
559
+ space = args_parsed.space
560
+ subpath = args_parsed.subpath
561
+ olderthan = args_parsed.olderthan
562
+ schema = args_parsed.schema or "meta"
558
563
 
559
564
  asyncio.run(archive(space, subpath, schema, olderthan))
560
565
  print("Done.")
@@ -585,7 +590,6 @@ def main():
585
590
  print("Error: 'alembic' library not found. Please install it with 'pip install alembic'.")
586
591
  if ALEMBIC_ERROR:
587
592
  print(f"Details: {ALEMBIC_ERROR}")
588
- import sys
589
593
  print(f"Python executable: {sys.executable}")
590
594
  print(f"sys.path: {sys.path}")
591
595
  sys.exit(1)
File without changes