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.3-py3-none-any.whl (3.7 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ghidra_stubs-12.0.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 dc92f69b5583d17a5e092fd2fef104a9627173df9d829208a50881ca164ba589
MD5 a2cb02808d91af60e31c9e3b8eec7829
BLAKE2b-256 7263445fd2d825eae468dba81dcc5e41454028da4a12441fce0d823888616e55

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