Adding Draw.io's native XML shape libraries#123
Conversation
…or handling - Implemented `register_mxlibrary` function to register external shape libraries. - Added `load_mxlibrary` function with improved error handling for file and URL sources. - Enhanced `parse_mxlibrary` to return errors for invalid shapes and JSON parsing issues. - Updated documentation to reflect new functionality and usage examples. - Created tests for loading libraries, error handling, and registering libraries.
- Add example of importing external shape libraries to README - Add Key Features section to docs/index.md highlighting new capabilities - Showcase Azure icons as practical example
|
Thank you for your effort and spending time working on Drawpyo.
|
- Moved the `register_mxlibrary` function from `__init__.py` to a new `library_manager.py` module for better organization. - Updated the `load_mxlibrary` function to improve error handling and logging. - Cleaned up whitespace and comments across multiple files for consistency. - Enhanced integration tests for registering mxlibraries and creating objects from them. - Added unit tests for parsing and loading mxlibrary files, ensuring robust error handling.
… and add local file tests

This pull request introduces comprehensive support for importing and using Draw.io's native XML shape libraries (mxlibrary format), enabling users to leverage third-party icon sets (such as Azure, AWS, and Google Cloud) directly in their diagrams. The documentation has been updated to explain the new features, and example scripts have been added to demonstrate usage. Robust error handling and improved messaging have been implemented to help users diagnose issues when working with external libraries.
New Features: External Shape Library Support
register_mxlibraryandload_mxlibraryfunctions to thedrawpyoAPI, allowing registration and loading of Draw.io XML shape libraries from local files or URLs. These libraries can now be used seamlessly withobject_from_library. [1] [2] [3]format_as_library_objectto provide clear feedback when libraries or shapes are missing, and to warn about incomplete shape definitions. [1] [2]Documentation Improvements
README.mdanddocs/usage/shape_libs.mdto explain how to import, register, and use mxlibrary files, including sample code and guidance on error handling and finding shape names. [1] [2] [3]docs/index.mdhighlighting new capabilities such as external library support.Example Scripts
etc/development scripts/create_azure_diagram.pyandetc/development scripts/test_mxlibrary_import.pyas reference scripts demonstrating how to register, import, and use external shape libraries in diagrams. [1] [2]