Commit 54bb23b
refactor(core): use generic package mapping for optional dependency checks
Refactor the import error handling to use a more maintainable and scalable
approach with a package mapping structure instead of hardcoded string checks.
Changes:
- Added _OPTIONAL_PACKAGES list with (import_name, install_name) tuples
- Refactored __getattr__ to iterate through the package mapping
- Now easier to add new optional dependencies in the future
- All three server optional dependencies (fastapi, uvicorn, ag_ui) registered
This makes the codebase more maintainable when adding new optional
dependencies in the future.
Addresses feedback from @OhYee on PR #23.
Co-authored-by: OhYee <[email protected]>1 parent 5c01863 commit 54bb23b
1 file changed
+16
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
292 | 300 | | |
293 | 301 | | |
294 | 302 | | |
| |||
303 | 311 | | |
304 | 312 | | |
305 | 313 | | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
312 | 322 | | |
313 | 323 | | |
314 | 324 | | |
| |||
0 commit comments