2021-02-09 16:04:00 +03:00
Libvirt Python Binding README
=============================
2009-09-16 17:03:53 +04:00
2023-06-06 16:07:00 +03:00
This package provides a module that permits applications
written in the Python 3.x programming language to call the interface
supplied by the libvirt library, to manage the virtualization
capabilities of recent versions of Linux (and other OSes).
As such, the module exposes Python bindings to to the libvirt.so,
2013-11-25 21:16:11 +04:00
libvirt-qemu.so and libvirt-lxc.so library APIs.
2009-09-16 17:03:53 +04:00
2013-11-25 21:16:11 +04:00
It is written to build against any version of libvirt that
is 0.9.11 or newer.
2009-09-16 17:03:53 +04:00
2013-11-25 21:16:11 +04:00
This code is distributed under the terms of the LGPL version
2 or later.
2009-09-16 17:03:53 +04:00
2021-02-09 16:04:00 +03:00
Requirements
------------
To build the libvirt python binary requires the GCC and pkg-config
tools, and development headers for the libvirt and python libraries.
Building and installing
-----------------------
2013-11-25 21:16:11 +04:00
The module can be built by following the normal python module
build process
2009-09-16 17:03:53 +04:00
2023-06-20 13:21:27 +03:00
$ python3 -m build
2009-09-16 17:03:53 +04:00
2023-06-20 13:21:27 +03:00
for testing and distributing purposes or it can be installed directly via pip
as
2009-09-16 17:03:53 +04:00
2023-06-20 13:21:27 +03:00
$ python3 -m pip install .
2013-11-25 21:16:11 +04:00
2023-06-20 13:21:27 +03:00
without explicit building.
2014-06-25 20:52:53 +04:00
2023-06-20 13:21:27 +03:00
In order to test the package, you'll need either tox or at least pytest,
depending on whether you want to test an already installed package in which
case the latter is sufficient or if you wish to test in a virtual
environment you'd need tox. Depending on your preferred setup, you can run the
tests either as
2014-06-25 20:52:53 +04:00
2023-06-20 13:21:27 +03:00
$ python3 -m pytest
2014-06-25 20:52:53 +04:00
2023-06-20 13:21:27 +03:00
or as
2014-06-25 20:52:53 +04:00
2023-06-20 13:21:27 +03:00
$ tox
A makefile shim is also provided for your convenience, so that you don't have
to care about the exact operations mentioned above and instead you simply do
$ make && make check
2014-06-25 20:52:53 +04:00
As of libvirt 1.2.6, it is possible to develop against an uninstalled
2014-08-04 21:09:34 +04:00
libvirt.git checkout, by setting PKG_CONFIG_PATH and LD_LIBRARY_PATH
environment variables to point into that libvirt tree; you can even
automate this by using libvirt's run script:
2014-06-25 20:52:53 +04:00
2023-06-20 13:21:27 +03:00
/path/to/libvirt/run python3 -m build
2013-11-25 21:16:11 +04:00
2021-09-21 22:20:30 +03:00
Patches for this code should be submitted as merge requests to the
project page on gitlab. See CONTRIBUTING.rst for more information.