-
Couldn't load subscription status.
- Fork 6.5k
feat(confluence): make SVG processing optional to fix pycairo install… #20115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(confluence): make SVG processing optional to fix pycairo install… #20115
Conversation
…ation issues This change addresses installation failures on Debian/Ubuntu systems where svglib 1.6.0 introduced breaking changes that require pycairo compilation, which fails without gcc and cairo-dev system libraries. Changes: - Move svglib dependency to optional extras: pip install 'llama-index-readers-confluence[svg]' - Add graceful degradation in process_svg() when dependencies unavailable - Add FileType.SVG enum for custom parser support - Add comprehensive migration guide with 4 different approaches - Add unit tests for optional dependency behavior - Add working examples for all SVG processing options - Update README and CHANGELOG Breaking Change: SVG processing now requires explicit installation with [svg] extra. Users who need SVG support should install with: pip install 'llama-index-readers-confluence[svg]' Backward Compatibility: Maintained through graceful degradation - SVG attachments are skipped with informative warnings when dependencies are not installed. Fixes installation issues on systems without C compilers. Tested: 3 tests passed, 1 skipped (expected when svglib not installed)
|
Can't we just pin the version of svglib to 1.6.0 (your PR does that nevertheless) and bump the version of the integration to 0.5.0 without actually making the dependency optional? Just to avoid breaking things unexpectedly for those who want to upgrade to newer versions of this integration (and want to do SVG processing), without knowing that they would have to install svglib as an extra dependency |
ok, can I pin svglib version to 1.5.1 because as per the issue mentioned in PR, svglib version 1.6.0 has breaking changes |
|
Yeah, I would just say: |
… installation issues" This reverts commit ace7418.
ok, I've reverted the previous changes and pinned the version as suggested. |
Make SVG processing optional to fix pycairo installation issues
Description
Referring to Issue
This PR addresses critical installation failures on Debian/Ubuntu systems caused by
svglib 1.6.0introducing breaking changes that requirepycairocompilation. Thepycairopackage requires system-level C compilers (gcc) and Cairo development libraries (cairo-dev), which are often not available in minimal Docker images or CI/CD environments.Problem:
svglib>=1.5.1,<2was a required dependencypycairorequiring C compilation and system librariesSolution:
svgliban optional dependency via Python's extras mechanismType of Change
Note: While SVG processing now requires explicit installation with
[svg]extra, this is NOT a breaking change due to graceful degradation. Existing code continues to work - SVG attachments are simply skipped with informative warnings when dependencies are not installed.Changes Made
Core Implementation
pyproject.toml: Movedsvglib>=1.5.1,<1.6.0to[project.optional-dependencies]sectionbase.py: Enhancedprocess_svg()method with:event.py: AddedFileType.SVG = "svg"to enum for custom parser registrationrequirements.txt: Auto-updated to reflect dependency changesDocumentation
README.md: Added "Optional Dependencies" section with installation instructionsCHANGELOG.md: Documented the change and migration pathMIGRATION_GUIDE.md: Created comprehensive guide with 4 migration options:Testing & Examples
tests/test_svg_optional.py: Added 4 unit tests covering:examples/svg_parsing_examples.py: Created working examples demonstrating all 4 approachesInstallation Options
Default (No SVG support):
With SVG support:
pip install 'llama-index-readers-confluence[svg]'With custom parser (no pycairo needed):
Backward Compatibility
✅ Fully maintained through graceful degradation:
[svg]extraHow Has This Been Tested?
Test Results:
Smoke Tests:
New Package?
Version Bump?
Suggested Checklist
uv run make format; uv run make lintto appease the lint godsAdditional Context
This follows the established Python pattern for optional dependencies (similar to
pandas[excel],requests[security], etc.). Users who don't need SVG processing benefit from faster installation without C compilation requirements, while users who need SVG support can explicitly opt-in.The implementation provides three migration paths:
See
MIGRATION_GUIDE.mdfor detailed migration instructions and examples.