dmart 1.4.40.post1__py3-none-any.whl → 1.4.40.post3__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.
dmart/cli.py CHANGED
@@ -68,11 +68,11 @@ pretty.install()
68
68
  class Settings(BaseSettings):
69
69
  url: str = "http://localhost:8282"
70
70
  shortname: str = "dmart"
71
- password: str = "password"
72
- query_limit: int = 100
71
+ password: str = "xxxx"
72
+ query_limit: int = 50
73
73
  retrieve_json_payload: bool = True
74
74
  default_space: str = "management"
75
- pagination: int = 5
75
+ pagination: int = 50
76
76
 
77
77
  model_config = SettingsConfigDict(env_file = os.getenv("BACKEND_ENV", os.path.dirname(os.path.realpath(__file__)) + "/config.ini"), env_file_encoding = "utf-8")
78
78
 
@@ -932,8 +932,7 @@ def action(text: str):
932
932
  idx += 1
933
933
  finally:
934
934
  termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
935
- return None
936
- # c = input("q: quite, b: previous, n: next = ")
935
+ # c = input("q: quite, b: previous, n: next = ")
937
936
  # print(tree)
938
937
  dmart.current_space, dmart.current_subpath = old_space, old_subpath
939
938
  dmart.list()
@@ -988,8 +987,8 @@ def _(event):
988
987
  event.current_buffer.validate_and_handle()
989
988
 
990
989
 
991
- if __name__ == "__main__":
992
- try :
990
+ def main():
991
+ try:
993
992
  # print(Panel.fit("For help, type : [bold]?[/]", title="DMart Cli"))
994
993
  print("[bold][green]DMART[/] [yellow]Command line interface[/][/]")
995
994
  print(
@@ -1019,6 +1018,7 @@ if __name__ == "__main__":
1019
1018
  key_bindings=key_bindings
1020
1019
  )
1021
1020
 
1021
+ global mode
1022
1022
  if len(sys.argv) >= 2:
1023
1023
  if sys.argv[1] == "s":
1024
1024
  mode = CLI_MODE.SCRIPT
@@ -1031,8 +1031,34 @@ if __name__ == "__main__":
1031
1031
  else:
1032
1032
  check_update_space(sys.argv[2])
1033
1033
  del sys.argv[2]
1034
- del sys.argv[0]
1035
- del sys.argv[0]
1034
+ del sys.argv[0]
1035
+ del sys.argv[0]
1036
+ elif sys.argv[1] == "cli":
1037
+ # When called via 'dmart cli ...'
1038
+ if len(sys.argv) >= 3:
1039
+ if sys.argv[2] == "s":
1040
+ mode = CLI_MODE.SCRIPT
1041
+ del sys.argv[0] # dmart
1042
+ del sys.argv[0] # cli
1043
+ del sys.argv[0] # s
1044
+ elif sys.argv[2] == "c":
1045
+ mode = CLI_MODE.CMD
1046
+ if len(sys.argv) >= 5 and sys.argv[4].startswith("/"):
1047
+ check_update_space(sys.argv[3], sys.argv[4])
1048
+ del sys.argv[3]
1049
+ del sys.argv[3]
1050
+ elif len(sys.argv) >= 4:
1051
+ check_update_space(sys.argv[3])
1052
+ del sys.argv[3]
1053
+ del sys.argv[0] # dmart
1054
+ del sys.argv[0] # cli
1055
+ del sys.argv[0] # c
1056
+ else:
1057
+ del sys.argv[0]
1058
+ del sys.argv[0]
1059
+ else:
1060
+ del sys.argv[0]
1061
+ del sys.argv[0]
1036
1062
 
1037
1063
  if mode == CLI_MODE.CMD:
1038
1064
  print(sys.argv)
@@ -1099,5 +1125,9 @@ if __name__ == "__main__":
1099
1125
  # else:
1100
1126
  # print('You entered:', repr(text))
1101
1127
  print("[yellow]Good bye![/]")
1102
- except requests.exceptions.ConnectionError as _ :
1103
- print("[yellow]Connection error[/]")
1128
+ except requests.exceptions.ConnectionError as _ :
1129
+ print("[yellow]Connection error[/]")
1130
+
1131
+
1132
+ if __name__ == "__main__":
1133
+ main()
dmart/dmart.py CHANGED
@@ -435,11 +435,41 @@ def main():
435
435
  home_config = Path.home() / ".dmart" / "config.ini"
436
436
  if home_config.exists():
437
437
  config_file = str(home_config)
438
+ else:
439
+ # Create default config
440
+ try:
441
+ home_config.parent.mkdir(parents=True, exist_ok=True)
442
+
443
+ default_config = ""
444
+ # Try to find config.ini.sample in the package
445
+ sample_path = Path(__file__).resolve().parent / "config.ini.sample"
446
+ if sample_path.exists():
447
+ with open(sample_path, "r") as f:
448
+ default_config = f.read()
449
+ else:
450
+ # Fallback to hardcoded defaults from issue description
451
+ default_config = (
452
+ 'url = "http://localhost:8282"\n'
453
+ 'shortname = "dmart"\n'
454
+ 'password = "xxxx"\n'
455
+ 'query_limit = 50\n'
456
+ 'retrieve_json_payload = True\n'
457
+ 'default_space = "management"\n'
458
+ 'pagination = 50\n'
459
+ )
460
+
461
+ with open(home_config, "w") as f:
462
+ f.write(default_config)
463
+ print(f"Created default config at {home_config}")
464
+ config_file = str(home_config)
465
+ except Exception as e:
466
+ print(f"Warning: Failed to create default config at {home_config}: {e}")
438
467
 
439
468
  if config_file:
440
469
  os.environ["BACKEND_ENV"] = config_file
441
470
 
442
471
  # Try to find cli.py in the package or nearby
472
+ last_import_error = None
443
473
  try:
444
474
  # When installed as a package, cli.py is in the same directory as dmart.py
445
475
  dmart_dir = Path(__file__).resolve().parent
@@ -447,20 +477,38 @@ def main():
447
477
  sys.path.append(str(dmart_dir))
448
478
  import cli
449
479
  cli.main()
450
- except (ImportError, AttributeError):
451
- # Fallback for local development
452
- cli_path = Path(__file__).resolve().parent.parent / "cli"
453
- if cli_path.exists():
454
- sys.path.append(str(cli_path))
455
- try:
456
- import cli
457
- cli.main()
458
- except (ImportError, AttributeError):
459
- print("Error: cli.py found but main() not found or import failed.")
480
+ return
481
+ except ImportError as e:
482
+ last_import_error = e
483
+ if e.name and e.name != 'cli':
484
+ print(f"Error: Missing dependency for CLI: {e}")
485
+ sys.exit(1)
486
+ except Exception as e:
487
+ print(f"Error: Failed to start CLI: {e}")
488
+ sys.exit(1)
489
+
490
+ # Fallback for local development
491
+ cli_path = Path(__file__).resolve().parent.parent / "cli"
492
+ if cli_path.exists():
493
+ sys.path.append(str(cli_path))
494
+ try:
495
+ import cli
496
+ cli.main()
497
+ return
498
+ except ImportError as e:
499
+ last_import_error = e
500
+ if e.name and e.name != 'cli':
501
+ print(f"Error: Missing dependency for CLI: {e}")
460
502
  sys.exit(1)
461
- else:
462
- print("Error: cli.py not found.")
503
+ except Exception as e:
504
+ print(f"Error: Failed to start CLI: {e}")
463
505
  sys.exit(1)
506
+
507
+ if last_import_error:
508
+ print(f"Error: Could not load cli.py: {last_import_error}")
509
+ else:
510
+ print("Error: cli.py not found.")
511
+ sys.exit(1)
464
512
  case "serve":
465
513
  open_cxb = False
466
514
  if "--open-cxb" in sys.argv:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dmart
3
- Version: 1.4.40.post1
3
+ Version: 1.4.40.post3
4
4
  Requires-Python: >=3.11
5
5
  Requires-Dist: fastapi
6
6
  Requires-Dist: pydantic
@@ -25,6 +25,9 @@ Requires-Dist: jinja2
25
25
  Requires-Dist: pytest-cov
26
26
  Requires-Dist: argon2-cffi
27
27
  Requires-Dist: orjson
28
+ Requires-Dist: prompt_toolkit
29
+ Requires-Dist: rich
30
+ Requires-Dist: requests
28
31
  Provides-Extra: extra
29
32
  Requires-Dist: jsf; extra == "extra"
30
33
  Requires-Dist: types-psutil; extra == "extra"
@@ -44,13 +47,9 @@ Requires-Dist: firebase-admin; extra == "plugins"
44
47
  Requires-Dist: pillow; extra == "plugins"
45
48
  Requires-Dist: ldap3; extra == "plugins"
46
49
  Provides-Extra: cli-requires
47
- Requires-Dist: weasyprint; extra == "cli-requires"
48
- Requires-Dist: pypdf; extra == "cli-requires"
49
- Requires-Dist: dicttoxml; extra == "cli-requires"
50
- Requires-Dist: pdf2image; extra == "cli-requires"
51
- Requires-Dist: firebase-admin; extra == "cli-requires"
52
- Requires-Dist: pillow; extra == "cli-requires"
53
- Requires-Dist: ldap3; extra == "cli-requires"
50
+ Requires-Dist: prompt_toolkit; extra == "cli-requires"
51
+ Requires-Dist: rich; extra == "cli-requires"
52
+ Requires-Dist: requests; extra == "cli-requires"
54
53
  Provides-Extra: all
55
54
  Requires-Dist: jsf; extra == "all"
56
55
  Requires-Dist: types-psutil; extra == "all"
@@ -69,6 +68,8 @@ Requires-Dist: firebase-admin; extra == "all"
69
68
  Requires-Dist: pillow; extra == "all"
70
69
  Requires-Dist: ldap3; extra == "all"
71
70
  Requires-Dist: prompt_toolkit; extra == "all"
71
+ Requires-Dist: rich; extra == "all"
72
+ Requires-Dist: requests; extra == "all"
72
73
  Dynamic: provides-extra
73
74
  Dynamic: requires-dist
74
75
  Dynamic: requires-python
@@ -1,13 +1,13 @@
1
1
  dmart/__init__.py,sha256=xHodcATn-JYaoi3_TVDimR_UWG_ux9uLePUNQDzHhsY,122
2
2
  dmart/alembic.ini,sha256=wQweByyHQm-EI8BQkE0SHNRjULJ6Xn5jqgvv88IT5Sg,3738
3
3
  dmart/bundler.py,sha256=so8ZJResb1PcOH5vboa_mpFAdYr_T8u8DbbFXd570Lg,1704
4
- dmart/cli.py,sha256=aE3_2uHcEiQJA_f6viGRwUmGPB-OaNfzSgDgLR5gf40,40447
4
+ dmart/cli.py,sha256=nIK1yuGKJ_huOF-qkIRNI995nAbznlsSBb24mKHqtuc,41614
5
5
  dmart/config.env.sample,sha256=CKd4KIBeUatoFcO2IefmrVNBohpaVMQMFcoPkNBvCeI,696
6
6
  dmart/config.ini.sample,sha256=AADMdwG07zRV_cAGMoOorHQaqzTTL2WEIC_mPWjIslE,159
7
7
  dmart/conftest.py,sha256=0ry_zeCmdBNLbm5q115b-pkOrUFYxdsOUXbIMkr7E5Y,362
8
8
  dmart/curl.sh,sha256=lmHSFVr5ft-lc5Aq9LfvKyWfntrfYbnirhzx1EGjp_A,15743
9
9
  dmart/data_generator.py,sha256=CnE-VHEeX7-lAXtqCgbRqR9WHjTuOgeiZcviYrHAmho,2287
10
- dmart/dmart.py,sha256=Ax4GRara7_21T2Jcbl8EwGfdezr9NTz7UucW_oVw-pA,24419
10
+ dmart/dmart.py,sha256=QMK5wbYWOHmufoD-sQP5afOwSSXEOiVFUvLFCi22bgo,26752
11
11
  dmart/get_settings.py,sha256=Sbe2WCoiK398E7HY4SNLfDN_GmE8knR4M-YJWF31jcg,153
12
12
  dmart/hypercorn_config.toml,sha256=-eryppEG8HBOM_KbFc4dTQePnpyfoW9ZG5aUATU_6yM,50
13
13
  dmart/info.json,sha256=5Yz4tc5dEt5eVrM2LzLhXgN8vGvE0aDbbbEEaGDsD5k,123
@@ -280,8 +280,8 @@ dmart/utils/ticket_sys_utils.py,sha256=9QAlW2iiy8KyxQRBDj_WmzS5kKb0aYJmGwd4qzmGV
280
280
  dmart/utils/web_notifier.py,sha256=QM87VVid2grC5lK3NdS1yzz0z1wXljr4GChJOeK86W4,843
281
281
  dmart/utils/templates/activation.html.j2,sha256=XAMKCdoqONoc4ZQucD0yV-Pg5DlHHASZrTVItNS-iBE,640
282
282
  dmart/utils/templates/reminder.html.j2,sha256=aoS8bTs56q4hjAZKsb0jV9c-PIURBELuBOpT_qPZNVU,639
283
- dmart-1.4.40.post1.dist-info/METADATA,sha256=dRF5fMCJ7hyZsIKXGG6o5e5H00JxS8JkqucCNR4aINc,2577
284
- dmart-1.4.40.post1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
285
- dmart-1.4.40.post1.dist-info/entry_points.txt,sha256=N832M4wG8d2GDw1xztKRVM3TnxpY2QDzvdFE8XaWaG8,43
286
- dmart-1.4.40.post1.dist-info/top_level.txt,sha256=zJo4qk9fUW0BGIR9f4DCfpxaXbvQXH9izIOom6JsyAo,6
287
- dmart-1.4.40.post1.dist-info/RECORD,,
283
+ dmart-1.4.40.post3.dist-info/METADATA,sha256=uOn6icxljn3GjmNCpcD2y8Lr7Ky2khJqf--9GtNfwOs,2531
284
+ dmart-1.4.40.post3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
285
+ dmart-1.4.40.post3.dist-info/entry_points.txt,sha256=N832M4wG8d2GDw1xztKRVM3TnxpY2QDzvdFE8XaWaG8,43
286
+ dmart-1.4.40.post3.dist-info/top_level.txt,sha256=zJo4qk9fUW0BGIR9f4DCfpxaXbvQXH9izIOom6JsyAo,6
287
+ dmart-1.4.40.post3.dist-info/RECORD,,