Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
meithecatte opened this issue May 19, 2023 · 1 comment
Closed

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

meithecatte opened this issue May 19, 2023 · 1 comment
Assignees
Labels
Component: API Issue needs changes to the API Effort: Trivial Issue should take < 1 day Impact: Low Issue is a papercut or has a good, supported workaround Type: Enhancement Issue is a small enhancement to existing functionality
Milestone

Comments

@meithecatte
Copy link
Contributor

Version and Platform (required):

  • Binary Ninja Version: 3.4.4271, also occurs on 3.5.4286-dev (latest dev at time of writing)
  • OS: Arch Linux
  • CPU Architecture: x64

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 psifertex added the Type: Enhancement Issue is a small enhancement to existing functionality label Jun 8, 2023
@psifertex psifertex added this to the Coruscant milestone Jun 8, 2023
@psifertex psifertex added Component: API Issue needs changes to the API Impact: Low Issue is a papercut or has a good, supported workaround Effort: Trivial Issue should take < 1 day labels Jun 8, 2023
@psifertex
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: API Issue needs changes to the API Effort: Trivial Issue should take < 1 day Impact: Low Issue is a papercut or has a good, supported workaround Type: Enhancement Issue is a small enhancement to existing functionality
Projects
None yet
Development

No branches or pull requests

2 participants