skillfed

python-vagrant

Python bindings for interacting with Vagrant virtual machines.

python-vagrant v1.0.0 3.9M downloads/30d#2,437 on PyPI265
Permissive license MIT Active released

What it is and what it does

Python-vagrant is a thin wrapper around the Vagrant command-line tool that lets you control virtual machines programmatically from Python code. Instead of running vagrant commands manually in a shell, you instantiate a Vagrant object and call methods like up(), destroy(), halt(), and status() to manage VMs. It also provides access to SSH configuration details and supports multi-VM environments, box management, and provisioning options.

The package requires Vagrant 2.2 or greater and a supported hypervisor to be installed separately; it does not bundle or replace Vagrant itself. It has no Python runtime dependencies, making installation straightforward. The module is useful for automation workflows—such as spinning up test environments, integrating VM management into deployment pipelines, or controlling Vagrant from Fabric tasks—where you need programmatic rather than manual control.

Use it for:

  • Automate VM startup and teardown in CI/CD pipelines or test suites that need isolated environments
  • Integrate Vagrant box control into Fabric deployment tasks to run remote commands on provisioned VMs
  • Query and manage multiple VMs in a multi-VM Vagrantfile from a single Python script
  • Log and monitor Vagrant subprocess output for debugging or auditing infrastructure changes
  • Programmatically initialize VMs from base boxes and manage box lifecycle (add, remove, list)

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Programmatic control of Vagrant virtual machines through Python, wrapping the vagrant command-line tool to start, stop, query status, and manage VMs from code.

Yes, if you need to automate Vagrant VM management from Python and already have Vagrant and a hypervisor installed. The package is actively maintained, has no external Python dependencies, and carries a permissive license. The beta status and 2022 release date mean you should verify compatibility with your Vagrant version, but the straightforward API and low install friction make it a practical choice for automation workflows.

Install

python-vagrant on PyPI

pip

pip install python-vagrant

uv

uv add python-vagrant

poetry

poetry add python-vagrant

Installing python-vagrant

Before you install

Low friction installation with no runtime dependencies. Maintenance is active with recent commits, though the latest release was in 2022 and the package is marked beta, so API stability is not guaranteed.

License in practice

MIT license is permissive, allowing commercial and private use with minimal restrictions.

Quickstart

pip install python-vagrant

import vagrant
v = vagrant.Vagrant()
v.up()
print(v.status())
v.halt()

Vagrant 2.2 or greater and a supported hypervisor (VirtualBox, VMWare, etc.) must be installed and configured on the system before python-vagrant can control VMs.

Verify before relying

  • Whether Vagrant 2.2+ and a supported hypervisor (VirtualBox, VMWare, etc.) are already installed on the target system
  • Performance characteristics when managing large numbers of VMs or complex multi-VM environments
  • Compatibility with recent Vagrant versions beyond what the description states

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance actively maintained — 1,597 days since the last release
Last repo commit
First released
Downloads 3,944,441/month — #2,437 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: python_vagrant-1.0.0-py3-none-any.whl

Keywords: box, vagrant, vagrantfile, virtual-machine, virtualbox

Development Status :: 4 - BetaLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Utilities

Tags

vagrant python bindingsprogrammatic vm controlvagrant automationpython vagrant wrappervirtual machine management pythonvagrant box controlinfrastructure as code python
infrastructure-automationvagrant-wrapperdevops

More Utilities packages