Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ghidra_stubs-12.0.2-py3-none-any.whl (3.7 MB view details)

Uploaded Python 3

File details

Details for the file ghidra_stubs-12.0.2-py3-none-any.whl.

File metadata

  • Download URL: ghidra_stubs-12.0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for ghidra_stubs-12.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cd983ff7bbe57e9a39b789d8558ee61f389028cc4b7643199b3b3b9bb5ddab62
MD5 b57563c031845f62bba4e361cf6fc9b8
BLAKE2b-256 7d801ba41c114b79138f8547b388b766c0ec03dc2a3adc69cd92be7ec3515b17

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page