Python bindings for @yrp's BochsCPU using FFI to easily and accurately emulate x86 code.
bochscpu-python requires a Python environment of 3.8 or more recent only.
By far the simplest way to get things up and running is using the stable packaged version on PyPI
python -m pip install bochscpu-pythonDownload the latest working artifact from the repository Github Actions tab. Extract the ZIP file, install the .whl file you'll find inside the wheel folder.
python -m pip install wheel/bochscpu-$version-$os-$arch.whlFairly straight forward:
python -m pip install .Or without cloning
python -m pip install git+https://github.com/hugsy/bochscpu-python.git#egg=bochscpu-pythonNote that this approach will require you to have all the building tools necessary installed (as described below)
- Python 3.8+ (with development kit)
cmakepip- a C++20 compatible compiler (tested
clfor Windows,clang++for MacOS andg++Linux)
- Build BochsCPU, BochsCPU-FFI, and BochsCPU-Build following the instructions on their respective pages
- ... Alternatively BochsCPU-FFI for Windows & Linux libraries object files can be downloaded from the
buildGithub Actions - Move the
*.libinbochscpu/lib/<BuildType>(whereBuildTypecan beDebug,Release,RelWithDebInfo, etc.) - Install the requirements:
python -m pip install -r requirements.txt - Build with
cmakeThis will generate the bochscpupydfile (and its PDB) which you can import from a Python session withimport bochscpu. - ... Alternatively you can also generate a
.whlfrom the root of the project:
python -m pip wheel . Just import the bochscpu module and let the fun begin! Installing the package will also install interface files, allowing modern IDEs (VSCode, PyCharm, etc.) to offer useful completion.