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

Add FFI type hinting #436

Merged
merged 2 commits into from
Oct 26, 2023
Merged

Add FFI type hinting #436

merged 2 commits into from
Oct 26, 2023

Commits on Oct 26, 2023

  1. chore(pre-commit): add mypy

    This commit adds mypy to the pre-commit hooks. This is executed through
    `hatch` as mypy needs to be able to find and parse dependencies in
    hatch's virtual environment.
    
    Signed-off-by: JP-Ellis <[email protected]>
    JP-Ellis committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    f8c76a6 View commit details
    Browse the repository at this point in the history
  2. chore(ffi): add typing

    The C extension module `_ffi` is now minimally typed with `pyi` files.
    It provides typing for the `ffi` class which holds a number of utility
    functions such as `ffi.string`, `ffi.cast`, `ffi.new`, etc.
    
    The `lib` class is also annotated within the `pyi` file, but this merely
    means that the type checking does not complain about calls to
    `lib.pactffi_*` functions.
    
    As part of this commit, the `StringResult` has been refactored to ensure
    that it works better with the type checker.
    
    Signed-off-by: JP-Ellis <[email protected]>
    JP-Ellis committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    589204a View commit details
    Browse the repository at this point in the history