> For the complete documentation index, see [llms.txt](https://boinc-ai.gitbook.io/hub-python-library/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://boinc-ai.gitbook.io/hub-python-library/reference/space-runtime.md).

# Space runtime

## Managing your Space runtime

Check the [HfApi](https://huggingface.co/docs/huggingface_hub/v0.18.0.rc0/en/package_reference/hf_api#huggingface_hub.HfApi) documentation page for the reference of methods to manage your Space on the Hub.

* Duplicate a Space: [duplicate\_space()](https://huggingface.co/docs/huggingface_hub/v0.18.0.rc0/en/package_reference/hf_api#huggingface_hub.HfApi.duplicate_space)
* Fetch current runtime: [get\_space\_runtime()](https://huggingface.co/docs/huggingface_hub/v0.18.0.rc0/en/package_reference/hf_api#huggingface_hub.HfApi.get_space_runtime)
* Manage secrets: [add\_space\_secret()](https://huggingface.co/docs/huggingface_hub/v0.18.0.rc0/en/package_reference/hf_api#huggingface_hub.HfApi.add_space_secret) and [delete\_space\_secret()](https://huggingface.co/docs/huggingface_hub/v0.18.0.rc0/en/package_reference/hf_api#huggingface_hub.HfApi.delete_space_secret)
* Manage hardware: [request\_space\_hardware()](https://huggingface.co/docs/huggingface_hub/v0.18.0.rc0/en/package_reference/hf_api#huggingface_hub.HfApi.request_space_hardware)
* Manage state: [pause\_space()](https://huggingface.co/docs/huggingface_hub/v0.18.0.rc0/en/package_reference/hf_api#huggingface_hub.HfApi.pause_space), [restart\_space()](https://huggingface.co/docs/huggingface_hub/v0.18.0.rc0/en/package_reference/hf_api#huggingface_hub.HfApi.restart_space), [set\_space\_sleep\_time()](https://huggingface.co/docs/huggingface_hub/v0.18.0.rc0/en/package_reference/hf_api#huggingface_hub.HfApi.set_space_sleep_time)

### Data structures

#### SpaceRuntime

#### class huggingface\_hub.SpaceRuntime

[\<source>](https://github.com/huggingface/huggingface_hub/blob/v0.18.0.rc0/src/huggingface_hub/_space_api.py#L87)

( data: typing.Dict )

Parameters

* **stage** (`str`) — Current stage of the space. Example: RUNNING.
* **hardware** (`str` or `None`) — Current hardware of the space. Example: “cpu-basic”. Can be `None` if Space is `BUILDING` for the first time.
* **requested\_hardware** (`str` or `None`) — Requested hardware. Can be different than `hardware` especially if the request has just been made. Example: “t4-medium”. Can be `None` if no hardware has been requested yet.
* **sleep\_time** (`int` or `None`) — Number of seconds the Space will be kept alive after the last request. By default (if value is `None`), the Space will never go to sleep if it’s running on an upgraded hardware, while it will go to sleep after 48 hours on a free ‘cpu-basic’ hardware. For more details, see <https://huggingface.co/docs/hub/spaces-gpus#sleep-time>.
* **raw** (`dict`) — Raw response from the server. Contains more information about the Space runtime like number of replicas, number of cpu, memory size,…

Contains information about the current runtime of a Space.

#### SpaceHardware

#### class huggingface\_hub.SpaceHardware

[\<source>](https://github.com/huggingface/huggingface_hub/blob/v0.18.0.rc0/src/huggingface_hub/_space_api.py#L48)

( valuenames = Nonemodule = Nonequalname = Nonetype = Nonestart = 1 )

Enumeration of hardwares available to run your Space on the Hub.

Value can be compared to a string:

Copied

```
assert SpaceHardware.CPU_BASIC == "cpu-basic"
```

Taken from <https://github.com/huggingface/moon-landing/blob/main/server/repo_types/SpaceInfo.ts#L73> (private url).

#### SpaceStage

#### class huggingface\_hub.SpaceStage

[\<source>](https://github.com/huggingface/huggingface_hub/blob/v0.18.0.rc0/src/huggingface_hub/_space_api.py#L23)

( valuenames = Nonemodule = Nonequalname = Nonetype = Nonestart = 1 )

Enumeration of possible stage of a Space on the Hub.

Value can be compared to a string:

Copied

```
assert SpaceStage.BUILDING == "BUILDING"
```

Taken from <https://github.com/huggingface/moon-landing/blob/main/server/repo_types/SpaceInfo.ts#L61> (private url).

#### SpaceStorage

#### class huggingface\_hub.SpaceStorage

[\<source>](https://github.com/huggingface/huggingface_hub/blob/v0.18.0.rc0/src/huggingface_hub/_space_api.py#L69)

( valuenames = Nonemodule = Nonequalname = Nonetype = Nonestart = 1 )

Enumeration of persistent storage available for your Space on the Hub.

Value can be compared to a string:

Copied

```
assert SpaceStorage.SMALL == "small"
```

Taken from <https://github.com/huggingface/moon-landing/blob/main/server/repo_types/SpaceHardwareFlavor.ts#L24> (private url).

#### SpaceVariable

#### class huggingface\_hub.SpaceVariable

[\<source>](https://github.com/huggingface/huggingface_hub/blob/v0.18.0.rc0/src/huggingface_hub/_space_api.py#L127)

( key: strvalues: typing.Dict )

Parameters

* **key** (`str`) — Variable key. Example: `"MODEL_REPO_ID"`
* **value** (`str`) — Variable value. Example: `"the_model_repo_id"`.
* **description** (`str` or None) — Description of the variable. Example: `"Model Repo ID of the implemented model"`.
* **updatedAt** (`datetime`) — datetime of the last update of the variable.

Contains information about the current variables of a Space.
