From 8adb8c8fb08d22f2ecaec3cde82db16b247a6242 Mon Sep 17 00:00:00 2001 From: admin Date: Sat, 13 Jun 2026 15:45:11 +0000 Subject: [PATCH] Fix py_docx import error: use setuptools + PYTHONPATH --- Dockerfile | 3 +++ pyproject.toml | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index d69bf34..58b0fec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -46,6 +46,9 @@ RUN pip install --upgrade pip && pip install . # Copy source COPY src/py_docx ./src/py_docx +# Ensure py_docx is importable +ENV PYTHONPATH="/app/src:${PYTHONPATH}" + # Create runtime dirs RUN mkdir -p /templates /out /tmp/py-docx-mcp diff --git a/pyproject.toml b/pyproject.toml index 8dc09eb..2d70544 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" [project] name = "py-docx-mcp" @@ -15,10 +15,12 @@ dependencies = [ "html5lib>=1.1", "regex>=2024.0.0", "aiofiles>=24.0.0", + "uvicorn>=0.24.0", ] [project.scripts] py-docx-mcp = "py_docx.server:main" -[tool.hatch.build.targets.wheel] -packages = ["src/py_docx"] +[tool.setuptools.packages.find] +where = ["src"] +include = ["py_docx*"]