Flatten layout: move py_docx files into src; update imports and Dockerfile
This commit is contained in:
+4
-4
@@ -41,12 +41,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|||||||
|
|
||||||
# Copy project metadata and source before installing
|
# Copy project metadata and source before installing
|
||||||
COPY pyproject.toml ./
|
COPY pyproject.toml ./
|
||||||
COPY src/py_docx ./src/py_docx
|
COPY src ./src
|
||||||
|
|
||||||
# Install Python dependencies (including this package)
|
# Install Python dependencies (including this package)
|
||||||
RUN pip install --upgrade pip && pip install .
|
RUN pip install --upgrade pip && pip install .
|
||||||
|
|
||||||
# Ensure py_docx is importable at runtime
|
# Ensure modules in src are importable at runtime
|
||||||
ENV PYTHONPATH="/app/src"
|
ENV PYTHONPATH="/app/src"
|
||||||
|
|
||||||
# Create runtime dirs
|
# Create runtime dirs
|
||||||
@@ -67,7 +67,7 @@ EXPOSE 3000
|
|||||||
|
|
||||||
# Health check (ensure module is importable)
|
# Health check (ensure module is importable)
|
||||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
|
||||||
CMD python -c "import py_docx.server; print('ok')" || exit 1
|
CMD python -c "from server import main; print('ok')" || exit 1
|
||||||
|
|
||||||
# Default: Streamable HTTP for OpenWebUI MCP
|
# Default: Streamable HTTP for OpenWebUI MCP
|
||||||
ENTRYPOINT ["python", "-m", "py_docx.server"]
|
ENTRYPOINT ["python", "-m", "server"]
|
||||||
|
|||||||
+2
-2
@@ -19,8 +19,8 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[project.scripts]
|
[project.scripts]
|
||||||
py-docx-mcp = "py_docx.server:main"
|
py-docx-mcp = "server:main"
|
||||||
|
|
||||||
[tool.setuptools.packages.find]
|
[tool.setuptools.packages.find]
|
||||||
where = ["src"]
|
where = ["src"]
|
||||||
include = ["py_docx*"]
|
include = ["*"]
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ from docx.enum.text import WD_ALIGN_PARAGRAPH
|
|||||||
from PIL import Image as PILImage
|
from PIL import Image as PILImage
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
from py_docx.security import SecurityConfig
|
from security import SecurityConfig
|
||||||
|
|
||||||
|
|
||||||
def file_to_result(path: str, return_content: bool = False) -> Any:
|
def file_to_result(path: str, return_content: bool = False) -> Any:
|
||||||
@@ -9,9 +9,9 @@ from typing import Any
|
|||||||
from mcp.server.fastmcp import FastMCP
|
from mcp.server.fastmcp import FastMCP
|
||||||
import uvicorn
|
import uvicorn
|
||||||
|
|
||||||
from py_docx.docx_tools import DocxToolsProvider
|
from docx_tools import DocxToolsProvider
|
||||||
from py_docx.security import SecurityConfig, is_command_allowed
|
from security import SecurityConfig, is_command_allowed
|
||||||
from py_docx.templates import list_templates
|
from templates import list_templates
|
||||||
|
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
level=logging.INFO,
|
level=logging.INFO,
|
||||||
Reference in New Issue
Block a user