Skip to main content

pyMHF

pyMHF is a python Modding and Hooking Framework. It is designed to make it very easy to create libraries for any game or application which can then be used to make mods.

Features

pyMHF contains a number of important features to make creating a modding library as easy as possible:

Using pyMHF

pyMHF has a number of command line arguments to make running it easier. The main way to run pyMHF is by calling it like so:

python -m pymhf run <module>

Where <module> can either be the name of any library using pyMHF, the absolute or relative path to a folder which contains a pyproject.toml file (this method is often used for local development of libraries), or even the absolute or relative path to a single-file mod.

pyMHF also has a config mode which allows you to override the default values which are provided by the pymhf.toml file as part of a library.

This configuration is done by running

python -m pymhf config <module>

For all possible options, see pymhf --help.

Simple hooking

To create a hook, the following pieces of information are required:

  • The relative offset of the function from the start of the binary or the byte signature [WIP] of the function.
  • The function call signature. This is the return and argument types, specified as would be expected by using Pythons' ctypes library.
  • A class definition which can be used to indicate the hierarchy of functions to allow for simpler calling of functions from the code.

Once this is provided, hooks can be defined as methods within a Mod class, allowing for complex behaviour to be implemented with little effort.

Ability to hook functions across multiple binaries

Whilst not fully feature complete yet, it will be possible to specify what loaded libraries or binaries the functions reside within, to allow for hook function in both the main executable as well as loaded ones.

Automatically generated GUI

A GUI (using DearPyGUI) is automatically generated for the program. All mods will appear automatically as separate tabs, and widgets can be added by way of function decorators within the mod to easily create simple interfaces.

"Compound hooks"

All hooks are defined as either being run before or after the original function. This allows pyMHF to construct what we call "compound hooks" which may consist of any number of detour methods across any number of mods. This means that two mods which affect the same function may coexist (generally) peacefully.

Note: The order of execution of detours is arbitrary, so one must not expect their detour to be run before or after any other detour of the same hook.

Custom callbacks

Modding libraries can define custom callbacks which can be used to allow methods to be called whenever they are triggered. Examples include every game tick or level change for example.

Keyboard callbacks

It is possible to declare methods to be run when a certain key is pressed or released.

Reloadability

One major annoyance when testing and debugging mods at this level is the requirement to often have to reload the game to reload any mods and hooks which have been created. pyMHF has the ability to reload mods (either via the GUI, or via the injected python REPL). This will re-read the python file and reload any hooks or keyboard callbacks which are defined in it.

Mod states

While reloading mods is great, sometimes objects are instantiated once when the game starts and that is it. To avoid losing these instances across reloads, there is the concept of a ModState object which will persist across reloads. These object are bound to the mod itself so it is generally recommended to use these to store any kind of state (and in fact, can be serialized and deserialized to json as a form of saving).

Metadata

Release files for pyMHF 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyMHF 0.2.4
File Size Uploaded
pymhf-0.2.4.tar.gz 366.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyMHF 0.2.4
File Interpreter ABI Platform
pymhf-0.2.4-py3-none-any.whl Python 3 none any Details

Total release size: 621.6 kB

Release files / pymhf-0.2.4.tar.gz

Download URL pymhf-0.2.4.tar.gz
Size 366.6 kB
Tags Source
SHA-256 checksum
How to use checksums
018a81b3b754c277b68f098b72ac2da24a4fec425e2531fb65217c814e3dd62c
BLAKE2b-256 checksum
How to use checksums
963e693540610a4cd5d14a4a4e5de3ec78e248b1ed495a1234065a832d273be2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 16, 2026.

Transparency log

Release files / pymhf-0.2.4-py3-none-any.whl

Download URL pymhf-0.2.4-py3-none-any.whl
Size 255.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d522ee23d0e1d824256f9790d02b0cba8f7d2e3bd3cb9a8acb97fa1927cf9668
BLAKE2b-256 checksum
How to use checksums
959c5b1b7d3ff8ed5460bf3c5b576dd1d4a28a8f63db7ef45076536289a35ce0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 16, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.4 This release

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.16

2 release files

0.1.15

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page