Skip to content

Latest commit

 

History

102 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pybindcef

High-performance Python bindings for Chromium Embedded Framework (CEF)

Video testing: https://youtu.be/yWIah-r6sbw?si=O_uNuDDE8uSf6-Nk

Note

Complete examples of using with Kivy, Tkinter and PyQt6 are under examples.

Thanks to pybind11 and CEF for existing in this world.

Inspired from cefpython

GitAds Sponsored

Sponsored by GitAds

Financial Support

GitHub Sponsors

Donate via

Donate via PayPal

Automated Build Instructions

Note

Only for versions > 0.1.0

Build and Install using automated build scripts.

Clone the repo locally:

git clone https://github.com/Novfensec/pybindcef -b main --single-branch --depth 1
cd pybindcef
  • Linux:

    chmod +x ./build.sh
    ./build.sh
    pip install .
  • Windows (Powershell):

    Install the necessary C++ build tools and CMake using Windows Package Manager (winget):

    This has to be done only once.

    winget install -e --id Microsoft.VisualStudio.BuildTools --override "--passive --wait --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended" --source winget
    winget install -e --id Kitware.CMake --source winget
    • Run the build script in powershell:
    powershell -ExecutionPolicy ByPass -c .\build.ps1
    • Then simply install via pip:
    pip install .

Manual Build Instructions

Better watch a video:

Latest build instructions

Building libcef_dll_wrapper

  • Linux

    Install necessary build tools:

    sudo apt update
    sudo apt install -y build-essential cmake ninja-build
    

    Download cef minimal build for your system architecture via https://cef-builds.spotifycdn.com/index.html

    mkdir -p ~/Downloads/cef_binary
    
    wget https://cef-builds.spotifycdn.com/cef_binary_151.3.24%2Bg2384915%2Bchromium-151.0.7922.174_linux64.tar.bz2 -O ~/Downloads/cef_binary.tar.bz2
    
    tar -xjf ~/Downloads/cef_binary.tar.bz2 -C ~/Downloads/cef_binary --strip-components=1

    Now build the libcef_dll_wrapper

    mkdir ~/Downloads/cef_binary/build
    cd ~/Downloads/cef_binary/build
    
    cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE=ON
    make -j$(nproc) libcef_dll_wrapper

    Confirm the build

    ls ~/Downloads/cef_binary/build/libcef_dll_wrapper
    

    A file named libcef_dll_wrapper.a will be listed.

  • Windows

    Install the necessary C++ build tools and CMake using Windows Package Manager (winget):

    # Install Visual C++ Build Tools
    winget install Microsoft.VisualStudio.BuildTools
    
    # Install CMake
    winget install Kitware.CMake

    Download cef minimal/standard build for your system architecture via https://cef-builds.spotifycdn.com/index.html

    Powershell commands below

    mkdir $env:USERPROFILE\Downloads\cef_binary
    
    wget "https://cef-builds.spotifycdn.com/cef_binary_151.3.24%2Bg2384915%2Bchromium-151.0.7922.174_windows64.tar.bz2" `
     -O $env:USERPROFILE\Downloads\cef_binary.tar.bz2
    
    tar -xjf $env:USERPROFILE\Downloads\cef_binary.tar.bz2 -C $env:USERPROFILE\Downloads\cef_binary --strip-components=1

    Now build the libcef_dll_wrapper

    mkdir $env:USERPROFILE\Downloads\cef_binary\build
    cd $env:USERPROFILE\Downloads\cef_binary\build
    
    # enable msvc build environment for you system x64 x86_64 x86 amd64
    # You can start the developer command prompt and type `where vcvarsall` to see the exact path
    # then simply paste that path to run e.g. C:\Program Files (x86)\Microsoft Visual Studio\18\Community\VC\Auxiliary\Build\vcvarsall.bat
    vcvarsall.bat amd64
    
    cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE=ON
    cmake --build . --config Release --target libcef_dll_wrapper --parallel

    Confirm the build

    Get-ChildItem $env:USERPROFILE\Downloads\cef_binary\build\libcef_dll_wrapper\Release
    

    A file named libcef_dll_wrapper.lib will be listed.

Building pybindcef extension

PyPI: https://pypi.org/project/pybindcef/

  • Linux

    Install pybind11.

    pip install "pybind11[global]"

    Clone this repository.

    git clone https://github.com/Novfensec/pybindcef -b main --single-branch --depth 1

    Now install via pip:

    pip install .
  • Windows

    Install pybind11.

    pip install "pybind11[global]"

    Clone this repository.

    git clone https://github.com/Novfensec/pybindcef -b main --single-branch --depth 1

    Now install via pip:

    pip install .

Running Examples

After building and installing via pip install . (or the automated scripts), you can run the examples directly:

python examples/kivy/main.py

The python module resolves the bundled CEF dependencies internally.

About

High-performance Python bindings for Chromium Embedded Framework (CEF)

Topics

Resources

Stars

11 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages