This repository was archived by the owner on Nov 10, 2025. It is now read-only.
Fix: Export PDFTextWritingTool and add comprehensive tests - #419
Closed
devin-ai-integration[bot] wants to merge 1 commit into
Closed
devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
- Add PDFTextWritingTool to crewai_tools/__init__.py and tools/__init__.py exports - Fix PDFTextWritingTool implementation to use current pypdf API (FreeText annotations) - Replace outdated ContentStream API with modern pypdf.annotations.FreeText - Add comprehensive tests for PDFTextWritingTool functionality - Update test_search_tools.py to include PDFTextWritingTool import - Resolves issue #3331: PDFTextWritingTool documented but missing from package Co-Authored-By: João <joao@crewai.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Contributor
Author
|
Closing due to inactivity for more than 7 days. Configure here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: Export PDFTextWritingTool and add comprehensive tests
Summary
This PR resolves issue #3331 where
PDFTextWritingToolwas documented but missing from thecrewai_toolspackage exports. The tool existed in the codebase but couldn't be imported because it wasn't properly exported in the__init__.pyfiles.Key Changes:
PDFTextWritingToolexports tocrewai_tools/__init__.pyandcrewai_tools/tools/__init__.pypypdf.annotations.FreeTextinstead of the deprecatedContentStreamAPItest_search_tools.pyto includePDFTextWritingToolimport verificationBreaking Changes:
Review & Testing Checklist for Human
"0 0 0 rg","1 0 0 rg","0 1 0 rg","0 0 1 rg") to ensure colors appear correctlyfont_fileparameter or keep it documented as unsupported for backward compatibilityRecommended Test Plan:
PDFTextWritingToolin a fresh Python environment to verify exports workDiagram
%%{ init : { "theme" : "default" }}%% graph TD subgraph "Package Structure" A["crewai_tools/__init__.py"]:::major-edit B["crewai_tools/tools/__init__.py"]:::major-edit end subgraph "Implementation" C["pdf_text_writing_tool.py"]:::major-edit D["pypdf.annotations.FreeText<br/>(new API)"]:::context E["pypdf.ContentStream<br/>(deprecated, removed)"]:::context end subgraph "Testing" F["test_pdf_text_writing_tool.py<br/>(new file)"]:::major-edit G["test_search_tools.py"]:::minor-edit end A -->|exports| C B -->|exports| C C -->|uses| D C -.->|replaced| E F -->|tests| C G -->|imports| C subgraph Legend L1[Major Edit]:::major-edit L2[Minor Edit]:::minor-edit L3[Context/No Edit]:::context end classDef major-edit fill:#90EE90 classDef minor-edit fill:#87CEEB classDef context fill:#FFFFFFNotes
ContentStreamAPI to the modernFreeTextannotation approach. While this fixes compatibility with current pypdf versions, it represents a significant implementation change.Link to Devin run: https://app.devin.ai/sessions/813c5e6fd0d94e57976c978e1e803bd2
Requested by: João (joao@crewai.com)