drivendataorg / drivendataorg/cloudpathlib

Smarter default client lookup

Open
#160 1 comment 0 reactions 0 assignees View on GitHub
design decision enhancement
Dominant language
Python
Stars
628
Forks
88
Avg merge
17h 28m
Merged PRs (30d)
2

Description

Currently, the default client is constructed purely based on the implementation class and not on the path.

It would be nice if there was a way to be able to register credential arguments based on the path and construct clients as needed for the given location.

For instance, different S3 buckets may require different access keys or profiles, and different Azure accounts or containers may have different access keys.

The registry could simply be a table mapping regular expressions to a set of arguments to pass to the corresponding client constructor:

```python
CloudClient.register_default('s3://my-bucket/' : dict(profile_name = 'my-profile'))
CloudClient.register_default('s3://bobs-bucket/' : dict(profile_name = 'bobs-profile'))
CloudClient.register_default('azure://acme/widgets/' : dict(credential = '?...')) # where acme is the account name
```

This would save the user from the chore of manually creating and passing around clients when working with paths that cannot be accessed using a single client of a given type.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.