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

Clean up the code, add docstrings, and get rid of the poorly implemented async client #78

Merged
merged 9 commits into from
May 8, 2017

Conversation

wojcikstefan
Copy link
Member

@wojcikstefan wojcikstefan commented Jan 28, 2017

Right now the async client makes the code more complex and doesn't really add much value. I doubt it's used in the wild and if it is, then the usage is probably quite confusing and hacky. I think we might as well get rid of it.

Examples of current confusing behavor:

  • api.get/post/put/delete is still synchronous
  • api.map expects a list of grequests.AsyncRequest, but there's no easy way to construct them.

This PR introduces breaking changes and should be published along with a major version bump.

TODO:

  • Add mocked unit tests
  • Bump version to v1.0
  • Add a GitHub Release and publish on PyPI

@thomasst
Copy link
Member

Looks good (but didn't test).

@wojcikstefan
Copy link
Member Author

@closeio/engineering I believe that once we add unit tests to this PR, we can release it as v1.0. Agreed?

@philfreo
Copy link
Member

👍

@thomasst
Copy link
Member

Sounds good. So what's happening to async? Are there any plans for it?

@wojcikstefan
Copy link
Member Author

Given the arguments I laid out in #78 (comment) and in the description for #79, I think it might make sense to drop it altogether. This way we maintain a simple & readable helper library w/o any quirks while the users can choose to run multiple concurrent api.get/post/put/delete requests via threading, multiprocessing, concurrent.futures, gevent, etc. depending on their specific use case and environment.

self.max_retries = max_retries
self.tz_offset = tz_offset or str(local_tz_offset())
self.verify = verify

if async:
import grequests
Copy link
Member

Choose a reason for hiding this comment

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

You can probably remove grequests etc now from setup.py and requirements.txt

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, done in 02bad5b

@philfreo
Copy link
Member

@wojcikstefan Let's move forward with merging this? Can you handle conflicts and publish?

@wojcikstefan
Copy link
Member Author

@thomasst @jkemp101 @philfreo This should be ready to go, please review. If you give the go ahead, I'll merge the changes, bump up the version, create a new release, and deploy to PyPI.

@wojcikstefan wojcikstefan merged commit 04819b9 into master May 8, 2017
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.

3 participants