Fix: Export PDFTextWritingTool and add comprehensive tests #419
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
PDFTextWritingTool
was documented but missing from thecrewai_tools
package exports. The tool existed in the codebase but couldn't be imported because it wasn't properly exported in the__init__.py
files.Key Changes:
PDFTextWritingTool
exports tocrewai_tools/__init__.py
andcrewai_tools/tools/__init__.py
pypdf.annotations.FreeText
instead of the deprecatedContentStream
APItest_search_tools.py
to includePDFTextWritingTool
import 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_file
parameter or keep it documented as unsupported for backward compatibilityRecommended Test Plan:
PDFTextWritingTool
in a fresh Python environment to verify exports workDiagram
Notes
ContentStream
API to the modernFreeText
annotation 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)