Share
Embed
Transcript
75 slides
-
Python Core Developer Platform Engineer @mariatta mariatta.ca #IceCreamSelfie WHO AM
I? Mariatta Wijaya ! DjangoCon US 2018 @mariatta https://zapier.com/jobs/ -
Problem: We’re outnumbered Source: Stephane Wirtel, CPython loves your pull
request https://speakerdeck.com/matrixise/ python-loves-your-contributions DjangoCon US 2018 @mariatta -
Problem: Complicated Workflow Bug or feature? CLA signed? Tests passed?
Needs an issue? Needs news entry? News entry added? Needs backport? How? Who? When? First time contributor? Commit message? DjangoCon US 2018 @mariatta -
Problem: Complicated Workflow Bug or feature? CLA signed? Tests passed?
Needs an issue? Needs news entry? News entry added? Needs backport? How? Who? When? First time contributor? Commit message? DjangoCon US 2018 @mariatta -
Problem: Complicated Workflow Bug or feature? CLA signed? Tests passed?
Needs an issue? Needs news entry? News entry added? Needs backport? How? Who? When? First time contributor? Commit message? DjangoCon US 2018 @mariatta -
Backport? Applying changes from newer version to older version DjangoCon
US 2018 @mariatta -
• master (3.8.0a1, due January 2019) • 3.7 (3.7.1, due
October 2018) • 3.6 (3.6.7, due October 2018) • 2.7 (EOL, January 2020) Current maintained versions DjangoCon US 2018 @mariatta -
SCENARIO: BUG IN 3.6 Bug in f-strings 3.6 DjangoCon US
2018 @mariatta -
SCENARIO: BUG IN 3.6 Bug in f-strings 3.6 3.6 DjangoCon
US 2018 @mariatta -
SCENARIO: BUG IN 3.6 3.6 Bug in f-strings 3.6 DjangoCon
US 2018 @mariatta -
SCENARIO: BUG IN 3.6 Bug in f-strings 3.6 3.7 3.8
DjangoCon US 2018 @mariatta -
SCENARIO: BUG IN 3.6 Bug in f-strings 3.8 3.6 3.7
3.8 DjangoCon US 2018 @mariatta -
SCENARIO: BUG IN 3.6 Bug in f-strings 3.8 3.6 3.7
3.8 DjangoCon US 2018 @mariatta -
SCENARIO: BUG IN 3.6 Bug in f-strings 3.8 3.6 3.7
3.8 3.6 3.7 DjangoCon US 2018 @mariatta -
SCENARIO: BUG IN 3.6 Bug in f-strings 3.8 3.6 3.7
3.8 3.6 3.7 DjangoCon US 2018 @mariatta -
CHERRY-PICKING $ git fetch upstream $ git checkout -b backport-3384d38d-3.7
upstream/3.7 $ git cherry-pick -x 3384d38d51a2c3450e742175db5d6d638fa5d2eb $ git push origin backport-3384d38d-3.7 $ git checkout master $ git branch -D backport-3384d38d-3.7 $ git checkout -b backport-3384d38d-3.6 upstream/3.6 $ git cherry-pick -x 3384d38d51a2c3450e742175db5d6d638fa5d2eb $ git push origin backport-3384d38d-3.6 $ git checkout master $ git branch -D backport-3384d38d-3.6 3.7 3.6 DjangoCon US 2018 @mariatta -
CHERRY_PICKER.PY $ pip install cherry_picker $ cherry_picker 3384d38d51a2c3450e742175db5d6d638fa5d2eb 3.7 3.6
DjangoCon US 2018 @mariatta -
GITHUB WEBHOOKS Pull request (opened, closed, labeled) Status (pending, success,
failure) Pull request review (submitted, dismissed) … Events GitHub Webservice Docs: https://developer.github.com/webhooks DjangoCon US 2018 @mariatta -
GITHUB APIS Create a pull request Merge a pull request
Comment on a pull request Apply labels to pull request … APIs Webservice GitHub Docs: https://developer.github.com/v3 DjangoCon US 2018 @mariatta -
PR merged event (webhook) Open pull request (REST API) Run
cherry_picker.py DjangoCon US 2018 @mariatta -
PR merged event (webhook) Open pull request (REST API) Run
cherry_picker.py Clone CPython repo DjangoCon US 2018 @mariatta -
PR merged event (webhook) Open pull request (REST API) Run
cherry_picker.py Clone CPython repo 2 minutes 12-15 seconds DjangoCon US 2018 @mariatta -
PR merged event (webhook) Open pull request (REST API) Run
cherry_picker.py Clone CPython repo 2 minutes 12-15 seconds timesout after 30 seconds DjangoCon US 2018 @mariatta -
PR merged event (webhook) Open pull request (REST API) Run
cherry_picker.py Clone CPython repo 2 minutes 12-15 seconds timesout after 30 seconds DjangoCon US 2018 @mariatta -
PR merged event (webhook) Open pull request (REST API) Run
cherry_picker.py Clone CPython repo Webservice (aiohttp) Background task (celery) Start a task DjangoCon US 2018 @mariatta -
PR merged event (webhook) Open pull request (REST API) Run
cherry_picker.py Clone CPython repo Webservice (aiohttp) Background task (celery) miss-islington Start a task DjangoCon US 2018 @mariatta -
miss-islington • open-source https://github.com/python/miss-islington • Python 3.6 (because f-strings) •
aiohttp: async web server/client • gidgethub: async Python library for GitHub DjangoCon US 2018 @mariatta -
miss-islington @router.register("pull_request", action="closed") async def backport_pr(event, gh, *args, **kwargs): if
event.data["pull_request"]["merged"]: commit_hash = event.data["pull_request"]["merge_commit_sha"] ... branches = [ label["name"].split()[-1] for label in pr_labels if label["name"].startswith("needs backport to”) ] for branch in branches: ... tasks.backport_task.delay(commit_hash, branch, ...) source: https://github.com/python/miss-islington/blob/master/miss_islington/backport_pr.py DjangoCon US 2018 @mariatta -
Problem: Complicated Workflow Bug or feature? CLA signed? Tests passed?
Needs an issue? Needs news entry? News entry added? Needs backport? How? Who? When? First time contributor? Commit message? DjangoCon US 2018 @mariatta -
PR status event (webhook) Get the combined status for a
ref (REST API) (status of a Git commit changes) Post a comment in PR (REST API) 2. https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref 2 1 3 1. https://developer.github.com/v3/activity/events/types/#statusevent 3. https://developer.github.com/v3/issues/comments/#create-a-comment DjangoCon US 2018 @mariatta -
PR status event (webhook) Get the combined status for a
ref (REST API) (status of a Git commit changes) Post a comment in PR (REST API) Which PR is this? 2. https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref 2 1 3 1. https://developer.github.com/v3/activity/events/types/#statusevent 3. https://developer.github.com/v3/issues/comments/#create-a-comment DjangoCon US 2018 @mariatta -
GITHUB SEARCH ISSUES API async def get_pr_for_commit(gh, sha): prs_for_commit =
await gh.getitem( f"/search/issues/?q=type:pr+repo:python/cpython+sha:{sha}" ) source: https://github.com/python/miss-islington/blob/master/miss_islington/util.py https://developer.github.com/v3/search/#search-issues DjangoCon US 2018 @mariatta -
PR status event (webhook) Get the combined status for a
ref (REST API) Post a comment in PR (REST API) Search PR containing commit (REST API) DjangoCon US 2018 @mariatta -
Problem: Complicated Workflow Bug or feature? CLA signed? Tests passed?
Needs an issue? Needs news entry? News entry added? Needs backport? How? Who? When? First time contributor? Commit message? DjangoCon US 2018 @mariatta -
Merge the PR pr_number = 5590 await gh.put(f"/repos/python/cpython/pulls/{pr_number}/merge", data={"commit_title": "Fix
typo in f-strings docs", "commit_message": "Shorten the comment to: 'using integer format specifier'"), "sha": sha, "merge_method": "squash" } ) DjangoCon US 2018 @mariatta -
Merge the PR pr_number = 5590 await gh.put(f"/repos/python/cpython/pulls/{pr_number}/merge", data={"commit_title": "Fix
typo in f-strings docs", "commit_message": "Shorten the comment to: 'using integer format specifier'"), "sha": sha, "merge_method": "squash" } ) DjangoCon US 2018 @mariatta -
black out Bot that formats code with black DjangoCon US
2018 @mariatta -
Automatically add CoC Automatically add CoC to newly created repo
in organization DjangoCon US 2018 @mariatta -
OOOS bot Out of open source auto reply bot DjangoCon
US 2018 @mariatta -
RHYMES WITH HAPPIER! OOOS bot Out of open source auto
reply bot DjangoCon US 2018 @mariatta -
Close all PRs PR opened/reopened event Close pull request DjangoCon
US 2018 @mariatta -
Close all PRs PR opened/reopened event Close pull request @router.register("pull_request",
action="opened") @router.register("pull_request", action="reopened") async def close_pr(event, gh, *args, **kwargs): await gh.patch(event.data["pull_request"]["url"], data= {"state": "closed"} ) Source: https://github.com/Mariatta/close-all-pr/blob/master/close-all-pr/close_pr.py DjangoCon US 2018 @mariatta -
Contact [email protected] Follow on twitter @mariatta Thank you! DjangoCon US
2018 @mariatta PS: Please fill in Python Developers Survey http://bit.ly/pds2018-django