dmart 1.4.40.post21__py3-none-any.whl → 1.4.40.post23__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/__init__.py CHANGED
@@ -1,7 +0,0 @@
1
- import os
2
- import sys
3
-
4
-
5
- _pkg_dir = os.path.dirname(__file__)
6
- if _pkg_dir not in sys.path:
7
- sys.path.insert(0, _pkg_dir)
dmart/cxb/config.json CHANGED
@@ -6,6 +6,6 @@
6
6
  "description": "dmart unified data platform",
7
7
  "default_language": "en",
8
8
  "languages": { "ar": "العربية", "en": "English" },
9
- "backend": "http://127.0.0.1:8282",
10
- "websocket": "ws://127.0.0.1:8484/ws"
9
+ "backend": "http://0.0.0.0:8282",
10
+ "websocket": "ws://0.0.0.0:8484/ws"
11
11
  }
dmart/dmart.py CHANGED
@@ -14,6 +14,7 @@ import warnings
14
14
  import webbrowser
15
15
  import re
16
16
  from pathlib import Path
17
+ from multiprocessing import freeze_support
17
18
 
18
19
 
19
20
  script_dir = str(Path(__file__).resolve().parent)
@@ -53,7 +54,7 @@ def hypercorn_main(args_list: list[str]) -> int:
53
54
  "application",
54
55
  help="The application to dispatch to as path.to.module:instance.path",
55
56
  nargs="?",
56
- default="main:app"
57
+ default="dmart.main:app"
57
58
  )
58
59
  parser.add_argument("--access-log", help="Deprecated, see access-logfile", default=sentinel)
59
60
  parser.add_argument(
@@ -261,9 +262,27 @@ def hypercorn_main(args_list: list[str]) -> int:
261
262
  config.workers = 1
262
263
  config.bind = ["localhost:8282"]
263
264
  # Allow child processes to find the application
264
- script_dir = os.path.dirname(os.path.abspath(__file__))
265
- if script_dir not in sys.path:
266
- sys.path.insert(0, script_dir)
265
+ dmart_dir = os.path.dirname(os.path.abspath(__file__))
266
+ dmart_pkg_parent = os.path.dirname(dmart_dir)
267
+
268
+ # Ensure dmart_pkg_parent is in sys.path
269
+ if dmart_pkg_parent not in sys.path:
270
+ sys.path.insert(0, dmart_pkg_parent)
271
+
272
+ # Ensure dmart_dir itself is NOT in sys.path
273
+ if dmart_dir in sys.path:
274
+ sys.path.remove(dmart_dir)
275
+
276
+ # Handle the case where we are running from source and 'dmart' package is not available
277
+ # but the current directory contains 'main.py'
278
+ try:
279
+ from dmart import main as _unused
280
+ except ImportError:
281
+ if os.path.exists(os.path.join(dmart_dir, "main.py")):
282
+ if dmart_dir not in sys.path:
283
+ sys.path.insert(0, dmart_dir)
284
+ if args.application == "dmart.main:app":
285
+ args.application = "main:app"
267
286
  else:
268
287
  config = Config.from_toml(args.config)
269
288
 
@@ -422,6 +441,8 @@ def main():
422
441
 
423
442
  match command:
424
443
  case "hyper":
444
+ from multiprocessing import freeze_support
445
+ freeze_support()
425
446
  hypercorn_main(args_list)
426
447
  case "cli":
427
448
  config_file = None
@@ -761,7 +782,7 @@ def main():
761
782
 
762
783
  config.set('alembic', 'sqlalchemy.url', db_url)
763
784
  config.set('alembic', 'script_location', str(dmart_root / "alembic"))
764
- config.set('alembic', 'prepend_sys_path', str(dmart_root))
785
+ config.set('alembic', 'prepend_sys_path', os.path.dirname(dmart_root))
765
786
 
766
787
  temp_config_path = ""
767
788
  try:
@@ -824,10 +845,26 @@ def main():
824
845
  sys.exit(e.returncode)
825
846
 
826
847
  if __name__ == "__main__":
827
- # If installed as a package, we need to ensure the parent of dmart package
828
- # is in sys.path for child processes to find 'dmart.dmart'
829
- dmart_pkg_parent = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
848
+ freeze_support()
849
+ # If we are running as a script (e.g. during multiprocessing spawn),
850
+ # we need to ensure the parent of dmart package is in sys.path
851
+ # so that 'import dmart' works correctly.
852
+ # However, we must NOT add the directory containing dmart.py itself
853
+ # to sys.path, as that would make 'dmart' a module instead of a package.
854
+
855
+ # Path to this file: .../site-packages/dmart/dmart.py
856
+ # dmart_dir: .../site-packages/dmart
857
+ # dmart_pkg_parent: .../site-packages
858
+ dmart_dir = os.path.dirname(os.path.abspath(__file__))
859
+ dmart_pkg_parent = os.path.dirname(dmart_dir)
860
+
830
861
  if dmart_pkg_parent not in sys.path:
831
862
  sys.path.append(dmart_pkg_parent)
863
+
864
+ # Ensure dmart_dir itself is NOT in sys.path to avoid module/package conflict
865
+ if dmart_dir in sys.path:
866
+ sys.path.remove(dmart_dir)
867
+ if "" in sys.path:
868
+ sys.path.remove("")
832
869
 
833
870
  main()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dmart
3
- Version: 1.4.40.post21
3
+ Version: 1.4.40.post23
4
4
  Requires-Python: >=3.11
5
5
  Requires-Dist: fastapi
6
6
  Requires-Dist: pydantic
@@ -1,4 +1,4 @@
1
- dmart/__init__.py,sha256=xHodcATn-JYaoi3_TVDimR_UWG_ux9uLePUNQDzHhsY,122
1
+ dmart/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  dmart/alembic.ini,sha256=wQweByyHQm-EI8BQkE0SHNRjULJ6Xn5jqgvv88IT5Sg,3738
3
3
  dmart/bundler.py,sha256=so8ZJResb1PcOH5vboa_mpFAdYr_T8u8DbbFXd570Lg,1704
4
4
  dmart/cli.py,sha256=TkZVc0bDT32nXJxNd_ZVqwKaq6pbMUOXxYRXfEaKYSI,41611
@@ -8,7 +8,7 @@ dmart/conftest.py,sha256=0ry_zeCmdBNLbm5q115b-pkOrUFYxdsOUXbIMkr7E5Y,362
8
8
  dmart/curl.pypi.sh,sha256=KQ-kgV3_d5mwqoLd4XOwz5s2wRQ7LDVX3z-kvjvp9hA,15631
9
9
  dmart/curl.sh,sha256=lmHSFVr5ft-lc5Aq9LfvKyWfntrfYbnirhzx1EGjp_A,15743
10
10
  dmart/data_generator.py,sha256=CnE-VHEeX7-lAXtqCgbRqR9WHjTuOgeiZcviYrHAmho,2287
11
- dmart/dmart.py,sha256=eaaggp05-3F0Z-rHgW01TZfFbuk7GhOSbNRtDIEtrWQ,32735
11
+ dmart/dmart.py,sha256=F4VCjMC1gr7x8eVjWrbadd0_GOAMOuxxp1Kvqnopxm4,34249
12
12
  dmart/get_settings.py,sha256=Sbe2WCoiK398E7HY4SNLfDN_GmE8knR4M-YJWF31jcg,153
13
13
  dmart/hypercorn_config.toml,sha256=-eryppEG8HBOM_KbFc4dTQePnpyfoW9ZG5aUATU_6yM,50
14
14
  dmart/info.json,sha256=6Kb7MXzVS0PzDZOUXtBoAA3zpxvtRBR0PJnedjBE-v4,123
@@ -79,7 +79,7 @@ dmart/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
79
79
  dmart/config/channels.json,sha256=GepystGi0h_1fuakC_gdIc-YYxyy-a4TI619ygIpyyM,156
80
80
  dmart/config/notification.json,sha256=esrOaMUIqfcCHB0Tawp3t4cu7DQAA15X12OS-Gyenb0,361
81
81
  dmart/cxb/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
82
- dmart/cxb/config.json,sha256=WvhCcnJ9-uQ2raPuRBRSGO3iD7Hcaf8Cy49EXUu3KQw,358
82
+ dmart/cxb/config.json,sha256=xn55EmokYC8CgcLebxGsgp2ZLyUKmY2-587kf-66tEQ,354
83
83
  dmart/cxb/config.sample.json,sha256=fTYLbnTiUdbT_F7rcwI7CLSZ_KoX8EflfuyswRGW2x0,355
84
84
  dmart/cxb/favicon.ico,sha256=CD2FYyYYFNAbH7lGPnM5-2asMmhf-kwitAp99Kh0Wmc,4286
85
85
  dmart/cxb/favicon.png,sha256=gbSWS2UiKrUcy5Jt4gcncDrE5yvfAS00OgYzdNxPxlk,4164
@@ -483,8 +483,8 @@ dmart/utils/ticket_sys_utils.py,sha256=9QAlW2iiy8KyxQRBDj_WmzS5kKb0aYJmGwd4qzmGV
483
483
  dmart/utils/web_notifier.py,sha256=QM87VVid2grC5lK3NdS1yzz0z1wXljr4GChJOeK86W4,843
484
484
  dmart/utils/templates/activation.html.j2,sha256=XAMKCdoqONoc4ZQucD0yV-Pg5DlHHASZrTVItNS-iBE,640
485
485
  dmart/utils/templates/reminder.html.j2,sha256=aoS8bTs56q4hjAZKsb0jV9c-PIURBELuBOpT_qPZNVU,639
486
- dmart-1.4.40.post21.dist-info/METADATA,sha256=tDXPuJEXMjftV_fpEETDfHb9kgcYvG_WoPOtBb1_k1M,839
487
- dmart-1.4.40.post21.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
488
- dmart-1.4.40.post21.dist-info/entry_points.txt,sha256=N832M4wG8d2GDw1xztKRVM3TnxpY2QDzvdFE8XaWaG8,43
489
- dmart-1.4.40.post21.dist-info/top_level.txt,sha256=zJo4qk9fUW0BGIR9f4DCfpxaXbvQXH9izIOom6JsyAo,6
490
- dmart-1.4.40.post21.dist-info/RECORD,,
486
+ dmart-1.4.40.post23.dist-info/METADATA,sha256=lRQ0MaVLCdigjT_Ba5oT1QyW1-Ilh7SRPxKvp7IkoO8,839
487
+ dmart-1.4.40.post23.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
488
+ dmart-1.4.40.post23.dist-info/entry_points.txt,sha256=N832M4wG8d2GDw1xztKRVM3TnxpY2QDzvdFE8XaWaG8,43
489
+ dmart-1.4.40.post23.dist-info/top_level.txt,sha256=zJo4qk9fUW0BGIR9f4DCfpxaXbvQXH9izIOom6JsyAo,6
490
+ dmart-1.4.40.post23.dist-info/RECORD,,