oe-python-template 0.12.15__py3-none-any.whl → 0.12.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.
oe_python_template/cli.py CHANGED
@@ -45,7 +45,7 @@ if find_spec("marimo"):
45
45
  port=port,
46
46
  )
47
47
 
48
-
48
+
49
49
  if __name__ == "__main__": # pragma: no cover
50
50
  try:
51
51
  cli()
@@ -2,6 +2,7 @@
2
2
 
3
3
  import os
4
4
  import sys
5
+ from pathlib import Path
5
6
 
6
7
  from ._log import logging_initialize
7
8
  from ._logfire import logfire_initialize
@@ -22,6 +23,7 @@ def boot(modules_to_instrument: list[str]) -> None:
22
23
  if _boot_called:
23
24
  return
24
25
  _boot_called = True
26
+ _import_from_vendored()
25
27
  sentry_initialize()
26
28
  log_to_logfire = logfire_initialize(modules_to_instrument)
27
29
  logging_initialize(log_to_logfire)
@@ -65,6 +67,22 @@ def _parse_env_args() -> None:
65
67
  del sys.argv[index]
66
68
 
67
69
 
70
+ def _import_from_vendored() -> None:
71
+ """Add vendored/ to sys.path enabling to override broken (transitive) dependencies.
72
+
73
+ Raises:
74
+ FileNotFoundError: If the vendored/ directory cannot be found.
75
+ """
76
+ # Get the directory of this file
77
+ current_dir = Path(__file__).parent.parent.absolute()
78
+ vendored_dir = current_dir / "vendored"
79
+ if not vendored_dir.is_dir():
80
+ message = f"vendored/ directory not found at {vendored_dir!s}"
81
+ raise FileNotFoundError(message)
82
+ if vendored_dir not in sys.path:
83
+ sys.path.insert(0, str(vendored_dir))
84
+
85
+
68
86
  def _amend_library_path() -> None:
69
87
  """Patch environment variables before any other imports."""
70
88
  if "DYLD_FALLBACK_LIBRARY_PATH" not in os.environ: