Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gmail: replace deprecated oauth2client package with google-auth-oauthlib #743

Merged
merged 6 commits into from
Sep 17, 2020

Conversation

Fongshway
Copy link
Contributor

Summary

When following the Gmail setup instructions, I discovered that Google's quick start page relies on google-auth-oauthlib instead of the deprecated oauth2client package, which bugwarrior currently uses. Since my credentials had expired, I also discovered that the new credentials.json created by following the quick start guide is also incompatible with the old credential file I was using. While I'm no OAuth expert, I used the Python code on the quick start page to make updates to bugwarrior's Gmail service so we can use the newer google-auth-oauthlib package. Hopefully this saves someone else some trouble! See oauth2client deprecation for more info.

Some other clean up items:

  • Add gmail as supported service in README and sort list alphabetically.
  • Sort install_requires and extras_require alphabetically in setup.py.
  • Also update extras_require to use {} instead of dict(), since the former plays nicer with pipenv, which I use for bugwarrior development. See extras_require in setup.py is not correctly evaluated pypa/pipenv#4309 for the relevant pipenv issue. If there's interest, I can open a separate PR with the Pipfile and Pipfile.lock I use on my fork.

@ryneeverett
Copy link
Collaborator

If there's interest, I can open a separate PR with the Pipfile and Pipfile.lock I use on my fork.

I'd be especially supportive of adding these files if they were accompanied by an additional section in the contributing docs describing how to use them as an alternative method of setting up a development environment.


self.assertEqual(service.get_credentials().to_json(), expected.to_json())

def test_get_credentials_expired(self):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add some comment(s) explaining how this test works? It isn't obvious why mocking Credentials.refresh to return None would yield the same results as expected.__dict__["expiry"] = datetime.now().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm new to mocking and agree my initial test wasn't very clear, but after sleeping on it I think I have a cleaner/more self explanatory solution for this via 7e4c263. Let me know what you think!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

@ryneeverett ryneeverett mentioned this pull request Jul 29, 2020
4 tasks
@Fongshway
Copy link
Contributor Author

@ryneeverett can this be merged? I was planning on opening a separate PR for the Pipfile afterwards.

@ryneeverett
Copy link
Collaborator

@ryneeverett can this be merged? I was planning on opening a separate PR for the Pipfile afterwards.

I do plan to merge this but I usually wait a few weeks to give others the opportunity to review. Reviews from others are rare these days but I like to leave a window in hopes that this will change. There isn't much risk of merge conflicts at the current rate of development.

Please do submit the Pipfile additions in a separate PR.

@Fongshway
Copy link
Contributor Author

Sounds good, thanks!

@ryneeverett ryneeverett merged commit 3595b85 into GothenburgBitFactory:develop Sep 17, 2020
@Fongshway Fongshway deleted the gmail/oauth branch April 24, 2022 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants