New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support container client and blob client for azure blob storage #652
support container client and blob client for azure blob storage #652
Conversation
Ah flake8, my old friend. Apparently, flake8 takes offense at long lines caused by the type annotations. I added a type alias to resolve that. This introduces the first use of import from typing and modern type annotation syntax, so far as I could tell. Does that impact support for older versions of Python? |
@mpenkov mind approving the CICD? Let me know what you think of the way I did the type annotations. I can change if a different way is better. Thanks! |
Sorry, I've been busy with gensim and other projects this week. I'll try to look at this more closely next week. Thank you for your efforts and your patience! |
I don't understand why that test is failing with this NameError during smart_open/azure.py:46: in <module>
azure.storage.blob.BlobServiceClient,
E NameError: name 'azure' is not defined Going back to using the Union in "# type:" comments, plus tagging those lines with "# noqa" seems to fix the above error and also appease flake8. The noqa bit might cause a type-checker some grief, if one where to be run, but Visual Code seems not to mind. |
…ed, add noqa to appease flake8
fixes #651 |
Could be because of relative import (azure.blah vs smart_open.azure.blah) but I can't be sure atm. We don't have explicit type annotations right now (but we may in the future) so your type annotations are fine as comments for now. |
Looks like tests are failing for an unrelated reason. I'll try to investigate over the weekend. |
OK, I finally got around to investigating this. The parameterizedtestcase package was misbehaving. I got rid of it, because it wasn't strictly necessary. I'll wait for the CI to complete and then continue reviewing this PR. Thanks for your patience! |
OK, looks good to me. Thank you! |
Support ContainerClient and BlobClient in Azure storage
Support use of ContainerClient and BlobClient to access blobs in Azure storage in addition to existing support for BlobServiceClient. Overloads transport_params['client'] to accept any of the three types of clients supported by Azure storage, for example:
Motivation
This allows for a least-privilege approach. You can access azure storage with a SAS URL scoped down to a specific container or blob, rather having the full run of the storage account.
Tests
in smart_open/tests/test_azure.py