{"id":19945597,"url":"https://github.com/danger/python","last_synced_at":"2025-06-20T11:07:44.884Z","repository":{"id":66079706,"uuid":"218596671","full_name":"danger/python","owner":"danger","description":"⚠️ Stop saying \"you forgot to …\" in code review","archived":false,"fork":false,"pushed_at":"2023-09-06T11:07:17.000Z","size":203,"stargazers_count":108,"open_issues_count":5,"forks_count":47,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-03T16:34:52.298Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://danger.systems/python","language":"Python","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/danger.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2019-10-30T18:33:26.000Z","updated_at":"2025-04-07T20:11:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"ecfbf2f5-66c0-4d71-a942-864b20876126","html_url":"https://github.com/danger/python","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/danger/python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danger%2Fpython","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danger%2Fpython/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danger%2Fpython/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danger%2Fpython/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danger","download_url":"https://codeload.github.com/danger/python/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danger%2Fpython/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260933426,"owners_count":23084956,"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":[],"created_at":"2024-11-13T00:26:10.188Z","updated_at":"2025-06-20T11:07:39.866Z","avatar_url":"https://github.com/danger.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![PyPI](https://img.shields.io/pypi/v/danger-python)](https://pypi.org/project/danger-python/)\n![Python versions](https://img.shields.io/pypi/pyversions/danger-python)\n[![Build Status](https://travis-ci.org/danger/python.svg?branch=master)](https://travis-ci.org/danger/python)\n\n# python\n\nWrite your Dangerfiles in Python.\n\n### Requirements\n\n:warning: `danger-python` is currently work in progress. Breaking changes may occur.\n\nRunning `danger-python` requires:\n\n* Python 3.7 (tested under Python 3.7.5)\n* danger-js 9.2 (tested under danger-js 9.2.10)\n\n### Installation\n\nIn order to test the script please run the following commands:\n\n```sh\n# install danger-js\nnpm install -g danger\n# install danger-python\npip install danger-python\n# run danger-python\ndanger-python pr https://github.com/microsoft/TypeScript/pull/34806\n```\n\n### dangerfile.py\n\nYou can choose between shorter untyped version of `dangerfile.py`:\n\n```python\ntitle = danger.github.pr.title\nmarkdown(title)\n```\n\nOr more verbose typed version:\n\n```python\nfrom danger_python import Danger, markdown\n\ndanger = Danger()\ntitle = danger.github.pr.title\nmarkdown(title)\n```\n\n### Using as GitHub Action\n\n1. Create a `dangerfile.py` in the root directory of your repository.\n2. Add a following workflow:\n\n```yaml\nname: Danger\non: [pull_request]\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n\n    steps:\n    - uses: actions/checkout@v2\n    - uses: danger/python@master\n      env:\n        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n```\n\n### Using as a CI step (Travis)\n\n1. Create a `dangerfile.py` in the root directory of your repository.\n2. Set up the CI to execute the `danger-python` script after the test suite.\n\nExample `.travis.yml` configuration:\n\n```yaml\nlanguage: python\npython:\n    - \"3.7\"\ncache:\n    yarn: true\n    pip: true\n    directories:\n        - node_modules\ninstall:\n    - pip install poetry\n    - poetry install\nscript:\n    - poetry run pytest\nafter_script:\n    - nvm install 10.16.0\n    - nvm use 10.16.0\n    - yarn global add danger\n    - pip install danger-python\n    - danger-python ci -v\n```\n\n### Development\n\nTo develop the `danger-python`, clone the repository and run the following commands:\n\n```sh\n# install danger\nnpm install -g danger\n# install poetry\npip install poetry\n# install project dependencies\npoetry install\n# activate virtual environment\npoetry shell\n# run tests\npytest\n```\n\nTo regenerate the input JSONSchema, put the latest version in `scripts/input_schema.json` and run the following commands:\n\n```sh\ncd scripts\npython generate_scheme.py\n```\n\nThis should update the `danger_python/models.py` file.\n\n:warning: Please, be careful with the generation script since the `master` branch contains the hand edits to the schema. They are all covered by the test suite, though.\n\n### Building plugins\n\nTo build a plugin, add a `danger-python` as a dependency and subclass the `DangerPlugin` class:\n\n```python\nfrom danger_python.plugins import DangerPlugin\n\nclass ExamplePlugin(DangerPlugin):\n    def hello_world(self):\n        count = len(self.danger.git.modified_files)\n        self.message(f\"ExamplePlugin says hello to {count} modified files\")\n```\n\nImporting the package in a `dangerfile.py` will import all the instance methods to the module-level globals:\n\n```python\nimport example_plugin \n\n# calls hello_world method from the plugin class\nexample_plugin.hello_world()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanger%2Fpython","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanger%2Fpython","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanger%2Fpython/lists"}