Registry / ai-ml / spaces

spaces

JSON →
library0.50.4pypypi✓ verified 83d ago

The `spaces` library (version 0.48.2) provides utilities for interacting with Hugging Face Spaces. It largely acts as a thin wrapper around the `huggingface_hub` library, which provides the core API for managing Spaces. As of late 2023, its development appears stalled, with most new Spaces features and ongoing maintenance occurring directly within `huggingface_hub`.

pip install spaces
INSTALL
IMPORT
SIG · SPACES
S
spaces
ai-mlpythonv0.50.4
Install
18.2s avg
Import
Disk
336MB
Pass rate
9/ 10
Env Coverage9 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.50.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 17.93s
py 3.11
✓ —
✓ 16.65s
py 3.12
✓ —
✓ 15.13s
py 3.13
✓ —
✓ 15.28s
py 3.9
✕ build_error
✓ 26.03s
336MB installed
● package 336MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

HfApi
from huggingface_hub import HfApi
from spaces import HfApi

Demonstrates how to initialize the Hugging Face API client using the `spaces` library and list your Hugging Face Spaces. It highlights the use of an `HF_TOKEN` for authentication.

import os from spaces import HfApi # Authenticate using an environment variable HF_TOKEN = os.environ.get("HF_TOKEN", "hf_YOUR_TOKEN_HERE") if HF_TOKEN == "hf_YOUR_TOKEN_HERE": print("Please set the HF_TOKEN environment variable for authentication.") print("You can get one from https://huggingface.co/settings/tokens") exit(1) api = HfApi(token=HF_TOKEN) try: # This example lists spaces owned by the authenticated user # Note: For new features and active development, prefer 'huggingface_hub' directly. user_info = api.whoami() if user_info and 'name' in user_info: my_spaces = api.list_spaces(author=user_info['name']) print(f"Found {len(my_spaces)} spaces for user '{user_info['name']}':") for space in my_spaces: print(f"- {space.id} (Status: {space.runtime['stage']})") else: print("Could not retrieve user info. Check your token's permissions.") except Exception as e: print(f"An error occurred: {e}") print("Ensure your HF_TOKEN is valid and has appropriate permissions.")
Debug
Known issues
gotchaThe `spaces` library (version 0.48.2) is a distinct PyPI package from `huggingface_hub`. While `spaces` leverages `huggingface_hub` internally, its development has largely stalled. New features for Hugging Face Spaces management are exclusively added to `huggingface_hub` (e.g., `v1.9.0` introduced Spaces Volumes).
fix
For up-to-date and complete Spaces API functionality, install and use `huggingface_hub` directly (`pip install huggingface_hub`), referring to its documentation.
affects: All `spaces` versions (0.x)
deprecatedThe `spaces` library's APIs for interaction with Hugging Face Spaces have largely been superseded by more comprehensive and actively maintained functionalities within `huggingface_hub`. Using `spaces` may lead to missing modern features or encountering unpatched issues.
fix
Transition existing code to use `huggingface_hub`'s `HfApi` and related classes (e.g., `from huggingface_hub import HfApi, Space, Volume`) for robust and future-proof Space management.
affects: All `spaces` versions (0.x)
gotchaThe release notes and version numbers provided in the prompt (e.g., `v1.10.x`) pertain to the `huggingface_hub` library, not the `spaces` library itself. The `spaces` library's last release was `0.48.2` (August 2023).
fix
Consult the `huggingface_hub` changelog for recent updates related to Spaces features. Do not expect `spaces` (0.x) to contain features from `huggingface_hub` `1.x` releases.
affects: All `spaces` versions (0.x)
Upgrade
Version history
0.50.4latest on PyPI · released Jun 4, 2026
Audit
Dependencies
huggingface_hubrequiredProvides the core API functionality for Hugging Face Spaces interaction.
Agent activity
25 hits · last 30 days
node
22
OpenAI (training)
1
Resources
spaces — pip install spaces · libregistry