Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pact-foundation/pact-python

Python version of Pact. Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.
https://github.com/pact-foundation/pact-python

apis contract-testing hacktoberfest pact smartbear-supported

Last synced: about 1 month ago
JSON representation

Python version of Pact. Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.

Awesome Lists containing this project

README

        

# Pact Python


Fast, easy and reliable testing for your APIs and microservices.



Package

Version
Python Versions
Downloads



CI/CD

Test Status
Build Status
Build Status



Meta

Hatch project
linting - Ruff
style - Ruff
types - Mypy
License



Community

Slack
Stack Overflow
Twitter



Pact is the de-facto API contract testing tool. Replace expensive and brittle end-to-end integration tests with fast, reliable and easy to debug unit tests.


  • ⚡ Lightning fast

  • 🎈 Effortless full-stack integration testing - from the front-end to the back-end

  • 🔌 Supports HTTP/REST and event-driven systems

  • 🛠️ Configurable mock server

  • 😌 Powerful matching rules prevents brittle tests

  • 🤝 Integrates with Pact Broker / PactFlow for powerful CI/CD workflows

  • 🔡 Supports 12+ languages

Why use Pact? Contract testing with Pact lets you:


  • ⚡ Test locally

  • 🚀 Deploy faster

  • ⬇️ Reduce the lead time for change

  • 💰 Reduce the cost of API integration testing

  • 💥 Prevent breaking changes

  • 🔎 Understand your system usage

  • 📃 Document your APIs for free

  • 🗄 Remove the need for complex data fixtures

  • 🤷‍♂️ Reduce the reliance on complex test environments

Watch our series on the problems with end-to-end integrated tests, and how contract testing can help.

## Documentation

This readme provides a high-level overview of the Pact Python library. For detailed documentation, please refer to the [full Pact Python documentation](https://pact-foundation.github.io/pact-python). For a more general overview of Pact and the rest of the ecosystem, please refer to the [Pact documentation](https://docs.pact.io).

- [Installation](#installation)
- [Consumer testing](docs/consumer.md)
- [Provider testing](docs/provider.md)
- [Examples](examples/README.md)

Documentation for the API is generated from the docstrings in the code which you can view [here](https://pact-foundation.github.io/pact-python/pact). Please be aware that only the [`pact.v3` module][pact.v3] is thoroughly documented at this time.

### Need Help

- [Join](https://slack.pact.io) our community [slack workspace][Pact Foundation Slack].
- [Stack Overflow](https://stackoverflow.com/questions/tagged/pact) is a great place to ask questions.
- Say 👋 on Twitter: [@pact_up](https://twitter.com/pact_up)
- Join a discussion 💬 on [GitHub Discussions]
- [Raise an issue][GitHub Issues] on GitHub

[Pact Foundation Slack]: https://pact-foundation.slack.com/
[GitHub Discussions]: https://github.com/pact-foundation/pact-python/discussions
[GitHub Issues]: https://github.com/pact-foundation/pact-python/issues

## V3 Preview

Pact Python is currently undergoing a major rewrite which will be released with the `3.0.0` version. This rewrite will replace the existing Ruby backend with a Rust backend which will provide a significant performance improvement and will allow us to support more features in the future. You can find more information about this rewrite in [this tracking issue on GitHub](https://github.com/pact-foundation/pact-python/issues/396).

You can preview the new version by using the [`pact.v3` module][pact.v3]. The new version is not yet feature complete, and may be subject to changes. Having said that, we would love to get your feedback on the new version:

- For any issues you find, please [raise an issue][GitHub Issues] on GitHub.
- For any feedback you have, please join the discussion either on [GitHub Discussions] or in the [`#pact-python`](https://pact-foundation.slack.com/archives/C9VECUP6E) channel on the [Pact Foundation Slack].

## Installation

The latest version of Pact Python can be installed from PyPi:

```sh
pip install pact-python
# 🚀 now write some tests!
```

### Requirements

Pact Python tries to support all versions of Python that are still supported by the Python Software Foundation. Older version of Python may work, but are not officially supported.

In order to support the broadest range of use cases, Pact Python tries to impose the least restrictions on the versions of libraries that it uses.

### Do Not Track

In order to get better statistics as to who is using Pact, we have an anonymous tracking event that triggers when Pact installs for the first time. The only things we [track](https://docs.pact.io/metrics) are your type of OS, and the version information for the package being installed. No personally identifiable information is sent as part of this request. You can disable tracking by setting the environment variable `PACT_DO_NOT_TRACK=1`:

## Contributing

We welcome contributions to the Pact Python library in many forms. There are many ways to help, from writing code, to providing new examples, to writing documentation, to testing the library and providing feedback. For more information, see the [contributing guide](CONTRIBUTING.md).

[![Table of contributors](https://contrib.rocks/image?repo=pact-foundation/pact-python)](https://github.com/pact-foundation/pact-python/graphs/contributors)