Conversation
|
Is |
|
No, the optinal(for deployment) dependencies is separated to several parts, like deepdoc, document-parsing, postgres ... The development dependencies groups are defined in PEP 735 standard. They're separated to test, static-type-check ... 'dev' is used to gather them all together, and can be installed by So, when perform a |
|
If they are different, there is break change that might break users or CIs. |
…encies This commit reorganizes the dependency structure to follow PEP 735 best practices: 1. Add [dependency-groups] section for development dependencies: - dev: linting/formatting tools (includes test and static-type-check) - test: testing frameworks and related dependencies - static-type-check: type checking dependencies 2. Reorganize [project.optional-dependencies] by functionality: - deepdoc: AI-enhanced document processing (git dependency) - document-parsing: Non-AI document libraries (pdfplumber, unstructured, pymupdf, etc.) - ai-document: AI-related document processing (docling) - postgresql: PostgreSQL driver (psycopg2-binary) - browser: Browser automation (playwright) - chromadb: ChromaDB vector database - milvus: Milvus vector database - all: All optional extras combined 3. Move appropriate packages from core to optional dependencies: - Document parsing libraries → document-parsing extra - AI document processing → ai-document extra - PostgreSQL driver → postgresql extra - Browser automation → browser extra - Vector databases → chromadb/milvus extras 4. Keep in core dependencies only what's needed for basic functionality: - Web framework (fastapi, uvicorn, websockets) - LLM providers (openai, anthropic, langchain, etc.) - Core utilities (pillow, pypdf for basic PDF, docker, etc.) - Database ORM (sqlalchemy, alembic) - supports SQLite by default Version Requirements: - pip >= 25.1 for PEP 735 dependency groups support - uv >= 0.6.17 (has native support)
- Add pandas and numpy back to core dependencies (required by RAG functionality) - Fix deepdoc optional import handling to prevent startup failures - Add conditional DeepDocParser registration when available - Update Dockerfile to install all optional extras for complete functionality - Fix pptx import to be optional for web file preview functionality Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
7b2522e to
99581ab
Compare
|
Hi @qinxuye, thanks for your concerns! Let me address your questions about the breaking changes: Core Functionality PreservationYes, maintains identical behavior for core functionality:
Verified Test ResultsI've tested minimal installation scenario: Results:
The Breaking PartOnly optional features are now truly optional:
Users who need full functionality can still install everything Migration Guide for Existing UsersFor most users, no action needed - core functionality works identically. Only users relying on specific optional features need:
Docker users: Fully unaffected, Dockerfile installs for complete functionality Summary
Would you like me to adjust any aspect of this approach? I'm happy to discuss alternative transition strategies if needed. |
- Use consistent commit hash (88f420a) for deepdoc-lib across all extras - Align with upstream/main to resolve UV dependency resolution failure - This fixes the CI error: 'Requirements contain conflicting URLs for package deepdoc-lib' Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
||
| # Install app + deepdoc into venv | ||
| RUN /opt/venv/bin/pip install --no-cache-dir ${PYPI_INDEX_URL:+--index-url $PYPI_INDEX_URL} . \ | ||
| RUN /opt/venv/bin/pip install --no-cache-dir ${PYPI_INDEX_URL:+--index-url $PYPI_INDEX_URL} ".[all]" \ |
There was a problem hiding this comment.
We should exclude dev for docker.
There was a problem hiding this comment.
@qinxuye Thanks for the review! Let me clarify the Docker dependency situation:
According to PEP 735, dependency groups are NEVER included in built distributions. This is by design.
Current Implementation
Dockerfile line 60:
RUN /opt/venv/bin/pip install ".[all]"This only installs [project.optional-dependencies], which are runtime dependencies. The [dependency-groups] section (where dev lives) is completely separate and not included.
When run pip install on a dockerfile, the pip in docker checks pyproject.toml:
[project.optional-dependencies]
all = [...] # ← Docker installs this
[dependency-groups]
dev = ["pytest", "pre-commit", ...] # ← Docker ignores thisVersion Requirements
The version requirements mentioned (pip >= 25.1, uv >= 0.6.17) are only needed for local development when using --group dev. Production deployment doesn't need them.
Summary
Docker images are safe - they contain only(and all) runtime dependencies, no dev tools.
Would you like me to add a clarifying comment in the Dockerfile?
Summary
This PR implements PEP 735
[dependency-groups]for better dependency management and enables quick developer onboarding with minimal installation.Key Innovation: Minimal Core Installation
✅ Tested & Verified: Program starts successfully with core dependencies only, enabling developers to run and test xagent immediately without installing heavy optional packages.
Key Changes
Dependency Structure
[dependency-groups]dev: All development tools (includes test, static-type-check)test: Testing frameworks and dependenciesstatic-type-check: Type checking dependenciesdeepdoc: AI-enhanced document processingdocument-parsing: Non-AI document libraries (pdfplumber, unstructured, pymupdf, etc.)ai-document: AI-related document processing (docling)postgresql: PostgreSQL driverbrowser: Browser automation (playwright)chromadb: ChromaDB vector databasemilvus: Milvus vector databaseall: All optional extras combinedCritical Fixes for Optional Dependencies
pandas/numpyto core (RAG functionality requirement)deepdocoptional import handling (prevents startup failures)DeepDocParserregistrationpptxoptional import for web file previewBenefits
1. Quick Developer Onboarding 🚀
pip install -e .gets you a running xagent2. Better Dependency Organization
3. Smaller & Faster Installation
4. Modern Python Standards
uv sync --group devfor developmentInstallation Examples
Quick Start (Minimal)
Development Setup
Docker
Docker images include all optional extras for complete functionality.
Migration Guide for Existing Users
This is a breaking change. After upgrading, install the extras you need:
Files Changed
pyproject.toml: PEP 735 implementation + dependency reorganization.github/workflows/pr-checks.yml: Updated CI for--group devand all test extrasdocker/Dockerfile.backend: Updated to install all optional extrassrc/xagent/providers/pdf_parser/__init__.py: Fixed deepdoc optional importsrc/xagent/core/tools/core/document_parser.py: Conditional DeepDocParser registrationsrc/xagent/web/api/files.py: Fixed pptx optional importAGENTS.md: Updated installation documentationTesting & Verification
Version Requirements
Reference
Note: Breaking change that improves developer experience. Core functionality works immediately, optional features require explicit installation.