Configuration¶
Environment Variables¶
Required: BARISTA_TOKEN¶
The Barista API requires authentication via a token:
# Set your Barista token (required)
export BARISTA_TOKEN=your-token-here
# For development: Contact the GO team for a dev token
# For production: Get token from Noctua login
Production Access
Production tokens must be obtained by logging into Noctua. Never commit tokens to version control.
Optional Configuration¶
# Server endpoints (defaults shown)
export BARISTA_BASE=http://barista-dev.berkeleybop.org
export BARISTA_NAMESPACE=minerva_public_dev
export BARISTA_PROVIDED_BY=http://geneontology.org
# Production server settings
export BARISTA_LIVE_BASE=http://barista.berkeleybop.org
export BARISTA_LIVE_NAMESPACE=minerva_public
Python Configuration¶
Basic Setup¶
from noctua import BaristaClient
# Use defaults (dev server)
client = BaristaClient()
# Explicit configuration
client = BaristaClient(
token="your-token",
base_url="http://barista-dev.berkeleybop.org",
namespace="minerva_public_dev",
timeout=30.0
)
Production Setup¶
# Use production server
client = BaristaClient(
base_url="http://barista.berkeleybop.org",
namespace="minerva_public"
)
Production Warning
Production models with state="production"
are protected from deletion. Always test on dev server first.
CLI Configuration¶
Default Behavior¶
The CLI uses the dev server by default for safety:
Production Usage¶
Use the --live
flag for production:
# Use production server
noctua barista list-models --live
# With explicit token
noctua barista list-models --live --token your-token
Dry Run Mode¶
Test commands without executing:
Screenshot Configuration¶
Browser Setup¶
from noctua import NoctuaScreenshotCapture
# Configure screenshot capture
capture = NoctuaScreenshotCapture(
headless=False, # Set True for no GUI
screenshot_dir="screens", # Output directory
dev_mode=True, # Use dev server
token="your-token" # Or from BARISTA_TOKEN env
)
Headless Mode¶
For CI/CD or server environments:
Server Endpoints¶
Development Server¶
- Barista API: http://barista-dev.berkeleybop.org
- Noctua UI: http://noctua-dev.berkeleybop.org
- Namespace: minerva_public_dev
- Token: Contact the GO team for dev access
Production Server¶
- Barista API: http://barista.berkeleybop.org
- Noctua UI: http://noctua.geneontology.org
- Namespace: minerva_public
- Token: Requires authentication
Best Practices¶
Development Workflow¶
- Always start with the dev server
- Use descriptive model titles
- Test thoroughly before production
- Keep tokens secure
Token Security¶
import os
from noctua import BaristaClient
# Read from environment (recommended)
client = BaristaClient(token=os.environ.get("BARISTA_TOKEN"))
# Never hardcode production tokens
# BAD: client = BaristaClient(token="abc123...")
Error Handling¶
from noctua import BaristaClient, BaristaError
try:
client = BaristaClient()
except BaristaError as e:
print(f"Configuration error: {e}")
# Handle missing token, network issues, etc.
Troubleshooting¶
Common Issues¶
Missing Token
Network Errors
Permission Denied
# Check model state
response = client.get_model(model_id)
if response.model_state == "production":
print("Model is protected - use dev server for testing")
Next Steps¶
- Start with the Quick Start Guide
- Explore the Python API
- See Working Examples