Skip to content

Commit 04f7c26

Browse files
committed
feat: provide func to initialize the DANDI client
This function should be run before a command is executed so that it can set the context of the execution such as which DANDI sever instance to interact with.
1 parent e28b6e7 commit 04f7c26

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

dandi/cli/base.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,26 @@ def bind_client(server_info: ServerInfo) -> None:
5858
set_instance_config(server_info.instance_config)
5959

6060

61+
def init_client(dandi_id: str) -> None:
62+
"""
63+
Initialize the DANDI client, including binding the client to a specific DANDI server
64+
instance
65+
66+
Parameters
67+
----------
68+
dandi_id : str
69+
The ID specifying the particular known DANDI instance to bind the client to.
70+
This is a key in the `dandi.consts.known_instances` dictionary.
71+
72+
Raises
73+
------
74+
ValueError
75+
If the provided `dandi_id` is not a valid key in the
76+
`dandi.consts.known_instances` dictionary.
77+
"""
78+
bind_client(get_server_info(dandi_id))
79+
80+
6181
# Aux common functionality
6282

6383

0 commit comments

Comments
 (0)