Skip to main content

WebView2 installer for Windows

Project description

WebView2 Installer

Документация на русском

A library for checking and automatically installing the WebView2 Evergreen Runtime on Windows.

Supported architectures: x86, x64, ARM64.

📦 Distribution Methods

1. Python Package (wheel)

pip install webview2-installer

2. DLL Library

Pre-built DLL files for integration into C/C++ projects:

  • webview2_installer_x86.dll — for 32-bit Windows
  • webview2_installer_x64.dll — for 64-bit Windows
  • webview2_installer_arm64.dll — for ARM64 Windows

🚀 Usage in Python

from webview2_installer import (
    is_webview2_installed,
    install_webview2_if_not_installed,
    download_and_install_webview2
)

# Check if WebView2 is installed
if is_webview2_installed():
    print("✅ WebView2 is already installed")
else:
    print("❌ WebView2 not found")

# Install if not installed (recommended method)
result = install_webview2_if_not_installed(verbose=True)
if result == 0:
    print("✅ WebView2 is already installed")
elif result == 1:
    print("✅ WebView2 installation started")
else:
    print("❌ WebView2 installation failed")

# Force download and installation
success = download_and_install_webview2(verbose=True)
if success:
    print("✅ Installation successfully started")

Return values for install_webview2_if_not_installed()

Value Description
0 WebView2 is already installed
1 Installation successfully started
-1 Installation failed

🔧 Using the DLL in C/C++

Function Signatures

// Checks if WebView2 is installed
bool is_webview2_installed(void);

// Downloads and installs WebView2 (silent installation)
bool download_and_install_webview2(void);

// With verbose output
bool download_and_install_webview2_verbose(void);

// Installs if not installed (0 = already installed, 1 = success, -1 = error)
int install_webview2_if_not_installed(void);

// With verbose output
int install_webview2_if_not_installed_verbose(void);

C Example

#include <windows.h>
#include <stdio.h>

typedef bool (*is_installed_fn)(void);
typedef int (*install_if_needed_fn)(void);

int main() {
    HMODULE dll = LoadLibrary("webview2_installer_x64.dll");
    if (!dll) return 1;
    
    is_installed_fn is_installed = (is_installed_fn)GetProcAddress(dll, "is_webview2_installed");
    install_if_needed_fn install_if_needed = (install_if_needed_fn)GetProcAddress(dll, "install_webview2_if_not_installed");
    
    if (is_installed && install_if_needed) {
        int result = install_if_needed();
        printf("Result: %d\n", result);
    }
    
    FreeLibrary(dll);
    return 0;
}

🛠️ Development and Building

Requirements

  • Rust (2021 edition)
  • Python 3.8+
  • Visual Studio Build Tools (Windows)
  • cargo, rustup

Building the DLL

# Build release versions for all architectures
python build_dll.py

# Build debug versions
python build_dll.py --debug

# Dynamic linking (requires VC++ Redist)
python build_dll.py --dynamic

Building the Python Package

# Install development dependencies
pip install -e ".[dev]"

# Build the package
python -m build

# Or via devscript
devscript build_wheel

Cleaning Build Files

devscript clean

📋 System Requirements

  • OS: Windows 7 / 8 / 10 / 11
  • Architectures: x86, x64, ARM64
  • Python: 3.8+ (for Python package)
  • Internet: required for downloading the installer

🔍 How It Works

  • Installation Check: Checks for WebView2 registry keys in Windows registry
  • Download: Downloads the official Microsoft installer
  • Installation: Runs in silent mode (/silent /install)
  • Cleanup: Temporary files are automatically deleted

📄 License

MIT License

🤝 Contributing

PRs and Issues are welcome! Please ensure changes work on all target architectures.

⚠️ Known Limitations

  • Windows only (target platform)
  • Synchronous installation — you need to wait for WebView2 to finish installing

WebView2 Installer

Documentation in English

Библиотека для проверки установки и автоматической установки WebView2 Evergreen Runtime на Windows.

Поддерживает архитектуры: x86, x64, ARM64.

📦 Способы распространения

1. Python пакет (wheel)

pip install webview2-installer

2. DLL библиотека

Готовые DLL файлы для интеграции в C/C++ проекты:

  • webview2_installer_x86.dll — для 32-bit Windows
  • webview2_installer_x64.dll — для 64-bit Windows
  • webview2_installer_arm64.dll — для ARM64 Windows

🚀 Использование в Python

from webview2_installer import (
    is_webview2_installed,
    install_webview2_if_not_installed,
    download_and_install_webview2
)

# Проверить, установлен ли WebView2
if is_webview2_installed():
    print("✅ WebView2 уже установлен")
else:
    print("❌ WebView2 не найден")

# Установить, если не установлен (рекомендуемый способ)
result = install_webview2_if_not_installed(verbose=True)
if result == 0:
    print("✅ WebView2 уже установлен")
elif result == 1:
    print("✅ Установка WebView2 запущена")
else:
    print("❌ Ошибка установки WebView2")

# Принудительная загрузка и установка
success = download_and_install_webview2(verbose=True)
if success:
    print("✅ Установка успешно запущена")

Возвращаемые значения install_webview2_if_not_installed()

Значение Описание
0 WebView2 уже установлен
1 Установка успешно запущена
-1 Ошибка установки

🔧 Использование DLL в C/C++

Сигнатуры функций

// Проверяет установлен ли WebView2
bool is_webview2_installed(void);

// Загружает и устанавливает WebView2 (тихая установка)
bool download_and_install_webview2(void);

// С подробным выводом
bool download_and_install_webview2_verbose(void);

// Устанавливает если не установлен (0 = уже есть, 1 = успешно, -1 = ошибка)
int install_webview2_if_not_installed(void);

// С подробным выводом
int install_webview2_if_not_installed_verbose(void);

Пример на C

#include <windows.h>
#include <stdio.h>

typedef bool (*is_installed_fn)(void);
typedef int (*install_if_needed_fn)(void);

int main() {
    HMODULE dll = LoadLibrary("webview2_installer_x64.dll");
    if (!dll) return 1;
    
    auto is_installed = (is_installed_fn)GetProcAddress(dll, "is_webview2_installed");
    auto install_if_needed = (install_if_needed_fn)GetProcAddress(dll, "install_webview2_if_not_installed");
    
    if (is_installed && install_if_needed) {
        int result = install_if_needed();
        printf("Result: %d\n", result);
    }
    
    FreeLibrary(dll);
    return 0;
}

🛠️ Разработка и сборка

Требования

  • Rust (2021 edition)
  • Python 3.8+
  • Visual Studio Build Tools (Windows)
  • cargo, rustup

Сборка DLL

# Собрать release версии для всех архитектур
python build_dll.py

# Собрать debug версии
python build_dll.py --debug

# Динамическая линковка (требуется VC++ Redist)
python build_dll.py --dynamic

Сборка Python пакета

# Установка зависимостей разработки
pip install -e ".[dev]"

# Сборка пакета
python -m build

# Или через devscript
devscript build_wheel

Очистка файлов сборки

devscript clean

📋 Требования к системе

  • ОС: Windows 7 / 8 / 10 / 11
  • Архитектуры: x86, x64, ARM64
  • Python: 3.8+ (для Python пакета)
  • Интернет: требуется для загрузки установщика

🔍 Как это работает

  1. Проверка установки: через реестр Windows проверяется наличие ключей WebView2
  2. Загрузка: скачивается официальный установщик от Microsoft
  3. Установка: запускается в тихом режиме (/silent /install)
  4. Очистка: временные файлы автоматически удаляются

📄 Лицензия

MIT License

🤝 Вклад в проект

PR и Issues приветствуются! Убедитесь, что изменения работают на всех целевых архитектурах.

⚠️ Известные ограничения

  • Только Windows (целевая платформа)
  • Установка синхронная — требуется подождать, пока webview2 установится

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

webview2_installer-1.0.0.tar.gz (23.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

webview2_installer-1.0.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file webview2_installer-1.0.0.tar.gz.

File metadata

  • Download URL: webview2_installer-1.0.0.tar.gz
  • Upload date:
  • Size: 23.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for webview2_installer-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a80b74b53fc6120395a2969a6425c3124f1ef6eb91d6a3c9dda9b349d5720d10
MD5 dace42304af910582d56ff8f50aaef42
BLAKE2b-256 cc2b46a396c5644ee180021e6190439b46a0576584a1bcaebf77d5aeacbf719a

See more details on using hashes here.

Provenance

The following attestation bundles were made for webview2_installer-1.0.0.tar.gz:

Publisher: publish.yml on MagIlyasDOMA/webview2_installer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file webview2_installer-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for webview2_installer-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3364ed351ee2373293a2e409574901dd8d07a9f0fdf6358b8208643e95227c8d
MD5 71e552fffe3b5f907eb798cea31a0ffd
BLAKE2b-256 85b50550d2991043a03053a8309971ee2c64a5e00a7229ee1f27a1980593a704

See more details on using hashes here.

Provenance

The following attestation bundles were made for webview2_installer-1.0.0-py3-none-any.whl:

Publisher: publish.yml on MagIlyasDOMA/webview2_installer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page