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 pyproject.toml ./
|
||||
COPY src/py_docx ./src/py_docx
|
||||
COPY src ./src
|
||||
|
||||
# Install Python dependencies (including this package)
|
||||
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"
|
||||
|
||||
# Create runtime dirs
|
||||
@@ -67,7 +67,7 @@ EXPOSE 3000
|
||||
|
||||
# Health check (ensure module is importable)
|
||||
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
|
||||
ENTRYPOINT ["python", "-m", "py_docx.server"]
|
||||
ENTRYPOINT ["python", "-m", "server"]
|
||||
|
||||
+2
-2
@@ -19,8 +19,8 @@ dependencies = [
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
py-docx-mcp = "py_docx.server:main"
|
||||
py-docx-mcp = "server:main"
|
||||
|
||||
[tool.setuptools.packages.find]
|
||||
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 io import BytesIO
|
||||
|
||||
from py_docx.security import SecurityConfig
|
||||
from security import SecurityConfig
|
||||
|
||||
|
||||
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
|
||||
import uvicorn
|
||||
|
||||
from py_docx.docx_tools import DocxToolsProvider
|
||||
from py_docx.security import SecurityConfig, is_command_allowed
|
||||
from py_docx.templates import list_templates
|
||||
from docx_tools import DocxToolsProvider
|
||||
from security import SecurityConfig, is_command_allowed
|
||||
from templates import list_templates
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
Reference in New Issue
Block a user