Artem Oroberts and Copybara-Service
8eeff35b35
feat: Demonstrate CodeExecutor customization for environment setup
...
This change introduces a powerful pattern for customizing code execution environments by extending a base `CodeExecutor`. It showcases how to inject setup code to prepare the environment before a user's code is run, enabling advanced use cases that require specific configurations.
As a practical example, this change implements `CustomCodeExecutor`, a subclass of `VertexAiCodeExecutor`, to solve the problem of rendering non-standard characters in `matplotlib` plots (Issue #2993 ). The custom executor programmatically adds a Japanese font to the `matplotlib` font manager at runtime.
This is achieved by overriding the `execute_code` method to add font files to execution input and prepend the necessary font-loading logic. This approach is not limited to fonts and can be adapted for other setup tasks.
Fixes : #2993
PiperOrigin-RevId: 825240143
2025-10-28 15:53:03 -07:00
..
2025-08-13 13:20:26 -07:00
2025-08-18 13:04:38 -07:00
2025-08-13 13:20:26 -07:00
2025-08-18 13:04:38 -07:00
2025-10-27 15:27:45 -07:00
2025-09-18 23:27:34 -07:00
2025-10-10 16:37:12 -07:00
2025-07-10 11:06:45 -07:00
2025-10-06 09:57:21 -07:00
2025-07-23 10:49:43 -07:00
2025-10-23 17:40:57 -07:00
2025-10-08 14:58:49 -07:00
2025-10-20 10:14:34 -07:00
2025-05-13 19:28:01 -07:00
2025-06-24 16:44:34 -07:00
2025-09-18 11:44:21 -07:00
2025-10-28 13:30:04 -07:00
2025-09-10 15:22:52 -07:00
2025-10-16 13:06:41 -07:00
2025-09-24 22:44:41 -07:00
2025-07-23 10:49:43 -07:00
2025-09-08 11:15:29 -07:00
2025-10-24 19:15:10 -07:00
2025-08-16 16:10:43 -07:00
2025-08-18 17:29:09 -07:00
2025-08-16 16:10:43 -07:00
2025-08-16 16:10:43 -07:00
2025-10-28 15:53:03 -07:00
2025-05-07 09:26:19 -07:00
2025-07-23 10:49:43 -07:00
2025-08-11 11:15:06 -07:00
2025-09-08 11:15:29 -07:00
2025-07-23 10:49:43 -07:00
2025-07-23 10:49:43 -07:00
2025-07-23 10:49:43 -07:00
2025-07-23 10:49:43 -07:00
2025-10-27 15:53:33 -07:00
2025-10-07 21:16:07 -07:00
2025-10-07 17:38:35 -07:00
2025-07-23 10:49:43 -07:00
2025-07-23 10:49:43 -07:00
2025-08-14 21:36:23 -07:00
2025-07-23 10:49:43 -07:00
2025-07-23 10:49:43 -07:00
2025-08-14 21:36:23 -07:00
2025-10-08 11:35:13 -07:00
2025-07-23 10:49:43 -07:00
2025-07-23 10:49:43 -07:00
2025-10-21 14:30:34 -07:00
2025-07-23 10:49:43 -07:00
2025-09-10 15:08:26 -07:00
2025-10-21 15:44:00 -07:00
2025-10-24 14:17:04 -07:00
2025-08-05 11:50:54 -07:00
2025-08-05 11:50:54 -07:00
2025-09-16 21:23:21 -07:00
2025-10-16 15:12:43 -07:00
2025-10-22 21:44:25 -07:00
2025-10-15 09:58:31 -07:00
2025-06-02 13:41:56 -07:00
2025-06-05 15:27:23 -07:00
2025-06-16 16:22:09 -07:00
2025-07-23 10:49:43 -07:00
2025-08-16 16:10:43 -07:00
2025-09-08 13:01:47 -07:00
2025-08-16 16:10:43 -07:00
2025-08-16 16:10:43 -07:00
2025-07-23 10:49:43 -07:00
2025-10-06 13:34:09 -07:00
2025-10-21 10:35:43 -07:00
2025-10-21 10:35:43 -07:00
2025-08-02 14:53:03 -07:00
2025-07-13 10:47:11 -07:00
2025-10-27 22:13:06 -07:00
2025-10-02 13:43:10 -07:00
2025-07-23 10:49:43 -07:00
2025-07-23 10:49:43 -07:00
2025-10-16 23:24:40 -07:00
2025-06-07 15:46:46 -07:00
2025-06-03 18:20:10 -07:00
2025-10-01 14:15:01 -07:00
2025-09-23 15:35:57 -07:00
2025-09-23 15:35:31 -07:00
2025-09-25 10:38:04 -07:00
2025-08-16 16:10:43 -07:00
2025-08-13 11:18:26 -07:00
2025-07-23 10:49:43 -07:00
2025-08-16 16:10:43 -07:00
2025-08-16 16:10:43 -07:00
2025-08-16 16:10:43 -07:00
2025-08-22 11:36:58 -07:00
2025-08-22 09:40:31 -07:00
2025-07-23 10:49:43 -07:00
2025-10-28 15:52:14 -07:00
2025-08-14 21:36:23 -07:00
2025-09-30 09:37:54 -07:00