Repository navigation
[Python] Make cloud storage dependencies optional on import in gcsio and s3io - #40178
Conversation
|
Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment |
|
I got a bunch of test failures. Looks like our test suites often use whether Our change in this PR breaks these tests and we have to fix them. |
There was a problem hiding this comment.
Thanks, LGTM
Looks like our test suites often use whether import apache_beam.io.gcp.gcsio can run successfully as the criteria of the present of gcs dependencies.
This is the only thing a bit worrying. Current approach (Beam 2.77.0) is fragile admittedly. Hopefully this pattern isn't taken by users downstream
gcsio.py: Guardgoogle-cloud-storageimports behind a flag instead of failing at module import time when GCP extras are not installed. This allowsGCSFileSystemto be imported and registered inFileSystem.get_all_subclasses(), deferringRuntimeErroruntilGcsIOis instantiated without a client.s3io.py: Explicitly importboto3inside thetryblock soBOTO3_INSTALLEDis set toFalsewhenboto3is missing (previouslyfrom apache_beam.io.aws.clients.s3 import boto3_clientsucceeded even withoutboto3, soBOTO3_INSTALLEDhas no effect).fixes #37445