@@ -56,22 +56,33 @@ COPY middleware ./middleware
5656# as pre-built wheels on PyPI.
5757# 3. Thus, we use 'uv sync' to create a virtual environment (.venv) and resolve all
5858# complex dependencies exactly as specified in the uv.lock.
59- RUN HATCH_VCS_PRETEND_VERSION=${APP_VERSION#v} \
60- SETUPTOOLS_SCM_PRETEND_VERSION=${APP_VERSION#v} \
59+ RUN SETUPTOOLS_SCM_PRETEND_VERSION=${APP_VERSION#v} \
6160 uv sync --no-dev
6261
63- # 4. Finally, for packages like sql_to_arc that exist both as a workspace dependency
64- # and as a pre-built wheel, we explicitly 'uv pip install' the wheel. This ensures
65- # we use our optimized, pre-built package instead of the 'editable' source install.
66- RUN HATCH_VCS_PRETEND_VERSION=${APP_VERSION#v} \
67- SETUPTOOLS_SCM_PRETEND_VERSION=${APP_VERSION#v} \
62+ # 4. Install the application wheel.
63+ # This replaces the editable install from 'uv sync' with the optimized wheel.
64+ RUN SETUPTOOLS_SCM_PRETEND_VERSION=${APP_VERSION#v} \
6865 uv pip install /tmp/wheels/*.whl pyinstaller
6966
67+ # 5. FIX: Manually reinstall git dependencies using their INTERNAL names (underscore)
68+ # to ensure proper namespace installation. We do this AFTER installing the wheel
69+ # to ensure the namespace merging happens correctly.
70+ RUN . .venv/bin/activate && \
71+ uv pip install --force-reinstall \
72+ "api_client @ git+https://github.com/fairagro/m4.2_advanced_middleware_api.git@main#subdirectory=middleware/api_client" \
73+ "shared @ git+https://github.com/fairagro/m4.2_advanced_middleware_api.git@main#subdirectory=middleware/shared"
74+
7075# Build standalone binary using the .venv's context.
76+ # We point PyInstaller to the 'main.py' INSTALLED in site-packages.
77+ # Since we merged everything into site-packages/middleware, we can largely rely on auto-discovery.
78+ # --copy-metadata is still needed because the code checks its own version at runtime.
7179RUN . .venv/bin/activate && \
72- python -m PyInstaller --onedir \
80+ .venv/bin/ python -m PyInstaller --onedir \
7381 --name sql_to_arc \
74- /build/middleware/sql_to_arc/src/middleware/sql_to_arc/main.py
82+ --copy-metadata sql_to_arc \
83+ --copy-metadata api_client \
84+ --copy-metadata shared \
85+ .venv/lib/python3.12/site-packages/middleware/sql_to_arc/main.py
7586
7687
7788# ---- Runtime Stage ----
0 commit comments