{"action":"reopened","number":3225,"pull_request":{"url":"https://api.github.com/repos/python/mypy/pulls/3225","id":117131413,"html_url":"https://github.com/python/mypy/pull/3225","diff_url":"https://github.com/python/mypy/pull/3225.diff","patch_url":"https://github.com/python/mypy/pull/3225.patch","issue_url":"https://api.github.com/repos/python/mypy/issues/3225","number":3225,"state":"open","locked":false,"title":"Pluggable system for generating types from docstrings (revisited)","user":{"login":"chadrik","id":63251,"avatar_url":"https://avatars2.githubusercontent.com/u/63251?v=3","gravatar_id":"","url":"https://api.github.com/users/chadrik","html_url":"https://github.com/chadrik","followers_url":"https://api.github.com/users/chadrik/followers","following_url":"https://api.github.com/users/chadrik/following{/other_user}","gists_url":"https://api.github.com/users/chadrik/gists{/gist_id}","starred_url":"https://api.github.com/users/chadrik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chadrik/subscriptions","organizations_url":"https://api.github.com/users/chadrik/orgs","repos_url":"https://api.github.com/users/chadrik/repos","events_url":"https://api.github.com/users/chadrik/events{/privacy}","received_events_url":"https://api.github.com/users/chadrik/received_events","type":"User","site_admin":false},"body":"Hi,\r\nI'm picking up where I left off on #2240.  \r\n\r\nHere's a bit of a review:\r\n\r\nThis PR would allow third-party tools to extend mypy with callbacks to parse PEP484 type annotations within function docstrings.  To do so, this PR introduces a basic \"hook\" system, as a pre-cursor to a complete plugin system (issue #1240).  \r\n\r\nA hook can be registered, along with options specific to that hook, using the mypy configuration file:\r\n\r\n```ini\r\n[mypy]\r\nfast_parser = true\r\nhooks.docstring_parser = mypydoc.parse_docstring\r\n\r\n[docstring_parser]\r\ndefault_return_type = 'None'\r\n```\r\n\r\nHook options specified in the config file are passed to the hook as a dictionary.\r\n\r\nOne big new change from where I left off with #2240 is that the `docstring_parser` hook is now passed the active `mypy.errors.Errors` instance so that it can use the full range of error reporting, especially specification of blocker and severity level.  \r\n\r\nI have concerns about exposing the `mypy.errors.Errors` class as part of a public API so I was considering writing a simple wrapper that exposes only the bare minimum interface, perhaps something like this:\r\n\r\n```python\r\nclass Errors:\r\n    _errors = None  # type: errors.Errors\r\n\r\n    def __init__(self, errors: errors.Errors):\r\n        self._errors = errors\r\n\r\n    def report(self, line: int, column: int, message: str, blocker: bool = False,\r\n               severity: str = 'error', file: str = None, only_once: bool = False,\r\n               origin_line: int = None) -> None:\r\n        return self._errors.report(line, column, message, blocker, severity, file, only_once, origin_line)\r\n```\r\n\r\nWhat do you think?\r\n\r\nSorry about getting stalled out before (I blamed it on the birth of my second daughter!).  Looking forward to getting this wrapped up.\r\n\r\n","created_at":"2017-04-23T00:52:38Z","updated_at":"2017-06-10T01:27:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bd8daafb3ee38bb0e2904b0635c3514eeaaa3a23","assignee":{"login":"gvanrossum","id":2894642,"avatar_url":"https://avatars0.githubusercontent.com/u/2894642?v=3","gravatar_id":"","url":"https://api.github.com/users/gvanrossum","html_url":"https://github.com/gvanrossum","followers_url":"https://api.github.com/users/gvanrossum/followers","following_url":"https://api.github.com/users/gvanrossum/following{/other_user}","gists_url":"https://api.github.com/users/gvanrossum/gists{/gist_id}","starred_url":"https://api.github.com/users/gvanrossum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gvanrossum/subscriptions","organizations_url":"https://api.github.com/users/gvanrossum/orgs","repos_url":"https://api.github.com/users/gvanrossum/repos","events_url":"https://api.github.com/users/gvanrossum/events{/privacy}","received_events_url":"https://api.github.com/users/gvanrossum/received_events","type":"User","site_admin":false},"assignees":[{"login":"gvanrossum","id":2894642,"avatar_url":"https://avatars0.githubusercontent.com/u/2894642?v=3","gravatar_id":"","url":"https://api.github.com/users/gvanrossum","html_url":"https://github.com/gvanrossum","followers_url":"https://api.github.com/users/gvanrossum/followers","following_url":"https://api.github.com/users/gvanrossum/following{/other_user}","gists_url":"https://api.github.com/users/gvanrossum/gists{/gist_id}","starred_url":"https://api.github.com/users/gvanrossum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gvanrossum/subscriptions","organizations_url":"https://api.github.com/users/gvanrossum/orgs","repos_url":"https://api.github.com/users/gvanrossum/repos","events_url":"https://api.github.com/users/gvanrossum/events{/privacy}","received_events_url":"https://api.github.com/users/gvanrossum/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"gvanrossum","id":2894642,"avatar_url":"https://avatars0.githubusercontent.com/u/2894642?v=3","gravatar_id":"","url":"https://api.github.com/users/gvanrossum","html_url":"https://github.com/gvanrossum","followers_url":"https://api.github.com/users/gvanrossum/followers","following_url":"https://api.github.com/users/gvanrossum/following{/other_user}","gists_url":"https://api.github.com/users/gvanrossum/gists{/gist_id}","starred_url":"https://api.github.com/users/gvanrossum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gvanrossum/subscriptions","organizations_url":"https://api.github.com/users/gvanrossum/orgs","repos_url":"https://api.github.com/users/gvanrossum/repos","events_url":"https://api.github.com/users/gvanrossum/events{/privacy}","received_events_url":"https://api.github.com/users/gvanrossum/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/python/mypy/pulls/3225/commits","review_comments_url":"https://api.github.com/repos/python/mypy/pulls/3225/comments","review_comment_url":"https://api.github.com/repos/python/mypy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/python/mypy/issues/3225/comments","statuses_url":"https://api.github.com/repos/python/mypy/statuses/724c484a8c13c26d253a58c4a8111a176281967f","head":{"label":"chadrik:docstrings","ref":"docstrings","sha":"724c484a8c13c26d253a58c4a8111a176281967f","user":{"login":"chadrik","id":63251,"avatar_url":"https://avatars2.githubusercontent.com/u/63251?v=3","gravatar_id":"","url":"https://api.github.com/users/chadrik","html_url":"https://github.com/chadrik","followers_url":"https://api.github.com/users/chadrik/followers","following_url":"https://api.github.com/users/chadrik/following{/other_user}","gists_url":"https://api.github.com/users/chadrik/gists{/gist_id}","starred_url":"https://api.github.com/users/chadrik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chadrik/subscriptions","organizations_url":"https://api.github.com/users/chadrik/orgs","repos_url":"https://api.github.com/users/chadrik/repos","events_url":"https://api.github.com/users/chadrik/events{/privacy}","received_events_url":"https://api.github.com/users/chadrik/received_events","type":"User","site_admin":false},"repo":{"id":63541565,"name":"mypy","full_name":"chadrik/mypy","owner":{"login":"chadrik","id":63251,"avatar_url":"https://avatars2.githubusercontent.com/u/63251?v=3","gravatar_id":"","url":"https://api.github.com/users/chadrik","html_url":"https://github.com/chadrik","followers_url":"https://api.github.com/users/chadrik/followers","following_url":"https://api.github.com/users/chadrik/following{/other_user}","gists_url":"https://api.github.com/users/chadrik/gists{/gist_id}","starred_url":"https://api.github.com/users/chadrik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chadrik/subscriptions","organizations_url":"https://api.github.com/users/chadrik/orgs","repos_url":"https://api.github.com/users/chadrik/repos","events_url":"https://api.github.com/users/chadrik/events{/privacy}","received_events_url":"https://api.github.com/users/chadrik/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chadrik/mypy","description":"Optional static typing for Python 2 and 3 (PEP484)","fork":true,"url":"https://api.github.com/repos/chadrik/mypy","forks_url":"https://api.github.com/repos/chadrik/mypy/forks","keys_url":"https://api.github.com/repos/chadrik/mypy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chadrik/mypy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chadrik/mypy/teams","hooks_url":"https://api.github.com/repos/chadrik/mypy/hooks","issue_events_url":"https://api.github.com/repos/chadrik/mypy/issues/events{/number}","events_url":"https://api.github.com/repos/chadrik/mypy/events","assignees_url":"https://api.github.com/repos/chadrik/mypy/assignees{/user}","branches_url":"https://api.github.com/repos/chadrik/mypy/branches{/branch}","tags_url":"https://api.github.com/repos/chadrik/mypy/tags","blobs_url":"https://api.github.com/repos/chadrik/mypy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chadrik/mypy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chadrik/mypy/git/refs{/sha}","trees_url":"https://api.github.com/repos/chadrik/mypy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chadrik/mypy/statuses/{sha}","languages_url":"https://api.github.com/repos/chadrik/mypy/languages","stargazers_url":"https://api.github.com/repos/chadrik/mypy/stargazers","contributors_url":"https://api.github.com/repos/chadrik/mypy/contributors","subscribers_url":"https://api.github.com/repos/chadrik/mypy/subscribers","subscription_url":"https://api.github.com/repos/chadrik/mypy/subscription","commits_url":"https://api.github.com/repos/chadrik/mypy/commits{/sha}","git_commits_url":"https://api.github.com/repos/chadrik/mypy/git/commits{/sha}","comments_url":"https://api.github.com/repos/chadrik/mypy/comments{/number}","issue_comment_url":"https://api.github.com/repos/chadrik/mypy/issues/comments{/number}","contents_url":"https://api.github.com/repos/chadrik/mypy/contents/{+path}","compare_url":"https://api.github.com/repos/chadrik/mypy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chadrik/mypy/merges","archive_url":"https://api.github.com/repos/chadrik/mypy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chadrik/mypy/downloads","issues_url":"https://api.github.com/repos/chadrik/mypy/issues{/number}","pulls_url":"https://api.github.com/repos/chadrik/mypy/pulls{/number}","milestones_url":"https://api.github.com/repos/chadrik/mypy/milestones{/number}","notifications_url":"https://api.github.com/repos/chadrik/mypy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chadrik/mypy/labels{/name}","releases_url":"https://api.github.com/repos/chadrik/mypy/releases{/id}","deployments_url":"https://api.github.com/repos/chadrik/mypy/deployments","created_at":"2016-07-17T16:27:59Z","updated_at":"2016-07-17T16:28:02Z","pushed_at":"2017-06-09T04:32:56Z","git_url":"git://github.com/chadrik/mypy.git","ssh_url":"git@github.com:chadrik/mypy.git","clone_url":"https://github.com/chadrik/mypy.git","svn_url":"https://github.com/chadrik/mypy","homepage":"http://www.mypy-lang.org/","size":20316,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"python:master","ref":"master","sha":"7b7c7adf31e465636042101dca7d583672be8c6a","user":{"login":"python","id":1525981,"avatar_url":"https://avatars0.githubusercontent.com/u/1525981?v=3","gravatar_id":"","url":"https://api.github.com/users/python","html_url":"https://github.com/python","followers_url":"https://api.github.com/users/python/followers","following_url":"https://api.github.com/users/python/following{/other_user}","gists_url":"https://api.github.com/users/python/gists{/gist_id}","starred_url":"https://api.github.com/users/python/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/python/subscriptions","organizations_url":"https://api.github.com/users/python/orgs","repos_url":"https://api.github.com/users/python/repos","events_url":"https://api.github.com/users/python/events{/privacy}","received_events_url":"https://api.github.com/users/python/received_events","type":"Organization","site_admin":false},"repo":{"id":7053637,"name":"mypy","full_name":"python/mypy","owner":{"login":"python","id":1525981,"avatar_url":"https://avatars0.githubusercontent.com/u/1525981?v=3","gravatar_id":"","url":"https://api.github.com/users/python","html_url":"https://github.com/python","followers_url":"https://api.github.com/users/python/followers","following_url":"https://api.github.com/users/python/following{/other_user}","gists_url":"https://api.github.com/users/python/gists{/gist_id}","starred_url":"https://api.github.com/users/python/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/python/subscriptions","organizations_url":"https://api.github.com/users/python/orgs","repos_url":"https://api.github.com/users/python/repos","events_url":"https://api.github.com/users/python/events{/privacy}","received_events_url":"https://api.github.com/users/python/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/python/mypy","description":"Optional static typing for Python 2 and 3 (PEP484)","fork":false,"url":"https://api.github.com/repos/python/mypy","forks_url":"https://api.github.com/repos/python/mypy/forks","keys_url":"https://api.github.com/repos/python/mypy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/python/mypy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/python/mypy/teams","hooks_url":"https://api.github.com/repos/python/mypy/hooks","issue_events_url":"https://api.github.com/repos/python/mypy/issues/events{/number}","events_url":"https://api.github.com/repos/python/mypy/events","assignees_url":"https://api.github.com/repos/python/mypy/assignees{/user}","branches_url":"https://api.github.com/repos/python/mypy/branches{/branch}","tags_url":"https://api.github.com/repos/python/mypy/tags","blobs_url":"https://api.github.com/repos/python/mypy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/python/mypy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/python/mypy/git/refs{/sha}","trees_url":"https://api.github.com/repos/python/mypy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/python/mypy/statuses/{sha}","languages_url":"https://api.github.com/repos/python/mypy/languages","stargazers_url":"https://api.github.com/repos/python/mypy/stargazers","contributors_url":"https://api.github.com/repos/python/mypy/contributors","subscribers_url":"https://api.github.com/repos/python/mypy/subscribers","subscription_url":"https://api.github.com/repos/python/mypy/subscription","commits_url":"https://api.github.com/repos/python/mypy/commits{/sha}","git_commits_url":"https://api.github.com/repos/python/mypy/git/commits{/sha}","comments_url":"https://api.github.com/repos/python/mypy/comments{/number}","issue_comment_url":"https://api.github.com/repos/python/mypy/issues/comments{/number}","contents_url":"https://api.github.com/repos/python/mypy/contents/{+path}","compare_url":"https://api.github.com/repos/python/mypy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/python/mypy/merges","archive_url":"https://api.github.com/repos/python/mypy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/python/mypy/downloads","issues_url":"https://api.github.com/repos/python/mypy/issues{/number}","pulls_url":"https://api.github.com/repos/python/mypy/pulls{/number}","milestones_url":"https://api.github.com/repos/python/mypy/milestones{/number}","notifications_url":"https://api.github.com/repos/python/mypy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/python/mypy/labels{/name}","releases_url":"https://api.github.com/repos/python/mypy/releases{/id}","deployments_url":"https://api.github.com/repos/python/mypy/deployments","created_at":"2012-12-07T13:30:23Z","updated_at":"2017-06-09T23:55:43Z","pushed_at":"2017-06-09T23:41:49Z","git_url":"git://github.com/python/mypy.git","ssh_url":"git@github.com:python/mypy.git","clone_url":"https://github.com/python/mypy.git","svn_url":"https://github.com/python/mypy","homepage":"http://www.mypy-lang.org/","size":20493,"stargazers_count":2554,"watchers_count":2554,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":317,"mirror_url":null,"open_issues_count":687,"forks":317,"open_issues":687,"watchers":2554,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/python/mypy/pulls/3225"},"html":{"href":"https://github.com/python/mypy/pull/3225"},"issue":{"href":"https://api.github.com/repos/python/mypy/issues/3225"},"comments":{"href":"https://api.github.com/repos/python/mypy/issues/3225/comments"},"review_comments":{"href":"https://api.github.com/repos/python/mypy/pulls/3225/comments"},"review_comment":{"href":"https://api.github.com/repos/python/mypy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/python/mypy/pulls/3225/commits"},"statuses":{"href":"https://api.github.com/repos/python/mypy/statuses/724c484a8c13c26d253a58c4a8111a176281967f"}},"merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":11,"review_comments":1,"maintainer_can_modify":true,"commits":6,"additions":366,"deletions":11,"changed_files":7}}
{"actor":{"display_login":"gvanrossum"}}