Reference for hub_sdk/hub_client.py
Note
This file is available at https://github.com/ultralytics/hub-sdk/blob/main/hub_sdk/hub_client.py. If you spot a problem please help fix it by contributing a Pull Request 🛠️. Thank you 🙏!
hub_sdk.hub_client.HUBClient
HUBClient(credentials: Optional[Dict] = None)
Bases: Auth
A client class for interacting with a HUB service, extending authentication capabilities.
Attributes:
Name | Type | Description |
---|---|---|
authenticated |
bool
|
Indicates whether the client is authenticated. |
api_key |
str
|
The API key for authentication. |
id_token |
str
|
The identity token for authentication. |
Parameters:
Name | Type | Description | Default |
---|---|---|---|
credentials
|
Dict
|
A dictionary containing authentication credentials. If None, the client will attempt to retrieve the API key from the environment variable "HUB_API_KEY". |
None
|
Source code in hub_sdk/hub_client.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
|
dataset
dataset(dataset_id: str = None) -> Datasets
Return an instance of the Datasets class for interacting with datasets.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dataset_id
|
str
|
The identifier of the dataset. If provided, returns an instance associated with the specified dataset_id. |
None
|
Returns:
Type | Description |
---|---|
Datasets
|
An instance of the Datasets class. |
Source code in hub_sdk/hub_client.py
95 96 97 98 99 100 101 102 103 104 105 106 107 |
|
dataset_list
dataset_list(
page_size: Optional[int] = 10, public: Optional[bool] = None
) -> DatasetList
Return a DatasetList instance for interacting with a list of datasets.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page_size
|
int
|
The number of datasets per page. |
10
|
public
|
bool
|
Pass true to retrieve list of Public dataset list. |
None
|
Returns:
Type | Description |
---|---|
DatasetList
|
An instance of the DatasetList class. |
Source code in hub_sdk/hub_client.py
170 171 172 173 174 175 176 177 178 179 180 181 182 |
|
login
login(api_key=None, id_token=None, email=None, password=None)
Log in the client using provided authentication credentials.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_key
|
str
|
The API key for authentication. |
None
|
id_token
|
str
|
The identity token for authentication. |
None
|
email
|
str
|
User's email. |
None
|
password
|
str
|
User's password. |
None
|
Source code in hub_sdk/hub_client.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|
model
model(model_id: Optional[str] = None) -> Models
Return an instance of the Models class for interacting with models.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id
|
str
|
The identifier of the model. If provided, returns an instance associated with the specified model_id. |
None
|
Returns:
Type | Description |
---|---|
Models
|
An instance of the Models class. |
Source code in hub_sdk/hub_client.py
82 83 84 85 86 87 88 89 90 91 92 93 |
|
model_list
model_list(
page_size: Optional[int] = 10, public: Optional[bool] = None
) -> ModelList
Return a ModelList instance for interacting with a list of models.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page_size
|
int
|
The number of models per page. |
10
|
public
|
bool
|
Pass true to retrieve list of Public models list. |
None
|
Returns:
Type | Description |
---|---|
ModelList
|
An instance of the ModelList class. |
Source code in hub_sdk/hub_client.py
142 143 144 145 146 147 148 149 150 151 152 153 154 |
|
project
project(project_id: Optional[str] = None) -> Projects
Return an instance of the Projects class for interacting with Projects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_id
|
str
|
The identifier of the project. If provided, returns an instance associated with the specified project_id. |
None
|
Returns:
Type | Description |
---|---|
Projects
|
An instance of the Projects class. |
Source code in hub_sdk/hub_client.py
114 115 116 117 118 119 120 121 122 123 124 125 126 |
|
project_list
project_list(
page_size: Optional[int] = 10, public: Optional[bool] = None
) -> ProjectList
Return a ProjectList instance for interacting with a list of projects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page_size
|
int
|
The number of projects per page. |
10
|
public
|
bool
|
Pass true to retrieve list of Public models list. |
None
|
Returns:
Type | Description |
---|---|
ProjectList
|
An instance of the ProjectList class. |
Source code in hub_sdk/hub_client.py
156 157 158 159 160 161 162 163 164 165 166 167 168 |
|
team
team(arg)
Returns an instance of the Teams class for interacting with teams.
Source code in hub_sdk/hub_client.py
109 110 111 112 |
|
team_list
team_list(page_size=None, public=None)
Fetches a list of team members with optional pagination.
Source code in hub_sdk/hub_client.py
184 185 186 187 |
|
user
user(user_id: Optional[str] = None) -> Users
Return an instance of the Users class for interacting with Projects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_id
|
str
|
The identifier of the user. If provided, returns an instance associated with the specified user_id. |
None
|
Returns:
Type | Description |
---|---|
Users
|
An instance of the Users class. |
Source code in hub_sdk/hub_client.py
128 129 130 131 132 133 134 135 136 137 138 139 140 |
|
hub_sdk.hub_client.require_authentication
require_authentication(func) -> callable
Ensure that the wrapped method can only be executed if the client is authenticated.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
func
|
callable
|
The method to be wrapped. |
required |
Returns:
Type | Description |
---|---|
callable
|
The wrapped method that checks authentication before execution. |
Source code in hub_sdk/hub_client.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|