Ghidra Type Stubs
The Ghidra Type Stubs library is a PEP 561 stubs package for the Ghidra API. The stub files can be used to improve your development experience in supported editors like PyCharm and Visual Studio Code.
Installation
The stubs can be installed with pip install ghidra-stubs*.whl into the environment in which the
real Ghidra module (i.e., pyghidra) is available. Any conformant tool will then use the stubs
package for type analysis purposes.
Usage
Once installed, all you need to do is import the Ghidra modules as usual, and your supported editor will do the rest.
import pyghidra
To get support for the Ghidra builtins, you need to import them as well. The type hints for those
exist in the generated ghidra_builtins stub. Since it is not a real Python module, importing it at
runtime will fail.
try:
from ghidra.ghidra_builtins import *
except:
pass
If you are using PyGhidra from a Python 3 environment where no
real ghidra module exists you can use a snippet like the following:
import typing
if typing.TYPE_CHECKING:
from ghidra.ghidra_builtins import *
# actual code follows here
typing.TYPE_CHECKING is a special value that is always False at runtime but True during any
kind of type checking or completion.
Once done, just code & enjoy.
Metadata
Release files for ghidra-stubs 12.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ghidra_stubs-12.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Release files / ghidra_stubs-12.1.4-py3-none-any.whl
| Download URL | ghidra_stubs-12.1.4-py3-none-any.whl |
|---|---|
| Size | 3.7 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3d430b07b17250faba50d53b13c382c325b5399095cc2bdf57f6d65ffa7da71d
|
|
BLAKE2b-256 checksum How to use checksums |
613f7d72e4ff099fba38cc22e13ade8abf676edc3550225bd2c048767aba3edb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|