Demonstrate parsing ESP32 package index with enhanced validation
()
| 659 | |
| 660 | |
| 661 | def demo_esp32_parsing() -> Optional[PackageIndex]: |
| 662 | """Demonstrate parsing ESP32 package index with enhanced validation""" |
| 663 | ESP32_URL = "https://espressif.github.io/arduino-esp32/package_esp32_index.json" |
| 664 | |
| 665 | try: |
| 666 | parser = PackageIndexParser(timeout=30) |
| 667 | package_index = parser.parse_from_url(ESP32_URL) |
| 668 | |
| 669 | print("🎉 Successfully parsed ESP32 package index with Pydantic validation!") |
| 670 | display_validation_summary(package_index) |
| 671 | |
| 672 | # Display first package |
| 673 | if package_index.packages: |
| 674 | display_package_info(package_index.packages[0]) |
| 675 | |
| 676 | return package_index |
| 677 | |
| 678 | except PackageParsingError as e: |
| 679 | print(f"❌ Package parsing error: {e}") |
| 680 | sys.exit(1) |
| 681 | except KeyboardInterrupt as ki: |
| 682 | handle_keyboard_interrupt(ki) |
| 683 | raise |
| 684 | except Exception as e: |
| 685 | print(f"❌ Unexpected error: {e}") |
| 686 | sys.exit(1) |
| 687 | |
| 688 | |
| 689 | def demo_model_validation() -> None: |
no test coverage detected