VergeOS Python SDK (pyvergeos)
pyvergeos is a Python SDK for managing VergeOS through the REST API, providing a Pythonic, type-annotated interface for automating VMs, networking, storage, tenants, and disaster recovery.
Overview
pyvergeos is a Python SDK for managing VergeOS infrastructure through the REST API. It provides a Pythonic, type-annotated interface for automating VM lifecycle, networking, storage, multi-tenant operations, and disaster recovery workflows, making it ideal for automation scripts, tooling development, and integrations.
Key Features
VM Management: Creation, configuration, power control, cloning, and snapshots
Advanced Networking: Virtual networks, firewall rules, DHCP, DNS, IPSec VPN, and WireGuard
NAS & Storage: Volume management, CIFS/NFS shares, and synchronization
Multi-Tenancy: Tenant provisioning with resource isolation
Disaster Recovery: Cloud snapshots, site synchronization, and recovery workflows
Filtering: OData filter support with a fluent filter builder API
Type Annotations: Full type hints for IDE autocompletion and static analysis
Cross-Platform: Windows, macOS, and Linux support
Requirements
Python 3.9 or later
VergeOS 26.0 or later
Installation
From PyPI (Recommended)
Using uv
From Source
Authentication
The SDK supports multiple authentication methods:
Username/Password
API Token
Environment Variables
Recommended for Production
Using environment variables keeps credentials out of your source code and makes it easy to use different credentials across environments.
Context Manager
Automatic Cleanup
Using the context manager (with statement) ensures the connection is properly closed, even if an exception occurs.
Available Resources
The SDK provides access to the following VergeOS resources:
Virtual Machines
VMs, drives, NICs, snapshots
Networking
Networks, rules, DNS, DHCP, aliases, hosts
VPN
IPSec connections, WireGuard interfaces and peers
NAS/Storage
Services, volumes, CIFS/NFS shares, volume syncs
Tenants
Tenant management, snapshots, storage, network blocks
Users & Groups
Users, groups, permissions, API keys
System
Clusters, nodes, storage tiers, certificates
Monitoring
Alarms, logs, tasks
Backup & DR
Snapshot profiles, cloud snapshots, sites, site syncs
Usage Examples
Managing Virtual Machines
Creating and Managing Networks
Filtering Resources
The SDK supports multiple filtering approaches:
Task Waiting
Many operations in VergeOS run asynchronously. Use the task manager to wait for completion:
Error Handling
The SDK provides specific exception types for different error conditions:
VergeError
Base exception for all SDK errors
AuthenticationError
Invalid credentials or expired token
NotFoundError
Requested resource does not exist
ConflictError
Resource state conflict (e.g., VM already running)
ValidationError
Invalid parameter values
TaskTimeoutError
Task did not complete within timeout
TaskError
Task failed during execution
Common Use Cases
Infrastructure automation: Provision VMs, networks, and storage programmatically
CI/CD integration: Create and destroy test environments in pipelines
Monitoring and reporting: Query resource status and generate inventory reports
Backup automation: Schedule and manage snapshots and cloud backups
Multi-tenant provisioning: Automate tenant creation and resource allocation
Documentation and Resources
For complete documentation, including all available methods and detailed usage examples, visit the official repository:
Support
If you encounter issues or have feature requests, please open an issue on the GitHub repository:
Additional Resources
PSVergeOS PowerShell Module - PowerShell alternative
Terraform Provider - Infrastructure as code
Last updated
Was this helpful?