Skip to content

Implement async functionality#47

Merged
Swind merged 3 commits into
Swind:masterfrom
JeffLIrion:async-pull-request
Aug 5, 2020
Merged

Implement async functionality#47
Swind merged 3 commits into
Swind:masterfrom
JeffLIrion:async-pull-request

Conversation

@JeffLIrion

@JeffLIrion JeffLIrion commented Jun 13, 2020

Copy link
Copy Markdown
Contributor

The code in this pull request has 100% test coverage.

$ coverage run --source ppadb -m unittest discover -s test_async/ -t . && coverage report -m | grep async
...............
----------------------------------------------------------------------
Ran 15 tests in 0.029s

OK
ppadb/client_async.py                             15      0   100%
ppadb/command/host_async/__init__.py              19      0   100%
ppadb/command/transport_async/__init__.py         29      0   100%
ppadb/connection_async.py                         68      0   100%
ppadb/device_async.py                             37      0   100%
ppadb/sync_async/__init__.py                      68      0   100%

@JeffLIrion

Copy link
Copy Markdown
Contributor Author

This would close #43

@JeffLIrion JeffLIrion force-pushed the async-pull-request branch 2 times, most recently from 8f54c44 to e7873bf Compare June 16, 2020 06:41
@JeffLIrion JeffLIrion force-pushed the async-pull-request branch from faedce8 to 1b7cfc0 Compare June 16, 2020 13:46
@JeffLIrion

Copy link
Copy Markdown
Contributor Author

I've tested this, it works. Is there anything I can do to push this along?

* Use aiofiles for file I/O

* Move all I/O out of the event loop

* Delete commented out code
@JeffLIrion

Copy link
Copy Markdown
Contributor Author

Could I please get some feedback on this pull request. I want to use this code in my androidtv package, but for the time being I've had to resort to wrapping the sync pure-python-adb commands with asyncio.get_current_loop().run_in_executor.

https://github.com/JeffLIrion/python-androidtv/blob/38a495e7b3197981ff3ca3a102b246f4bb056f8c/androidtv/adb_manager/adb_manager_async.py#L16-L54

@JeffLIrion

Copy link
Copy Markdown
Contributor Author

FYI, this pull request preserves the sync functionality and backwards compatibility of this package. I only modified one existing file in this repo -- setup.py -- and the change I made won't break anything. All of the async code is in new files, so it won't impact the existing sync code in any way. And doing pip install pure-python-adb still requires no third party packages to be installed.

Also, the async code works exactly the same as the sync code, the only difference being that all I/O is done using async functions.

And again, I've tested this code and it works.

@Swind

Swind commented Aug 5, 2020

Copy link
Copy Markdown
Owner

Hi @JeffLIrion

Sorry for the late reply,
I didn't receive the notification email about this pull request.
Thanks for your pull request !

@Swind Swind merged commit 98db67e into Swind:master Aug 5, 2020
Swind pushed a commit that referenced this pull request Aug 5, 2020
Release Note:

1. Merge Implement async functionality #47 by JeffLIrion
2. Merge Check the length of the screencap before indexing into it #53 by JeffLIrion
3. Remove python 2 support
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