Skip to content

Latest commit

 

History

105 Commits

Folders and files

Repository files navigation

python

Write your Dangerfiles in Python.

Requirements

Running danger-python requires:

  • Python 3.7 (tested under Python 3.7.5)
  • danger-js 9.2 (tested under danger-js 9.2.10)

Installation

⚠️ The script is currently work in progress. Installation requires:

  • Poetry 1.0.2

In order to test the script please run the following commands:

# install danger
npm install -g danger
# install poetry
pip install poetry
# install project dependencies
poetry install --no-dev
# activate virtual environment
poetry shell
# run danger-python
danger-python pr https://github.com/microsoft/TypeScript/pull/34806

dangerfile.py

You can choose between shorter untyped version of dangerfile.py:

title = danger.github.pr.title
markdown(title)

Or more verbose typed version:

from danger_python import Danger, markdown

danger = Danger()
title = danger.github.pr.title
markdown(title)

Development

To develop the code, clone the repository and run the following commands:

# install danger
npm install -g danger
# install poetry
pip install poetry
# install project dependencies
poetry install
# activate virtual environment
poetry shell
# run tests
pytest

To regenerate the input JSONSchema, put the latest version in scripts/input_schema.json and run the following commands:

cd scripts
python generate_scheme.py

This should update the danger_python/models.py file.

TODOs

  • Parse complete Danger DSL
  • Plugin infrastructure
  • Release the initial version of the package

About

⚠️ Stop saying "you forgot to …" in code review

Resources

Stars

117 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages