Ghidra Type Stubs
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file ghidra_stubs-11.4-py3-none-any.whl
.
File metadata
- Download URL: ghidra_stubs-11.4-py3-none-any.whl
- Upload date:
- Size: 3.1 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
9612e74724e186e64d6cdc00690a6fc6361b383ade41f3332e5877352a374f6f
|
|
MD5 |
5b7fb1dff91cf8c5536848cf99689672
|
|
BLAKE2b-256 |
85fa7f86b6ecf19af7be3ddc51b275deba9a34076dd5db0aa68b22ec507557aa
|