drivendataorg / drivendataorg/cloudpathlib

Eager loading of cloud SDK dependencies can cause runtime error even if you don't plan to use that cloud

Open Beginner friendly
#580 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
628
Forks
88
Avg merge
17h 28m
Merged PRs (30d)
2

Description

In your [`__init__`](https://github.com/drivendataorg/cloudpathlib/blob/9d5fa708814adea1cb956ff4843eb466fbb21738/cloudpathlib/__init__.py#L5) file, you try to import all the modules linked to all the cloud services you handle.

This makes all deps mandatory, e.g. with `pip install cloudpathlib[s3]`:

```
>>> import cloudpathlib
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\rbraun\AppData\Local\miniconda3\envs\test\Lib\site-packages\cloudpathlib\__init__.py", line 5, in
from .azure.azblobclient import AzureBlobClient
File "C:\Users\rbraun\AppData\Local\miniconda3\envs\test\Lib\site-packages\cloudpathlib\azure\__init__.py", line 1, in
from .azblobclient import AzureBlobClient
File "C:\Users\rbraun\AppData\Local\miniconda3\envs\test\Lib\site-packages\cloudpathlib\azure\azblobclient.py", line 22, in
from azure.core.credentials import AzureNamedKeyCredential
ImportError: cannot import name 'AzureNamedKeyCredential' from 'azure.core.credentials' (C:\Users\rbraun\AppData\Local\miniconda3\envs\test\Lib\site-packages\azure\core\credentials.py)

Contributor guide

Open the contributing guide

Research direction

Start in cloudpathlib/__init__.py and reproduce the reported import using only the S3 extra, as shown in the issue. Check that importing cloudpathlib no longer requires unrelated cloud SDKs, while the relevant cloud-specific modules remain usable when their dependencies are installed.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, azure, python
Domain
cloud
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.