Vector35 / binaryninja-api

Public API, examples, documentation and issues for Binary Ninja
https://binary.ninja/
MIT License
899 stars 203 forks source link

Shipped API files don't include python/binaryninja/py.typed #4318

Closed meithecatte closed 1 year ago

meithecatte commented 1 year ago

Version and Platform (required):

Bug Description: Using the type annotations requires manually creating an empty file at python/binaryninja/py.typed, despite the fact that this repo includes such a file.

Steps To Reproduce:

  1. Run scripts/install_api.py
  2. cd ~/tmp && echo 'import binaryninja' > meow.py && mypy meow.py
  3. Observe the following error:
    meow.py:1: error: Skipping analyzing "binaryninja": module is installed, but missing library stubs or py.typed marker  [import]
    meow.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
    Found 1 error in 1 file (checked 1 source file)
  4. Create an empty file at python/binaryninja/py.typed within the binaryninja installation
  5. Run mypy meow.py and observe it now works.

Expected Behavior: mypy works out of the box, with py.typed shipped with the rest of Binary Ninja.

Additional Information: See also: #2747.

While I can't find it now, I seem to recall seeing an issue where the problem was that empty py.typed files get stripped by the build process, which is why there's now a dummy comment in them. Nonetheless, this doesn't seem to be helping, as they are still not included.

psifertex commented 1 year ago

Good catch, I've modified the cmake config so that should be included in future builds, not just in the repo.