From ff450a03de418e5adf45b2fd0a13aa697441dc94 Mon Sep 17 00:00:00 2001 From: foefl Date: Wed, 11 Jun 2025 11:45:04 +0200 Subject: [PATCH] add lookup of relative paths for import hooks, related to #33 --- pyproject.toml | 4 ++-- src/delta_barth/_debug.py | 22 ++++++++++++++++++++++ tests/test_debug.py | 5 +++++ 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 src/delta_barth/_debug.py create mode 100644 tests/test_debug.py diff --git a/pyproject.toml b/pyproject.toml index d4a4beb..e5589a0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "delta-barth" -version = "0.5.10" +version = "0.5.11rc2" description = "workflows and pipelines for the Python-based Plugin of Delta Barth's ERP system" authors = [ {name = "Florian Förster", email = "f.foerster@d-opt.com"}, @@ -74,7 +74,7 @@ directory = "reports/coverage" [tool.bumpversion] -current_version = "0.5.10" +current_version = "0.5.11rc2" parse = """(?x) (?P0|[1-9]\\d*)\\. (?P0|[1-9]\\d*)\\. diff --git a/src/delta_barth/_debug.py b/src/delta_barth/_debug.py new file mode 100644 index 0000000..0983ab7 --- /dev/null +++ b/src/delta_barth/_debug.py @@ -0,0 +1,22 @@ +import importlib.util +import os +import sys + + +def print_infos() -> str: + PATH = os.environ.get("PATH", "") + PY_HOME = os.environ.get("PYTHONHOME", "") + PY_PATH = os.environ.get("PYTHONPATH", "") + SYS_PATH = sys.path + + out = "" + out += f"\n>>> PATH is:\n{PATH}" + out += f"\n>>> PYTHONHOME is:\n{PY_HOME}" + out += f"\n>>> PYTHONPATH is:\n{PY_PATH}" + out += f"\n>>> Internal sys.path is:\n{SYS_PATH}" + found_spec = importlib.util.find_spec("numpy") + out += f"\n>>> Found spec for 'numpy' is:\n{found_spec}" + + print(out) + + return out diff --git a/tests/test_debug.py b/tests/test_debug.py new file mode 100644 index 0000000..4099f05 --- /dev/null +++ b/tests/test_debug.py @@ -0,0 +1,5 @@ +from delta_barth import _debug as debug + + +def test_print_info(): + debug.print_infos()