@@ -72,21 +72,27 @@ def login(
72
72
) -> project .Project :
73
73
"""Connect to [Serverless Hopsworks](https://app.hopsworks.ai) by calling the `hopsworks.login()` function with no arguments.
74
74
75
- ```python
75
+ !!! example "Connect to Serverless"
76
+ ```python
76
77
77
- project = hopsworks.login()
78
+ import hopsworks
78
79
79
- ```
80
+ project = hopsworks.login()
81
+
82
+ ```
80
83
81
84
Alternatively, connect to your own Hopsworks installation by specifying the host, port and api key.
82
85
83
- ```python
86
+ !!! example "Connect to your Hopsworks cluster"
87
+ ```python
88
+
89
+ import hopsworks
84
90
85
- project = hopsworks.login(host="my.hopsworks.server",
86
- port=8181,
87
- api_key_value="DKN8DndwaAjdf98FFNSxwdVKx")
91
+ project = hopsworks.login(host="my.hopsworks.server",
92
+ port=8181,
93
+ api_key_value="DKN8DndwaAjdf98FFNSxwdVKx")
88
94
89
- ```
95
+ ```
90
96
91
97
In addition to setting function arguments directly, `hopsworks.login()` also reads the environment variables:
92
98
HOPSWORKS_HOST, HOPSWORKS_PORT, HOPSWORKS_PROJECT and HOPSWORKS_API_KEY.
@@ -327,17 +333,16 @@ def _is_connection_active():
327
333
def get_current_project () -> project .Project :
328
334
"""Get a reference to the current logged in project.
329
335
330
- Example for creating a new project
336
+ !!! example "Example for getting the project reference"
337
+ ```python
331
338
332
- ```python
339
+ import hopsworks
333
340
334
- import hopsworks
341
+ hopsworks.login()
335
342
336
- hopsworks.login ()
343
+ project = hopsworks.get_current_project ()
337
344
338
- project = hopsworks.get_current_project()
339
-
340
- ```
345
+ ```
341
346
342
347
# Returns
343
348
`Project`. The Project object to perform operations on
@@ -358,20 +363,19 @@ def _initialize_module_apis():
358
363
def create_project (name : str , description : str = None , feature_store_topic : str = None ):
359
364
"""Create a new project.
360
365
361
- !!! warn
366
+ !!! warning "Not supported"
362
367
This is not supported if you are connected to [Serverless Hopsworks](https://app.hopsworks.ai)
363
368
364
- Example for creating a new project
365
-
366
- ```python
369
+ !!! example "Example for creating a new project"
370
+ ```python
367
371
368
- import hopsworks
372
+ import hopsworks
369
373
370
- hopsworks.login()
374
+ hopsworks.login(... )
371
375
372
- hopsworks.create_project("my_hopsworks_project ", description="An example Hopsworks project")
376
+ hopsworks.create_project("my_project ", description="An example Hopsworks project")
373
377
374
- ```
378
+ ```
375
379
# Arguments
376
380
name: The name of the project.
377
381
description: optional description of the project
0 commit comments