# Pact Python FFI
> [!NOTE]
>
> This package provides direct access to the Pact Foreign Function Interface (FFI) with minimal abstraction. It is intended for advanced users who need low-level control over Pact operations in Python.
---
This sub-package is part of the [Pact Python](https://github.com/pact-foundation/pact-python) project and exists to expose the [Pact FFI](https://github.com/pact-foundation/pact-reference) directly to Python. If you are looking for the main Pact Python library for contract testing, please see the [root package](https://github.com/pact-foundation/pact-python#pact-python).
## Overview
- The module provides a thin Python wrapper around the Pact FFI (C API).
- Most classes correspond directly to structs from the FFI, and are designed to wrap the underlying C pointers.
- Many classes implement the `__del__` method to ensure memory allocated by the Rust library is freed when the Python object is destroyed, preventing memory leaks.
- Functions from the FFI are exposed directly: if a function `foo` exists in the FFI, it is accessible as `pact_ffi.foo(...)`.
- The API is not guaranteed to be stable and is intended for use by advanced users or for building higher-level libraries. For typical contract testing, use the main Pact Python client library.
## Installation
You can install this package via pip:
```console
pip install pact-python-ffi
```
## Usage
This package exposes the raw FFI bindings for Pact. It is suitable for advanced use cases, custom integrations, or for building higher-level libraries. For typical contract testing, prefer using the main Pact Python library.
## Contributing
As this is a relatively thin wrapper around the Pact FFI, the code is unlikely to change frequently; however, contributions to improve the coverage of the FFI bindings or to improve existing functionality are welcome. See the [main contributing guide](https://github.com/pact-foundation/pact-python/blob/main/CONTRIBUTING.md) for details.
To release a new version of `pact-python-ffi`, simply push a tag in the format `pact-python-ffi/x.y.z.w`. This will automatically trigger a release process, pulling in version `x.y.z` of the underlying Pact FFI. Before creating and pushing such a tag, please ensure that the Python wrapper has been updated to reflect any changes or updates in the corresponding FFI version.
Higher-level abstractions or utilities should be implemented in separate libraries (such as [`pact-python`](https://github.com/pact-foundation/pact-python)).
---
For questions or support, please visit the [Pact Foundation Slack](https://slack.pact.io) or [GitHub Discussions](https://github.com/pact-foundation/pact-python/discussions)
---
Raw data
{
"_id": null,
"home_page": null,
"name": "pact-python-ffi",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "Joshua Ellis <josh@jpellis.me>",
"keywords": "contract-testing, ffi, pact, pact-python",
"author": null,
"author_email": "Joshua Ellis <josh@jpellis.me>",
"download_url": "https://files.pythonhosted.org/packages/54/82/94c487a7def1095850a9a119038aacc3de7b92c31973ea13d5f4d05304b2/pact_python_ffi-0.4.22.0.tar.gz",
"platform": null,
"description": "# Pact Python FFI\n\n> [!NOTE]\n>\n> This package provides direct access to the Pact Foreign Function Interface (FFI) with minimal abstraction. It is intended for advanced users who need low-level control over Pact operations in Python.\n\n---\n\nThis sub-package is part of the [Pact Python](https://github.com/pact-foundation/pact-python) project and exists to expose the [Pact FFI](https://github.com/pact-foundation/pact-reference) directly to Python. If you are looking for the main Pact Python library for contract testing, please see the [root package](https://github.com/pact-foundation/pact-python#pact-python).\n\n## Overview\n\n- The module provides a thin Python wrapper around the Pact FFI (C API).\n- Most classes correspond directly to structs from the FFI, and are designed to wrap the underlying C pointers.\n- Many classes implement the `__del__` method to ensure memory allocated by the Rust library is freed when the Python object is destroyed, preventing memory leaks.\n- Functions from the FFI are exposed directly: if a function `foo` exists in the FFI, it is accessible as `pact_ffi.foo(...)`.\n- The API is not guaranteed to be stable and is intended for use by advanced users or for building higher-level libraries. For typical contract testing, use the main Pact Python client library.\n\n## Installation\n\nYou can install this package via pip:\n\n```console\npip install pact-python-ffi\n```\n\n## Usage\n\nThis package exposes the raw FFI bindings for Pact. It is suitable for advanced use cases, custom integrations, or for building higher-level libraries. For typical contract testing, prefer using the main Pact Python library.\n\n## Contributing\n\nAs this is a relatively thin wrapper around the Pact FFI, the code is unlikely to change frequently; however, contributions to improve the coverage of the FFI bindings or to improve existing functionality are welcome. See the [main contributing guide](https://github.com/pact-foundation/pact-python/blob/main/CONTRIBUTING.md) for details.\n\nTo release a new version of `pact-python-ffi`, simply push a tag in the format `pact-python-ffi/x.y.z.w`. This will automatically trigger a release process, pulling in version `x.y.z` of the underlying Pact FFI. Before creating and pushing such a tag, please ensure that the Python wrapper has been updated to reflect any changes or updates in the corresponding FFI version.\n\nHigher-level abstractions or utilities should be implemented in separate libraries (such as [`pact-python`](https://github.com/pact-foundation/pact-python)).\n\n---\n\nFor questions or support, please visit the [Pact Foundation Slack](https://slack.pact.io) or [GitHub Discussions](https://github.com/pact-foundation/pact-python/discussions)\n\n---\n",
"bugtrack_url": null,
"license": null,
"summary": "Python bindings for the Pact FFI library",
"version": "0.4.22.0",
"project_urls": {
"Bug Tracker": "https://github.com/pact-foundation/pact-python/issues",
"Changelog": "https://github.com/pact-foundation/pact-python/blob/main/pact-python-ffi/CHANGELOG.md",
"Documentation": "https://docs.pact.io",
"Homepage": "https://pact.io",
"Repository": "https://github.com/pact-foundation/pact-python"
},
"split_keywords": [
"contract-testing",
" ffi",
" pact",
" pact-python"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "a927666c00f5c5c3a9a03912ad95e5f497ff8392babc546af48bbdbfbaf1035a",
"md5": "8cc367158082b1f1d06eb83558a96441",
"sha256": "09c25934a22675935739d0a67dc8a9fc3527ef40001232a287d522cb164fc201"
},
"downloads": -1,
"filename": "pact_python_ffi-0.4.22.0-cp39-abi3-macosx_12_0_arm64.whl",
"has_sig": false,
"md5_digest": "8cc367158082b1f1d06eb83558a96441",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 11520048,
"upload_time": "2025-07-29T10:29:23",
"upload_time_iso_8601": "2025-07-29T10:29:23.478999Z",
"url": "https://files.pythonhosted.org/packages/a9/27/666c00f5c5c3a9a03912ad95e5f497ff8392babc546af48bbdbfbaf1035a/pact_python_ffi-0.4.22.0-cp39-abi3-macosx_12_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "32d18d2c0a53e1f77d7afcbc582d6e03530bef91fb1ab41033ad18ac652352af",
"md5": "561ec7eddcb83e55ec41ef9b9c2f26f8",
"sha256": "80c9698e6a5d35f46f5d009a9eb6ce961e5c38a35397fd29b0a84f3211d9b2da"
},
"downloads": -1,
"filename": "pact_python_ffi-0.4.22.0-cp39-abi3-macosx_12_0_x86_64.whl",
"has_sig": false,
"md5_digest": "561ec7eddcb83e55ec41ef9b9c2f26f8",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 11901965,
"upload_time": "2025-07-29T10:29:25",
"upload_time_iso_8601": "2025-07-29T10:29:25.721379Z",
"url": "https://files.pythonhosted.org/packages/32/d1/8d2c0a53e1f77d7afcbc582d6e03530bef91fb1ab41033ad18ac652352af/pact_python_ffi-0.4.22.0-cp39-abi3-macosx_12_0_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "7b9ee24e033336f93ba9a20ddf6b262c15b95a3cb95dc8aca6177230f35ecc06",
"md5": "1bb00e214b6f3b77249265591ac95b30",
"sha256": "a409886065bc7144ddb31f078bc9b2515973565e77e4d52c35de1b6dae5a1d2b"
},
"downloads": -1,
"filename": "pact_python_ffi-0.4.22.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl",
"has_sig": false,
"md5_digest": "1bb00e214b6f3b77249265591ac95b30",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 12998451,
"upload_time": "2025-07-29T10:29:28",
"upload_time_iso_8601": "2025-07-29T10:29:28.101364Z",
"url": "https://files.pythonhosted.org/packages/7b/9e/e24e033336f93ba9a20ddf6b262c15b95a3cb95dc8aca6177230f35ecc06/pact_python_ffi-0.4.22.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "33f55f5acee3525d334af4ab09e2231fff4db1103e187ef265c9056083c46ee8",
"md5": "2a835c7f4979992f348cd9374f85afc0",
"sha256": "14841475a3d059d4f8c20c4d4e5e318988dca31d65160a6e361a6e2c6b6e05f4"
},
"downloads": -1,
"filename": "pact_python_ffi-0.4.22.0-cp39-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl",
"has_sig": false,
"md5_digest": "2a835c7f4979992f348cd9374f85afc0",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 13732487,
"upload_time": "2025-07-29T10:29:30",
"upload_time_iso_8601": "2025-07-29T10:29:30.051078Z",
"url": "https://files.pythonhosted.org/packages/33/f5/5f5acee3525d334af4ab09e2231fff4db1103e187ef265c9056083c46ee8/pact_python_ffi-0.4.22.0-cp39-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "c22a43025813bb8ebb789db416b59ed4e5dee99cc63c0e2614c480534e8a7abf",
"md5": "b60597e861f837ea907012f5413718f2",
"sha256": "31396871b0cf544fe69591f8b724e8691cfaf31cba38dfd94903d4e0dbcf7300"
},
"downloads": -1,
"filename": "pact_python_ffi-0.4.22.0-cp39-abi3-musllinux_1_2_aarch64.whl",
"has_sig": false,
"md5_digest": "b60597e861f837ea907012f5413718f2",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 38786689,
"upload_time": "2025-07-29T10:29:32",
"upload_time_iso_8601": "2025-07-29T10:29:32.312642Z",
"url": "https://files.pythonhosted.org/packages/c2/2a/43025813bb8ebb789db416b59ed4e5dee99cc63c0e2614c480534e8a7abf/pact_python_ffi-0.4.22.0-cp39-abi3-musllinux_1_2_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "4a714f6b643a9283b2d170c83834779c9e917106ec75ae554a6118e025e0c742",
"md5": "eaaf7b36cb26ba2b2a5259a874c1fabf",
"sha256": "714d24a72d8533cc1760d8061ff993c6de7364d7aaa0a31b2a7aa5c2790bd753"
},
"downloads": -1,
"filename": "pact_python_ffi-0.4.22.0-cp39-abi3-musllinux_1_2_x86_64.whl",
"has_sig": false,
"md5_digest": "eaaf7b36cb26ba2b2a5259a874c1fabf",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 34973959,
"upload_time": "2025-07-29T10:29:35",
"upload_time_iso_8601": "2025-07-29T10:29:35.299465Z",
"url": "https://files.pythonhosted.org/packages/4a/71/4f6b643a9283b2d170c83834779c9e917106ec75ae554a6118e025e0c742/pact_python_ffi-0.4.22.0-cp39-abi3-musllinux_1_2_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "7903ddb08ce009f5e328b4a40389c858748240e7d47cdbd6fa78ce5db0c1d954",
"md5": "6bcfab3836d3d35055d6cc85af3d9d8a",
"sha256": "c4d595a72b1f39793fd454f19a8e210f9c8c1152bcc62b4dc0177ab4895d3e6a"
},
"downloads": -1,
"filename": "pact_python_ffi-0.4.22.0-cp39-abi3-win_amd64.whl",
"has_sig": false,
"md5_digest": "6bcfab3836d3d35055d6cc85af3d9d8a",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 12148598,
"upload_time": "2025-07-29T10:29:37",
"upload_time_iso_8601": "2025-07-29T10:29:37.815064Z",
"url": "https://files.pythonhosted.org/packages/79/03/ddb08ce009f5e328b4a40389c858748240e7d47cdbd6fa78ce5db0c1d954/pact_python_ffi-0.4.22.0-cp39-abi3-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "917658f5746f94f8d320d872d54a622ed13e4b46aeacfe5cda467bea11f3ebbe",
"md5": "af2f567907d916882835ed3c4c40aef4",
"sha256": "f66d69fe760ec75b26e59f7c6c54ce14f859818a5bd726c2cd57b09e986a8c67"
},
"downloads": -1,
"filename": "pact_python_ffi-0.4.22.0-cp39-abi3-win_arm64.whl",
"has_sig": false,
"md5_digest": "af2f567907d916882835ed3c4c40aef4",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 11535916,
"upload_time": "2025-07-29T10:29:39",
"upload_time_iso_8601": "2025-07-29T10:29:39.981071Z",
"url": "https://files.pythonhosted.org/packages/91/76/58f5746f94f8d320d872d54a622ed13e4b46aeacfe5cda467bea11f3ebbe/pact_python_ffi-0.4.22.0-cp39-abi3-win_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "548294c487a7def1095850a9a119038aacc3de7b92c31973ea13d5f4d05304b2",
"md5": "20468e943aecc8c689892d49aadd6add",
"sha256": "770992290f406059824e7859f4b1a21d74195e0ac843fcadde7b58c43518ead4"
},
"downloads": -1,
"filename": "pact_python_ffi-0.4.22.0.tar.gz",
"has_sig": false,
"md5_digest": "20468e943aecc8c689892d49aadd6add",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 44847,
"upload_time": "2025-07-29T10:29:41",
"upload_time_iso_8601": "2025-07-29T10:29:41.661472Z",
"url": "https://files.pythonhosted.org/packages/54/82/94c487a7def1095850a9a119038aacc3de7b92c31973ea13d5f4d05304b2/pact_python_ffi-0.4.22.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-29 10:29:41",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pact-foundation",
"github_project": "pact-python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pact-python-ffi"
}