Defer cloud SDK imports across AWS RDS, Azure, and Google Cloud - #10362
Defer cloud SDK imports across AWS RDS, Azure, and Google Cloud#10362dev-hari-prasad wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. WalkthroughAzure, Google, and AWS cloud modules now defer heavy SDK imports until related functions execute. Google service and authentication paths use local or cached SDK references. Existing client construction and error handling remain unchanged. ChangesCloud SDK import deferral
Estimated code review effort: 2 (Simple) | ~15 minutes Merge Risk: ⚪ Minimal · up to Cloud SDKs are now loaded when the existing workflows run, reducing startup cost without changing routes, authentication, or client behavior. No actionable merge-blocking risk remains after normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Moves heavy cloud SDK imports (
boto3,azure.*,googleapiclient,google_auth_oauthlib) from module level into function scope acrossweb/pgadmin/misc/cloud/.Blueprint and route registrations remain eager, but third-party client libraries are now only imported when a user interacts with a cloud wizard. Subsequent calls remain fast via standard
sys.modulescaching.Changes
misc/cloud/rds): Inlinedboto3.session.Sessioninget_regions()andboto3inRDS._get_aws_client().misc/cloud/azure): Added_azure_sdk()helper forAzureCliCredential,DeviceCodeCredential,AuthenticationRecord,PostgreSQLManagementClient,ResourceManagementClient,SubscriptionClient, andNameAvailabilityRequest.misc/cloud/google): InlinedInstalledAppFlowandRequest; added_google_sdk()helper fordiscoveryandHttpError. Preservedsys.modules.setdefault('oauth2client', None)at the module top.Import Time Impact (
python -X importtime)(Combined import time drops by ~1.75s / 94.1% during startup)
Verification made by my AI agent for the changes:
web/pgadmin/misc/cloud/pass cleanly.sys.moduleson blueprint load and resolve properly on demand.pycodestylepassed with 0 errors/warnings.Partially fixes and addresses #10221