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

FFI Wrapper #403

Merged
merged 1 commit into from Oct 12, 2023
Merged

FFI Wrapper #403

merged 1 commit into from Oct 12, 2023

Conversation

JP-Ellis
Copy link
Contributor

@JP-Ellis JP-Ellis commented Oct 2, 2023

📝 Summary

Implement a pact.v3.ffi module which exposes functions to cover all of the functions exposed by the Pact library.

Due to the number of functions, most of these are simply:

def foo(...):
    """
    {description from pact.h}
    """
    raise NotImplementedError

and they will be filled in as the implementation proceeds.

Most of the code in this PR was automatically created, and then modified slightly to ensure conformance with Ruff's lints.

🚨 Breaking Changes

🔨 Test Plan

As the rest of the pact.v3 module gets populated, more of these functions will get tested. At this stage, only version is defined and tested.

All tests for the new pact.v3 modules will be stored under the corresponding tests/v3/ directory.

🔗 Related issues/PRs

@JP-Ellis JP-Ellis requested a review from YOU54F October 2, 2023 04:52
@JP-Ellis JP-Ellis self-assigned this Oct 2, 2023
pact/v3/ffi.py Show resolved Hide resolved
@YOU54F
Copy link
Member

YOU54F commented Oct 5, 2023

Hey had a quick look at this, should this have master merged into it now? or master merged into the ffi-groundwork PR? Would make it a bit easier to review in a ui diff I think.

@JP-Ellis
Copy link
Contributor Author

JP-Ellis commented Oct 5, 2023

Yeah sorry for the review being difficult. It's built on top of the FFI groundwork, hence why it has a lot of extra commits. Only the last commit, 0afc711, is new.

@YOU54F
Copy link
Member

YOU54F commented Oct 5, 2023

no need to apologise, wasn't sure if it was because of some git merge mastery that you have lined up.

i ended up merging master in locally in the previous #395 as I wanted to run the examples, after running and checking the PR as it was

@JP-Ellis JP-Ellis changed the base branch from master to feat/initial-ffi October 6, 2023 04:28
@JP-Ellis
Copy link
Contributor Author

JP-Ellis commented Oct 6, 2023

I have rebased this PR on top of the feat/initial-ffi branch (as it was itself rebased). I've also adjusted to target branch for this PR to be the latter to help single out the changes include here.

Copy link
Member

@YOU54F YOU54F left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good stuff!

Base automatically changed from feat/initial-ffi to master October 12, 2023 21:39
Import close to 400 functions exposed by the Rust library into the
`ffi.py` file. All of them (save `version`) solely raise a
`NotImplementedError`. The documentation of the functions has been
automatically imported from the exposed docstring by the `pact.h`
header.

Some more minor changes includes:

- Adding the `py.typed` marker file (see [PEP
  561](https://peps.python.org/pep-0561/))
- Move all tests relating to `v3` into `tests/v3`
- Minor fixes toe the `ruff.toml` lint rules for tests
- Update type dependencies

Signed-off-by: JP-Ellis <josh@jpellis.me>
@JP-Ellis
Copy link
Contributor Author

Rebased on top of master to ensure it can merge. Only failing tests are related to the recent release of Python 3.12.

@JP-Ellis JP-Ellis merged commit 257e321 into master Oct 12, 2023
19 of 30 checks passed
@JP-Ellis JP-Ellis deleted the feat/ffi-wrapper branch October 12, 2023 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Completed
Development

Successfully merging this pull request may close these issues.

Implement a thin wrapper for all the FFI functions in the core library
2 participants