{"library":"pyvespa","title":"Pyvespa: Python API for Vespa.ai","description":"Pyvespa provides a Python API to Vespa, the open-sourced serving engine for storing, computing, and ranking big data at user serving time. It enables users to create, modify, deploy, and interact with running Vespa instances, facilitating faster prototyping and familiarization with Vespa features. The current version is 1.1.2. Releases are generally frequent, with minor versions released multiple times a week for the main Vespa engine and `pyvespa` releases following to maintain compatibility and add features.","language":"python","status":"active","last_verified":"Sat May 16","install":{"commands":["pip install pyvespa"],"cli":null},"imports":["from pyvespa.application import ApplicationPackage","from pyvespa.schema import Schema","from pyvespa.schema import Document","from pyvespa.schema import Field","from pyvespa.clients.vespa_docker import VespaDocker","from pyvespa.clients.vespa import Vespa","from pyvespa.clients.vespa_cloud import VespaCloud"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import time\nfrom pyvespa.application import ApplicationPackage\nfrom pyvespa.schema import Schema, Document, Field\nfrom pyvespa.clients.vespa_docker import VespaDocker\nfrom pyvespa.clients.vespa import Vespa\n\n# 1. Define your application schema\napp_package = ApplicationPackage(\n    name='my_app',\n    schema=Schema(\n        name='my_document',\n        document=Document(\n            fields=[\n                Field(name='id', type='string', indexing=['attribute', 'summary']),\n                Field(name='title', type='string', indexing=['index', 'summary'], index='enable-bm25'),\n                Field(name='body', type='string', indexing=['index', 'summary'], index='enable-bm25')\n            ]\n        )\n    )\n)\n\n# 2. Deploy to local Docker instance\n# Ensure Docker daemon is running and has at least 6GB memory allocated\nvespa_docker = VespaDocker(port=8080, container_memory='6G')\ntry:\n    app = vespa_docker.deploy(application_package=app_package)\n    print(\"Vespa application deployed successfully to Docker.\")\n\n    # 3. Feed documents\n    docs_to_feed = [\n        {\"id\": \"doc:1\", \"title\": \"The Quick Brown Fox\", \"body\": \"Jumps over the lazy dog.\"}, \n        {\"id\": \"doc:2\", \"title\": \"Lazy Dog Sits\", \"body\": \"The quick brown fox watches.\"}\n    ]\n    app.feed_iterable(docs_to_feed)\n    print(\"Documents fed.\")\n\n    # Wait a bit for indexing to complete\n    time.sleep(5)\n\n    # 4. Query data\n    query_result = app.query(yql='select * from sources * where userQuery();', query='fox')\n    print(\"Query Results:\")\n    for hit in query_result.hits:\n        print(f\"  ID: {hit['id']}, Title: {hit['fields']['title']}, Body: {hit['fields']['body']}\")\n\nfinally:\n    # 5. Shut down Vespa Docker instance\n    vespa_docker.stop()\n    print(\"Vespa Docker instance stopped.\")","lang":"python","description":"This quickstart demonstrates how to define a simple Vespa application schema, deploy it to a local Docker instance using `VespaDocker`, feed documents, and execute a basic query. It covers the core workflow for local development with pyvespa.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-16","installed_version":"1.0.2","pypi_latest":"1.2.1","is_stale":true,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":7.6,"avg_import_s":null,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pyvespa","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"74.4M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pyvespa","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":8.8,"import_time_s":null,"mem_mb":null,"disk_size":"76M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pyvespa","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"79.4M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pyvespa","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":7.4,"import_time_s":null,"mem_mb":null,"disk_size":"81M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pyvespa","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"70.7M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pyvespa","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":5.8,"import_time_s":null,"mem_mb":null,"disk_size":"72M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pyvespa","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"70.4M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pyvespa","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":6,"import_time_s":null,"mem_mb":null,"disk_size":"72M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pyvespa","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"75.5M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pyvespa","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":10,"import_time_s":null,"mem_mb":null,"disk_size":"77M"}]}}