skillfed

PyVirtualDisplay

python wrapper for Xvfb, Xephyr and Xvnc

pyvirtualdisplay v3.0 2.2M downloads/30d#3,204 on PyPI780
Permissive license BSD DORMANT released

What it is and what it does

PyVirtualDisplay is a Python wrapper that manages virtual X11 display servers (Xvfb, Xephyr, Xvnc) on Linux. It lets you run GUI applications and capture their output without a physical display or graphical environment. The package handles display lifecycle (start/stop), environment variable management, and optional screenshot capture via its SmartDisplay submodule.

Typical use is in CI/CD pipelines, automated testing, and server environments where you need to run GUI tools headlessly. It requires the underlying X server backend (Xvfb, Xephyr, or Xvnc) to be installed on the system separately; PyVirtualDisplay only wraps and controls them. The context-manager API makes cleanup automatic.

Use it for:

  • Run GUI tests in CI/CD without a display server, capturing pass/fail via virtual display.
  • Automate screenshots of X11 applications running on a headless server.
  • Test applications at specific resolutions or color depths by configuring virtual display parameters.
  • Expose a GUI application via VNC by running it on a virtual Xvnc backend.
  • Run multiple nested X servers concurrently for complex testing scenarios.

Worth the install?

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

Wraps Xvfb, Xephyr, and Xvnc to create virtual X11 displays for headless GUI testing, automation, and screenshots on Linux systems.

Yes, if you need headless X11 GUI automation on Linux and can accept dormant maintenance. The package is stable, has no dependencies, and works reliably for its core use case. Install the underlying X server backend (xvfb, xephyr, or tigervnc-server) separately on your system first. Not suitable for macOS or Windows.

Install

pyvirtualdisplay on PyPI

pip

pip install pyvirtualdisplay

uv

uv add pyvirtualdisplay

poetry

poetry add pyvirtualdisplay

Installing PyVirtualDisplay

Before you install

Low install friction with no runtime dependencies. Maintenance is dormant—last release was in 2022 and no commits since February 2024—but the package is stable and widely used (780 GitHub stars, top 5000 on PyPI).

License in practice

BSD license is permissive; you can use this in commercial and proprietary projects with minimal restrictions.

Quickstart

from pyvirtualdisplay import Display

with Display(visible=False, size=(100, 60)) as disp:
    # Run GUI applications here
    print(disp.is_alive())  # True
# Display automatically stopped

Requires Xvfb, Xephyr, or Xvnc to be installed on the system (e.g., `sudo apt-get install xvfb` on Ubuntu). Only works on Linux with X11; not compatible with Windows or macOS.

Verify before relying

  • Whether the package works reliably with Python 3.12 (description mentions it but classifiers only list through 3.11).
  • Current status of thread-safety guarantees and whether manage_global_env=False is production-ready.
  • Whether dormant maintenance poses risk for future X11 ecosystem changes or Python version incompatibilities.

Package facts

License BSD (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance dormant — 1,643 days since the last release
Last repo commit
First released
Downloads 2,214,308/month — #3,204 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: PyVirtualDisplay-3.0-py3-none-any.whl

Keywords: Xvfb, Xephyr, X, wrapper

License :: OSI Approved :: BSD LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

virtual X11 displayheadless GUI testingXvfb wrapperautomated screenshot captureX server automationGUI testing without displayvirtual display server
headless-testingx11-automationlinux-only

More Testing packages