mirror of
https://github.com/hanzoai/python-sdk.git
synced 2026-10-27 04:20:09 +00:00
Add FastAPI registry server that pre-fetches all component data from hanzoai/ui on GitHub, caches in memory, refreshes every 15min. Serves instant cached responses. Deploy at ui.hanzo.ai. - registry/cache.py: eager full-cache with concurrent GitHub fetching - registry/server.py: FastAPI endpoints for components, blocks, search - registry/client.py: RegistryClient matching GitHubAPIClient interface - Dockerfile for containerized deployment - UiTool now uses 3-tier fallback: local disk → registry → GitHub API - Bump hanzo-tools-ui to 0.2.0, server deps optional (fastapi, uvicorn)
29 lines
493 B
Python
29 lines
493 B
Python
"""Run the Hanzo UI Registry server.
|
|
|
|
Usage:
|
|
python -m hanzo_tools.ui.registry
|
|
# or
|
|
hanzo-ui-registry
|
|
"""
|
|
|
|
import os
|
|
|
|
|
|
def main():
|
|
import uvicorn
|
|
|
|
host = os.environ.get("REGISTRY_HOST", "0.0.0.0")
|
|
port = int(os.environ.get("REGISTRY_PORT", "8787"))
|
|
dev = os.environ.get("REGISTRY_DEV", "") == "1"
|
|
|
|
uvicorn.run(
|
|
"hanzo_tools.ui.registry.server:app",
|
|
host=host,
|
|
port=port,
|
|
reload=dev,
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|