-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow base_url without service_name in clients (#786)
base_url can now be used to effectively skip the check for `service_name == "_base"`, which has two significant impacts. The first is simply that it is now possible to instantiate a BaseClient directly, which may prove useful for ad-hoc scripting. Although not generally a recommended approach (e.g. there is no benefit to using a BaseClient in lieu of a TransferClient), the possibility only makes the SDK more flexible. The second effect is that a class inheriting from BaseClient no longer needs to set `service_name` if the setting has no appropriate value. This is relevant for 3rd party clients with nonstandard URL schemes (e.g. FuncX before the Compute rebranding) and for clients to an array of potential hosts, like GCSClient and any future ActionProviderClient. The only new test ensures that it is possible to instantiate a BaseClient directly, and the GCSClient.service_name value, although unchanged, is marked for a v4.0 update.
- Loading branch information
Showing
4 changed files
with
52 additions
and
23 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
changelog.d/20230717_162222_sirosen_improve_url_enforcement_logic.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Changed | ||
~~~~~~~ | ||
|
||
- The enforcement logic for URLs in ``BaseClient`` instantiation has been | ||
improved to only require that ``service_name`` be set if ``base_url`` is not | ||
provided. (:pr:`NUMBER`) | ||
|
||
- This change primarily impacts subclasses, which no longer need to set the | ||
``service_name`` class variable if they ensure that the ``base_url`` is | ||
always passed with a non-null value. | ||
|
||
- Direct instantiation of ``BaseClient`` is now possible, although not | ||
recommended for most use-cases. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters