Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AI Northstar Tech Vector io Push To Hub

From Leeroopedia
Knowledge Sources
Domains HuggingFace, Export, Dataset_Publishing
Last Updated 2026-10-15 00:00 GMT

Overview

Wrapper around the HuggingFace Hub API for uploading VDF export directories as HuggingFace datasets, provided by the vector-io library.

Description

The push_to_hub function wraps the huggingface_hub library's HfApi to upload a completed VDF export directory to the HuggingFace Hub as a dataset repository. It handles authentication, repository creation, folder upload, and dataset card generation.

The function:

  • Collects the HuggingFace token (from HUGGING_FACE_TOKEN env var or interactive prompt via getpass).
  • Collects the HuggingFace username (from HF_USERNAME env var or interactive prompt).
  • Creates a private or public dataset repository at {HF_USERNAME}/vdf_{name} using HfApi.create_repo.
  • Uploads the entire VDF export directory via HfApi.upload_folder.
  • Creates and uploads a README.md dataset card with VDF tags.

This is a Wrapper Doc: it documents how vector-io uses the external huggingface_hub library in its workflow context.

Usage

Import this function when you need to upload a VDF export directory to the HuggingFace Hub. It is called automatically by the export CLI when --push_to_hub is passed, or can be invoked standalone via the push_to_hub_vdf console script.

Code Reference

Source Location

  • Repository: vector-io
  • File: src/vdf_io/scripts/push_to_hub_vdf.py

Signature

def push_to_hub(export_obj: ExportVDB, args: dict) -> None:
    """
    Upload a VDF export directory to HuggingFace Hub as a dataset.

    Creates a dataset repo at {HF_USERNAME}/vdf_{name}, uploads all files
    from export_obj.vdf_directory, and creates a README dataset card.

    Args:
        export_obj: ExportVDB instance with vdf_directory attribute
        args: Dict with 'name' (str or None), 'public' (bool), 'HF_USERNAME' (str or None)
    """

Import

from vdf_io.scripts.push_to_hub_vdf import push_to_hub

I/O Contract

Inputs

Name Type Required Description
export_obj ExportVDB Yes Export instance with vdf_directory on disk
args dict Yes Must contain 'name', 'public', 'HF_USERNAME'
HUGGING_FACE_TOKEN str (env) Yes HuggingFace API token with write access
HF_USERNAME str (env) Yes HuggingFace username for repo namespace

Outputs

Name Type Description
HuggingFace dataset Repo on Hub Dataset at {HF_USERNAME}/vdf_{name}
README.md File uploaded Dataset card with VDF tags

Usage Examples

Automatic (via export CLI)

# Export from Pinecone and push to Hub automatically
export_vdf pinecone --push_to_hub --public --model_name text-embedding-3-small

Standalone CLI

# Upload an existing VDF directory to Hub
push_to_hub_vdf --vdf_directory ./vdf_20240125_130746_ac5a6 --public

Programmatic

from vdf_io.scripts.push_to_hub_vdf import push_to_hub

# After running an export that produced export_obj:
push_to_hub(export_obj, {
    "name": "my_dataset",       # Becomes vdf_my_dataset
    "public": False,            # Private dataset
    "HF_USERNAME": "myuser",   # Or set HF_USERNAME env var
})

Related Pages

Implements Principle

Requires Environment

Related Implementations

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment