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

Remove gevent monkeypatching. #287

Closed
wants to merge 1 commit into from

Conversation

tomprince
Copy link

For somebody using this package as a library, it would be preferable to leave
whether to monkeypatch gevent into the standard library up to the user, rather
than forcing it on every consumer.

As far as I can tell, the only place that monkeypatching is used, is for
interacting with requests. The only place this is directly used by
the client is in steam.core.CMClient.boostrap_from_webapi, which is
only called on the initial connection. Letting that call be synchronous,
if the user doesn't want to use gevent directly seems reasonable.

For somebody using this package as a library, it would be preferable to leave
whether to monkeypatch gevent into the standard library up to the user, rather
than forcing it on every consumer.

As far as I can tell, the only place that monkeypatching is used, is for
interacting with requests. The only place this is *directly* used by
the client is in `steam.core.CMClient.boostrap_from_webapi`, which is
only called on the initial connection. Letting that call be synchronous,
if the user doesn't want to use gevent directly seems reasonable.
@rossengeorgiev
Copy link
Contributor

rossengeorgiev commented Sep 9, 2020

You are correct. I've been intending to remove monkey patch to make the code easier to use in conjunction with other libraries and features of python. That webapi call, and another webapi method, are the only places where library might need it. Of course the user could be using requests, but it would be more flexible to let them monkey patch if they need to.

@rossengeorgiev
Copy link
Contributor

This will also affect CDNClient, which uses requests

@ValvePython ValvePython deleted a comment from sonarcloud bot Dec 20, 2020
@tomwade
Copy link

tomwade commented Jan 13, 2021

Is it possible to re-run checks on this and look to merge? Would greatly benefit codebase


### steam.client

- Importing `steam.client` no longer automatically patches `socket or `ssl` to
Copy link

Choose a reason for hiding this comment

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

Missing a closing "`" on socket

@rossengeorgiev
Copy link
Contributor

I very much want this to happen, but I need to:

  1. Have this documented, so that people know they can use monkey patching to make standard library, and other libraries cooperative
  2. Figure out if I can make the various HTTP requests (like bootstrap, CDNClient) used under steam.client namespace cooperative by default.

@rossengeorgiev
Copy link
Contributor

Closing in favour of #364

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