{"action":"opened","number":344,"pull_request":{"url":"https://api.github.com/repos/jpadilla/pyjwt/pulls/344","id":179915532,"html_url":"https://github.com/jpadilla/pyjwt/pull/344","diff_url":"https://github.com/jpadilla/pyjwt/pull/344.diff","patch_url":"https://github.com/jpadilla/pyjwt/pull/344.patch","issue_url":"https://api.github.com/repos/jpadilla/pyjwt/issues/344","number":344,"state":"open","locked":false,"title":"RFC: Add type hints","user":{"login":"jacopofar","id":1280346,"avatar_url":"https://avatars1.githubusercontent.com/u/1280346?v=4","gravatar_id":"","url":"https://api.github.com/users/jacopofar","html_url":"https://github.com/jacopofar","followers_url":"https://api.github.com/users/jacopofar/followers","following_url":"https://api.github.com/users/jacopofar/following{/other_user}","gists_url":"https://api.github.com/users/jacopofar/gists{/gist_id}","starred_url":"https://api.github.com/users/jacopofar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jacopofar/subscriptions","organizations_url":"https://api.github.com/users/jacopofar/orgs","repos_url":"https://api.github.com/users/jacopofar/repos","events_url":"https://api.github.com/users/jacopofar/events{/privacy}","received_events_url":"https://api.github.com/users/jacopofar/received_events","type":"User","site_admin":false},"body":"I decided to use the time my company, [Flixbus](https://www.flixbus.com/), dedicates to FOSS projects to contribute to this package.\r\n\r\nThis PR adds type hints as described in issue #312 and includes `mypy` in Travis configuration. This means that IDEs can automatically detect type errors and results from static check tools can improve.\r\n\r\nThere are a few doubts about which I'd like a feedback and for which I'm ready to work to change/fix:\r\n\r\n- Mypy complains about `PyJWT.encode` not being a subtype of `PyJWS.encode`, and the same for `decode`. In the case of `decode` the problem is that one calls the token `jwt` and the other `jws`, so I just called both `token`. As for `encode` the problem is that `JWS` expects bytes and `JWT` a dictionary, so I changed `JWS.encode` to `JWS.encode_bytes`. In the documentation there are no examples about using that function, but it is a breaking change for who uses it.\r\n\r\n- The change required to import the `typing` module in a `try...catch`, so it can be imported when checking the types but is ignored during normal usage of the library. It's a bit ugly but I couldn't find other ways to have it work on Python 2.7\r\n\r\n- I didn't update the changelog or bump the version, if `JWS.encode` is considered part of the API I guess the major version number is affected","created_at":"2018-04-06T10:52:36Z","updated_at":"2018-04-06T10:52:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/jpadilla/pyjwt/pulls/344/commits","review_comments_url":"https://api.github.com/repos/jpadilla/pyjwt/pulls/344/comments","review_comment_url":"https://api.github.com/repos/jpadilla/pyjwt/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jpadilla/pyjwt/issues/344/comments","statuses_url":"https://api.github.com/repos/jpadilla/pyjwt/statuses/060ff608cc4fbb9b23b46467cbb3b0244f7e21e5","head":{"label":"flix-tech:add-type-hints","ref":"add-type-hints","sha":"060ff608cc4fbb9b23b46467cbb3b0244f7e21e5","user":{"login":"flix-tech","id":1230203,"avatar_url":"https://avatars2.githubusercontent.com/u/1230203?v=4","gravatar_id":"","url":"https://api.github.com/users/flix-tech","html_url":"https://github.com/flix-tech","followers_url":"https://api.github.com/users/flix-tech/followers","following_url":"https://api.github.com/users/flix-tech/following{/other_user}","gists_url":"https://api.github.com/users/flix-tech/gists{/gist_id}","starred_url":"https://api.github.com/users/flix-tech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flix-tech/subscriptions","organizations_url":"https://api.github.com/users/flix-tech/orgs","repos_url":"https://api.github.com/users/flix-tech/repos","events_url":"https://api.github.com/users/flix-tech/events{/privacy}","received_events_url":"https://api.github.com/users/flix-tech/received_events","type":"Organization","site_admin":false},"repo":{"id":128366832,"name":"pyjwt","full_name":"flix-tech/pyjwt","owner":{"login":"flix-tech","id":1230203,"avatar_url":"https://avatars2.githubusercontent.com/u/1230203?v=4","gravatar_id":"","url":"https://api.github.com/users/flix-tech","html_url":"https://github.com/flix-tech","followers_url":"https://api.github.com/users/flix-tech/followers","following_url":"https://api.github.com/users/flix-tech/following{/other_user}","gists_url":"https://api.github.com/users/flix-tech/gists{/gist_id}","starred_url":"https://api.github.com/users/flix-tech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flix-tech/subscriptions","organizations_url":"https://api.github.com/users/flix-tech/orgs","repos_url":"https://api.github.com/users/flix-tech/repos","events_url":"https://api.github.com/users/flix-tech/events{/privacy}","received_events_url":"https://api.github.com/users/flix-tech/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/flix-tech/pyjwt","description":"JSON Web Token implementation in Python","fork":true,"url":"https://api.github.com/repos/flix-tech/pyjwt","forks_url":"https://api.github.com/repos/flix-tech/pyjwt/forks","keys_url":"https://api.github.com/repos/flix-tech/pyjwt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flix-tech/pyjwt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flix-tech/pyjwt/teams","hooks_url":"https://api.github.com/repos/flix-tech/pyjwt/hooks","issue_events_url":"https://api.github.com/repos/flix-tech/pyjwt/issues/events{/number}","events_url":"https://api.github.com/repos/flix-tech/pyjwt/events","assignees_url":"https://api.github.com/repos/flix-tech/pyjwt/assignees{/user}","branches_url":"https://api.github.com/repos/flix-tech/pyjwt/branches{/branch}","tags_url":"https://api.github.com/repos/flix-tech/pyjwt/tags","blobs_url":"https://api.github.com/repos/flix-tech/pyjwt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flix-tech/pyjwt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flix-tech/pyjwt/git/refs{/sha}","trees_url":"https://api.github.com/repos/flix-tech/pyjwt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flix-tech/pyjwt/statuses/{sha}","languages_url":"https://api.github.com/repos/flix-tech/pyjwt/languages","stargazers_url":"https://api.github.com/repos/flix-tech/pyjwt/stargazers","contributors_url":"https://api.github.com/repos/flix-tech/pyjwt/contributors","subscribers_url":"https://api.github.com/repos/flix-tech/pyjwt/subscribers","subscription_url":"https://api.github.com/repos/flix-tech/pyjwt/subscription","commits_url":"https://api.github.com/repos/flix-tech/pyjwt/commits{/sha}","git_commits_url":"https://api.github.com/repos/flix-tech/pyjwt/git/commits{/sha}","comments_url":"https://api.github.com/repos/flix-tech/pyjwt/comments{/number}","issue_comment_url":"https://api.github.com/repos/flix-tech/pyjwt/issues/comments{/number}","contents_url":"https://api.github.com/repos/flix-tech/pyjwt/contents/{+path}","compare_url":"https://api.github.com/repos/flix-tech/pyjwt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flix-tech/pyjwt/merges","archive_url":"https://api.github.com/repos/flix-tech/pyjwt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flix-tech/pyjwt/downloads","issues_url":"https://api.github.com/repos/flix-tech/pyjwt/issues{/number}","pulls_url":"https://api.github.com/repos/flix-tech/pyjwt/pulls{/number}","milestones_url":"https://api.github.com/repos/flix-tech/pyjwt/milestones{/number}","notifications_url":"https://api.github.com/repos/flix-tech/pyjwt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flix-tech/pyjwt/labels{/name}","releases_url":"https://api.github.com/repos/flix-tech/pyjwt/releases{/id}","deployments_url":"https://api.github.com/repos/flix-tech/pyjwt/deployments","created_at":"2018-04-06T08:02:29Z","updated_at":"2018-04-06T08:02:31Z","pushed_at":"2018-04-06T10:25:20Z","git_url":"git://github.com/flix-tech/pyjwt.git","ssh_url":"git@github.com:flix-tech/pyjwt.git","clone_url":"https://github.com/flix-tech/pyjwt.git","svn_url":"https://github.com/flix-tech/pyjwt","homepage":"https://pyjwt.readthedocs.io","size":510,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jpadilla:master","ref":"master","sha":"ee2ab9fbd78f884629833feedffdc69a9d580b89","user":{"login":"jpadilla","id":83319,"avatar_url":"https://avatars0.githubusercontent.com/u/83319?v=4","gravatar_id":"","url":"https://api.github.com/users/jpadilla","html_url":"https://github.com/jpadilla","followers_url":"https://api.github.com/users/jpadilla/followers","following_url":"https://api.github.com/users/jpadilla/following{/other_user}","gists_url":"https://api.github.com/users/jpadilla/gists{/gist_id}","starred_url":"https://api.github.com/users/jpadilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpadilla/subscriptions","organizations_url":"https://api.github.com/users/jpadilla/orgs","repos_url":"https://api.github.com/users/jpadilla/repos","events_url":"https://api.github.com/users/jpadilla/events{/privacy}","received_events_url":"https://api.github.com/users/jpadilla/received_events","type":"User","site_admin":false},"repo":{"id":1408162,"name":"pyjwt","full_name":"jpadilla/pyjwt","owner":{"login":"jpadilla","id":83319,"avatar_url":"https://avatars0.githubusercontent.com/u/83319?v=4","gravatar_id":"","url":"https://api.github.com/users/jpadilla","html_url":"https://github.com/jpadilla","followers_url":"https://api.github.com/users/jpadilla/followers","following_url":"https://api.github.com/users/jpadilla/following{/other_user}","gists_url":"https://api.github.com/users/jpadilla/gists{/gist_id}","starred_url":"https://api.github.com/users/jpadilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpadilla/subscriptions","organizations_url":"https://api.github.com/users/jpadilla/orgs","repos_url":"https://api.github.com/users/jpadilla/repos","events_url":"https://api.github.com/users/jpadilla/events{/privacy}","received_events_url":"https://api.github.com/users/jpadilla/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jpadilla/pyjwt","description":"JSON Web Token implementation in Python","fork":false,"url":"https://api.github.com/repos/jpadilla/pyjwt","forks_url":"https://api.github.com/repos/jpadilla/pyjwt/forks","keys_url":"https://api.github.com/repos/jpadilla/pyjwt/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jpadilla/pyjwt/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jpadilla/pyjwt/teams","hooks_url":"https://api.github.com/repos/jpadilla/pyjwt/hooks","issue_events_url":"https://api.github.com/repos/jpadilla/pyjwt/issues/events{/number}","events_url":"https://api.github.com/repos/jpadilla/pyjwt/events","assignees_url":"https://api.github.com/repos/jpadilla/pyjwt/assignees{/user}","branches_url":"https://api.github.com/repos/jpadilla/pyjwt/branches{/branch}","tags_url":"https://api.github.com/repos/jpadilla/pyjwt/tags","blobs_url":"https://api.github.com/repos/jpadilla/pyjwt/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jpadilla/pyjwt/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jpadilla/pyjwt/git/refs{/sha}","trees_url":"https://api.github.com/repos/jpadilla/pyjwt/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jpadilla/pyjwt/statuses/{sha}","languages_url":"https://api.github.com/repos/jpadilla/pyjwt/languages","stargazers_url":"https://api.github.com/repos/jpadilla/pyjwt/stargazers","contributors_url":"https://api.github.com/repos/jpadilla/pyjwt/contributors","subscribers_url":"https://api.github.com/repos/jpadilla/pyjwt/subscribers","subscription_url":"https://api.github.com/repos/jpadilla/pyjwt/subscription","commits_url":"https://api.github.com/repos/jpadilla/pyjwt/commits{/sha}","git_commits_url":"https://api.github.com/repos/jpadilla/pyjwt/git/commits{/sha}","comments_url":"https://api.github.com/repos/jpadilla/pyjwt/comments{/number}","issue_comment_url":"https://api.github.com/repos/jpadilla/pyjwt/issues/comments{/number}","contents_url":"https://api.github.com/repos/jpadilla/pyjwt/contents/{+path}","compare_url":"https://api.github.com/repos/jpadilla/pyjwt/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jpadilla/pyjwt/merges","archive_url":"https://api.github.com/repos/jpadilla/pyjwt/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jpadilla/pyjwt/downloads","issues_url":"https://api.github.com/repos/jpadilla/pyjwt/issues{/number}","pulls_url":"https://api.github.com/repos/jpadilla/pyjwt/pulls{/number}","milestones_url":"https://api.github.com/repos/jpadilla/pyjwt/milestones{/number}","notifications_url":"https://api.github.com/repos/jpadilla/pyjwt/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jpadilla/pyjwt/labels{/name}","releases_url":"https://api.github.com/repos/jpadilla/pyjwt/releases{/id}","deployments_url":"https://api.github.com/repos/jpadilla/pyjwt/deployments","created_at":"2011-02-24T20:25:09Z","updated_at":"2018-04-06T10:26:12Z","pushed_at":"2018-03-29T15:27:19Z","git_url":"git://github.com/jpadilla/pyjwt.git","ssh_url":"git@github.com:jpadilla/pyjwt.git","clone_url":"https://github.com/jpadilla/pyjwt.git","svn_url":"https://github.com/jpadilla/pyjwt","homepage":"https://pyjwt.readthedocs.io","size":504,"stargazers_count":1852,"watchers_count":1852,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":247,"mirror_url":null,"archived":false,"open_issues_count":33,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":247,"open_issues":33,"watchers":1852,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jpadilla/pyjwt/pulls/344"},"html":{"href":"https://github.com/jpadilla/pyjwt/pull/344"},"issue":{"href":"https://api.github.com/repos/jpadilla/pyjwt/issues/344"},"comments":{"href":"https://api.github.com/repos/jpadilla/pyjwt/issues/344/comments"},"review_comments":{"href":"https://api.github.com/repos/jpadilla/pyjwt/pulls/344/comments"},"review_comment":{"href":"https://api.github.com/repos/jpadilla/pyjwt/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jpadilla/pyjwt/pulls/344/commits"},"statuses":{"href":"https://api.github.com/repos/jpadilla/pyjwt/statuses/060ff608cc4fbb9b23b46467cbb3b0244f7e21e5"}},"author_association":"NONE","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":3,"additions":83,"deletions":50,"changed_files":5}}
{"actor":{"display_login":"jacopofar"}}