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: dict | None = None)
Bases: Auth
flowchart TD
hub_sdk.hub_client.HUBClient[HUBClient]
hub_sdk.base.auth.Auth[Auth]
hub_sdk.base.auth.Auth --> hub_sdk.hub_client.HUBClient
click hub_sdk.hub_client.HUBClient href "" "hub_sdk.hub_client.HUBClient"
click hub_sdk.base.auth.Auth href "" "hub_sdk.base.auth.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
42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |
dataset
dataset(dataset_id: str | None = 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
85 86 87 88 89 90 91 92 93 94 95 96 | |
dataset_list
dataset_list(
page_size: int | None = 10, public: bool | None = 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
155 156 157 158 159 160 161 162 163 164 165 166 | |
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
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
model
model(model_id: str | None = 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
73 74 75 76 77 78 79 80 81 82 83 | |
model_list
model_list(page_size: int | None = 10, public: bool | None = 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
129 130 131 132 133 134 135 136 137 138 139 140 | |
project
project(project_id: str | None = 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
103 104 105 106 107 108 109 110 111 112 113 114 | |
project_list
project_list(
page_size: int | None = 10, public: bool | None = 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
142 143 144 145 146 147 148 149 150 151 152 153 | |
team
team(arg)
Returns an instance of the Teams class for interacting with teams.
Source code in hub_sdk/hub_client.py
98 99 100 101 | |
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
168 169 170 171 | |
user
user(user_id: str | None = 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
116 117 118 119 120 121 122 123 124 125 126 127 | |
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
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |