{"id":20414479,"url":"https://github.com/codecov/impact-analysis-example-python","last_synced_at":"2026-04-01T17:20:25.035Z","repository":{"id":37893100,"uuid":"447282115","full_name":"codecov/impact-analysis-example-python","owner":"codecov","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-05T22:54:37.000Z","size":78,"stargazers_count":3,"open_issues_count":0,"forks_count":6,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-27T15:24:28.873Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","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/codecov.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}},"created_at":"2022-01-12T16:02:31.000Z","updated_at":"2026-03-21T06:12:32.000Z","dependencies_parsed_at":"2024-11-13T20:25:14.649Z","dependency_job_id":"b50e9010-6f5c-425f-a0af-80ff9f1302dd","html_url":"https://github.com/codecov/impact-analysis-example-python","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codecov/impact-analysis-example-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecov%2Fimpact-analysis-example-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecov%2Fimpact-analysis-example-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecov%2Fimpact-analysis-example-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecov%2Fimpact-analysis-example-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codecov","download_url":"https://codeload.github.com/codecov/impact-analysis-example-python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecov%2Fimpact-analysis-example-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31053733,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-27T16:55:14.406Z","status":"ssl_error","status_checked_at":"2026-03-27T16:55:07.885Z","response_time":164,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2024-11-15T06:10:17.186Z","updated_at":"2026-04-01T17:20:24.996Z","avatar_url":"https://github.com/codecov.png","language":"HTML","readme":"# Python RTI Example\n\n[![codecov](https://codecov.io/gh/codecov/impact-analysis-example-python/branch/main/graph/badge.svg)](https://codecov.io/gh/codecov/impact-analysis-example-python)\n\nThis repository demonstrating how to use Codecov's [Impact Analysis](https://about.codecov.io/product/feature/impact-analysis/) feature with python. It runs with the [Flask](https://flask.palletsprojects.com/en/2.1.x/) framework and leverages the [codecov/opentelem-python](https://github.com/codecov/opentelem-python) package to send information to Codecov's Runtime Insights API.\n\nThis repository is set up to do to be used as\n1. a working sandbox to explore Impact Analysis\n1. a reference for adding Impact Analysis to your own repositories\n\n## Getting Started\n\nThe following section details how to get started with Impact Analysis. Before getting started, you will need\n1. `python` version 3+\n2. An account on [Codecov](https://about.codecov.com)\n\n\u003cbr /\u003e\n\n**Step 1: Fork and clone this repository**\n-------------\n\n[Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo#forking-a-repository) this repository from GitHub. It is strongly recommended that you fork the repository to your personal GitHub account.\nClone your new repository to your local machine.\n\n\u003cbr /\u003e\n\n**Step 2: Set the `profiling token`**\n-------------\n\nGo to [Codecov](https://app.codecov.io/gh) and find the fork in the list of repositories. Note that it may be under `Not yet setup` in the right-hand section.\n\nIn the `settings` page, grab the `Impact analysis token`, and set the token locally in a terminal.\n```\nexport CODECOV_OPENTELEMETRY_TOKEN='***'\n```\n\n\u003cbr /\u003e\n\n**Step 3: Install the dependencies**\n-------------\n\nInstall all dependencies for this project. It is highly recommended to do this in a virtual environment.\n```\npip install -r requirements.txt\n```\n\n\u003cbr /\u003e\n\n**Step 4: Run the server locally and generate profiling data**\n-------------\n\nRun the server from your machine using the command\n```\npython example-app/app.py\n```\nIf the token has been set properly, you should see the server running with the following logs\n```\n * Serving Flask app 'app' (lazy loading)\n * Environment: production\n   WARNING: This is a development server. Do not use it in a production deployment.\n   Use a production WSGI server instead.\n * Debug mode: off\n * Running on all addresses (0.0.0.0)\n   WARNING: This is a development server. Do not use it in a production deployment.\n * Running on http://127.0.0.1:8080\n * Running on http://192.168.1.184:8080 (Press CTRL+C to quit)\n```\n\nYou can view the app by going to `http://127.0.0.1:8080`.\nThe app has two pages, the main page that has a button to `Get the time`, while the other page displays the time.\n\n\u003cbr /\u003e\n\n**Step 5: Overloading the `/time` endpoint**\n-------------\n\nIn order for us to see what happens when we change a critical (frequently hit) line, we will need to hit the `/time` endpoint. In a python shell, run the following with the server running\n```\nimport requests\nimport time\n\nfor i in range(100):\n    print(i)\n    requests.get('http://127.0.0.1:8080/time')\n    time.sleep(0.1)\n```\nThis should hit our `/time` endpoint 100 times and upload the telemetry data to Codecov.\n\n\u003cbr /\u003e\n\n**Step 6: Making a change to critical code**\n-------------\n\nLet's now make a change in our code to see if what we are changing is critical.\n\nIn `example-app/utils/time.py`, update line 4 from\n```\n    return datetime.strftime(time, '%Y-%m-%d %H:%M:%S')\n```\nto\n```\n    return datetime.strftime(time, '%Y-%m-%d:%H:%M:%S')\n```\n\n\nYou will also need to update the tests. Change line 7 of `example-app/utils/tests/test_time.py`\n```\n    assert(format_time(current_time) == datetime.strftime(current_time, '%Y-%m-%d %H:%M:%S'))\n```\nto\n```\n    assert(format_time(current_time) == datetime.strftime(current_time, '%Y-%m-%d:%H:%M:%S'))\n```\n\nSave the changes, create a new branch, and push to GitHub.\n```\ngit checkout -b 'test-codecov'\ngit add example-app/\ngit commit -m 'fix: update time display with colon'\ngit push origin test-codecov\n```\nOpen a new pull request. Be sure to set the base branch to your fork.\n\n\u003cbr /\u003e\n\n**Step 7: Seeing Impact Analysis in the UI**\n-------------\n\nAfter CI/CD has completed, you should see a comment from Codecov similar to this [PR](https://github.com/codecov/impact-analysis-example-python/pull/14). The comment will now show 2 new elements\n\n1. Under `impacted files`, you should see a `Critical` label next to `example-app/utils/time.py`. This means that the PR has a change in that file that is frequently hit in production.\n2. Under `related entrypoints`, you should see `/time`. This means that the PR has a change that touches that endpoint.\n\nYou should now be able to see how Impact Analysis can give crucial information on how a code change can affect critical code in your system.\n\n### Using your own repositories\nTo get started with Impact Analysis on your own repositories, check out our getting started [guide](https://docs.codecov.com/docs/impact-analysis-python).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodecov%2Fimpact-analysis-example-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodecov%2Fimpact-analysis-example-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodecov%2Fimpact-analysis-example-python/lists"}