{"id":22772303,"url":"https://github.com/pactflow/example-provider-python","last_synced_at":"2025-06-15T20:38:00.585Z","repository":{"id":42519556,"uuid":"295269593","full_name":"pactflow/example-provider-python","owner":"pactflow","description":"FastAPI example provider in Python","archived":false,"fork":false,"pushed_at":"2025-06-11T08:11:45.000Z","size":72,"stargazers_count":7,"open_issues_count":3,"forks_count":6,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-06-11T08:25:57.666Z","etag":null,"topics":["example"],"latest_commit_sha":null,"homepage":null,"language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pactflow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-09-14T01:10:20.000Z","updated_at":"2025-06-11T07:09:35.000Z","dependencies_parsed_at":"2025-02-14T02:33:25.554Z","dependency_job_id":"a613bebd-7774-427d-8c82-4c151f3c8e1e","html_url":"https://github.com/pactflow/example-provider-python","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pactflow/example-provider-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pactflow%2Fexample-provider-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pactflow%2Fexample-provider-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pactflow%2Fexample-provider-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pactflow%2Fexample-provider-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pactflow","download_url":"https://codeload.github.com/pactflow/example-provider-python/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pactflow%2Fexample-provider-python/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260046268,"owners_count":22950828,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["example"],"created_at":"2024-12-11T17:08:02.126Z","updated_at":"2025-06-15T20:38:00.543Z","avatar_url":"https://github.com/pactflow.png","language":"Makefile","readme":"# Example Provider\n\n![Build](https://github.com/pactflow/example-provider-python/workflows/Build/badge.svg)\n\n[![Can I deploy Status](https://test.pactflow.io/pacticipants/pactflow-example-provider-python/branches/master/latest-version/can-i-deploy/to-environment/production/badge.svg)](https://test.pactflow.io/overview/provider/pactflow-example-consumer-python/consumer/pactflow-example-consumer-python)\n\n[![Pact Status](https://test.pactflow.io/pacts/provider/pactflow-example-provider-python/consumer/pactflow-example-consumer-python/latest/badge.svg)](https://test.pactflow.io/pacts/provider/pactflow-example-provider-python/consumer/pactflow-example-consumer-python/latest) (latest pact)\n\n[![Pact Status](https://test.pactflow.io/pacts/provider/pactflow-example-provider-python/consumer/pactflow-example-consumer-python/latest/master/badge.svg)](https://test.pactflow.io/pacts/provider/pactflow-example-provider-python/consumer/pactflow-example-consumer-python/latest/master) (master/master pact) \n\nThis is an example of a Python FastAPI provider that uses Pact, [PactFlow](https://pactflow.io) and GitHub Actions to ensure that it is compatible with the expectations its consumers have of it.\n\nThe project uses a Makefile to simulate a very simple build pipeline with two stages - test and deploy.\n\nIt is using a public tenant on PactFlow, which you can access [here](https://test.pactflow.io) using the credentials `dXfltyFMgNOFZAxr8io9wJ37iUpY42M`/`O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1`. The latest version of the Example Consumer/Example Provider pact is published [here](https://test.pactflow.io/pacts/provider/pactflow-example-provider-python/consumer/pactflow-example-consumer-python/latest).\n\n## Pact verifications\n\nWhen using Pact in a CI/CD pipeline, there are two reasons for a pact verification task to take place:\n\n   * When the provider changes (to make sure it does not break any existing consumer expectations)\n   * When a pact changes (to see if the provider is compatible with the new expectations)\n\nWhen the provider changes, the pact verification task runs as part the provider's normal build pipeline, generally after the unit tests, and before any deployment takes place. This pact verification task is configured to dynamically fetch all the relevant pacts for the specified provider from PactFlow, verify them, and publish the results back to PactFlow.\n\nTo ensure that a verification is also run whenever a pact changes, we create a webhook in PactFlow that triggers a provider build, and passes in the URL of the changed pact. Ideally, this would be a completely separate build from your normal provider pipeline, and it should just verify the changed pact.\n\nBecause GitHub Actions only allows us to have one build configuration per repository, we switch between the main pipeline mode and the webhook-triggered mode based on the presence of an environment variable that is only set via the webhook. Keep in mind that this is just a constraint of the tools we're using for this example, and is not necessarily the way you would implement Pact your own pipeline.\n\n## Usage\n\nSee the [PactFlow CI/CD Workshop](https://github.com/pactflow/ci-cd-workshop) for background.\n\nTo run the tests locally, run:\n\n```\nmake test\n```\n\nTo run the \"fake ci\" task:\n```\nexport PACT_BROKER_BASE_URL=https://test.pactflow.io\nexport PACT_BROKER_USERNAME=dXfltyFMgNOFZAxr8io9wJ37iUpY42M\nexport PACT_BROKER_PASSWORD=O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1\nmake fake_ci\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpactflow%2Fexample-provider-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpactflow%2Fexample-provider-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpactflow%2Fexample-provider-python/lists"}