{ "info": { "author": "Swind Ou", "author_email": "swind@cloudmosa.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Topic :: Software Development :: Testing" ], "description": "The package name has been renamed from 'adb' to 'ppadb'\n=========================================================\n\nFrom version **v0.2.1-dev**, the package name has been renamed from 'adb' to 'ppadb' to avoid conflit with Google `google/python-adb`_\n\n\nIntroduction\n==================\n\nThis is pure-python implementation of the ADB client.\n\nYou can use it to communicate with adb server (not the adb daemon on the device/emulator).\n\nWhen you use `adb` command\n\n.. image:: https://raw.githubusercontent.com/Swind/pure-python-adb/master/docs/adb_cli.png\n\nNow you can use `pure-python-adb` to connect to adb server as adb command line\n\n.. image:: https://raw.githubusercontent.com/Swind/pure-python-adb/master/docs/adb_pure_python_adb.png\n\nThis package supports most of the adb command line tool's functionality.\n\n1. adb devices\n2. adb shell\n3. adb forward\n4. adb pull/push\n5. adb install/uninstall\n\nRequirements\n============\n\nPython 2.7+ / Python 3.6+\n\nInstallation\n============\n\n.. code-block:: console\n\n $pip install -U pure-python-adb\n\nExamples\n========\n\nConnect to adb server and get the version\n-----------------------------------------\n\n.. code-block:: python\n\n from ppadb.client import Client as AdbClient\n # Default is \"127.0.0.1\" and 5037\n client = AdbClient(host=\"127.0.0.1\", port=5037)\n print(client.version())\n\n >>> 39\n\nConnect to a device\n-------------------\n\n.. code-block:: python\n\n from ppadb.client import Client as AdbClient\n # Default is \"127.0.0.1\" and 5037\n client = AdbClient(host=\"127.0.0.1\", port=5037)\n device = client.device(\"emulator-5554\")\n\n\nList all devices ( adb devices ) and install/uninstall an APK on all devices\n----------------------------------------------------------------------------\n\n.. code-block:: python\n\n from ppadb.client import Client as AdbClient\n\n apk_path = \"example.apk\"\n\n # Default is \"127.0.0.1\" and 5037\n client = AdbClient(host=\"127.0.0.1\", port=5037)\n devices = client.devices()\n\n for device in devices:\n device.install(apk_path)\n\n # Check apk is installed\n for device in devices:\n print(device.is_installed(\"example.package\"))\n\n # Uninstall\n for device in devices:\n device.uninstall(\"example.package)\n\nadb shell\n---------\n\n.. code-block:: python\n\n from ppadb.client import Client as AdbClient\n # Default is \"127.0.0.1\" and 5037\n client = AdbClient(host=\"127.0.0.1\", port=5037)\n device = client.device(\"emulator-5554\")\n device.shell(\"echo hello world !\")\n\n.. code-block:: python\n\n def dump_logcat(connection):\n while True:\n data = connection.read(1024)\n if not data:\n break\n print(data.decode('utf-8'))\n\n connection.close()\n\n from ppadb.client import Client as AdbClient\n # Default is \"127.0.0.1\" and 5037\n client = AdbClient(host=\"127.0.0.1\", port=5037)\n device = client.device(\"emulator-5554\")\n device.shell(\"logcat\", handler=dump_logcat)\n\nread logcat line by line\n\n.. code-block:: python\n\n from ppadb.client import Client\n\n def dump_logcat_by_line(connect):\n file_obj = connect.socket.makefile()\n for index in range(0, 10):\n print(\"Line {}: {}\".format(index, file_obj.readline().strip()))\n\n file_obj.close()\n connect.close()\n\n client = Client()\n device = client.device(\"emulator-5554\")\n device.shell(\"logcat\", handler=dump_logcat_by_line)\n\nScreenshot\n----------\n\n.. code-block:: python\n\n from ppadb.client import Client as AdbClient\n client = AdbClient(host=\"127.0.0.1\", port=5037)\n device = client.device(\"emulator-5554\")\n result = device.screencap()\n with open(\"screen.png\", \"wb\") as fp:\n fp.write(result)\n\nPush file or folder\n--------------------\n\n.. code-block:: python\n\n from ppadb.client import Client as AdbClient\n client = AdbClient(host=\"127.0.0.1\", port=5037)\n device = client.device(\"emulator-5554\")\n\n device.push(\"example.apk\", \"/sdcard/example.apk\")\n\nPull\n----\n\n.. code-block:: python\n\n from ppadb.client import Client as AdbClient\n client = AdbClient(host=\"127.0.0.1\", port=5037)\n device = client.device(\"emulator-5554\")\n\n device.shell(\"screencap -p /sdcard/screen.png\")\n device.pull(\"/sdcard/screen.png\", \"screen.png\")\n\n\nEnable debug logger\n--------------------\n\n.. code-block:: python\n\n logging.getLogger(\"ppadb\").setLevel(logging.DEBUG)\n\n\nHow to run test cases\n======================\n\nPrepare\n--------\n\n1. Install Docker\n\n2. Install Docker Compose\n\n.. code-block:: console\n\n pip install docker-compose\n\n3. Modify `test/conftest.py`\n\nChange the value of `adb_host` to the \"emulator\"\n\n.. code-block:: python\n\n adb_host=\"emulator\"\n\n4. Run testcases\n\n.. code-block:: console\n\n docker-compose up\n\nResult\n\n.. code-block:: console\n\n Starting purepythonadb_emulator_1 ... done\n Recreating purepythonadb_python_environment_1 ... done\n Attaching to purepythonadb_emulator_1, purepythonadb_python_environment_1\n emulator_1 | + echo n\n emulator_1 | + /home/user/android-sdk-linux/tools/bin/avdmanager create avd -k system-images;android-25;google_apis;x86 -n Docker -b x86 -g google_apis --device 8 --force\n Parsing /home/user/android-sdk-linux/emulator/package.xmlParsing /home/user/android-sdk-linux/patcher/v4/package.xmlParsing /home/user/android-sdk-linux/platform-tools/package.xmlParsing /home/user/android-sdk-linux/platforms/android-25/package.xmlParsing /home/user/android-sdk-linux/system-images/android-25/google_apis/x86/package.xmlParsing /home/user/android-sdk-linux/tools/package.xml+ echo hw.keyboard = true\n emulator_1 | + adb start-server\n emulator_1 | * daemon not running; starting now at tcp:5037\n python_environment_1 | ============================= test session starts ==============================\n python_environment_1 | platform linux -- Python 3.6.1, pytest-3.6.3, py-1.5.4, pluggy-0.6.0\n python_environment_1 | rootdir: /code, inifile:\n python_environment_1 | collected 27 items\n python_environment_1 |\n emulator_1 | * daemon started successfully\n emulator_1 | + exec /usr/bin/supervisord\n emulator_1 | /usr/lib/python2.7/dist-packages/supervisor/options.py:298: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a \"-c\" argument specifying an absolute path to a configuration file for improved security.\n emulator_1 | 'Supervisord is running as root and it is searching '\n emulator_1 | 2018-07-07 17:19:47,560 CRIT Supervisor running as root (no user in config file)\n emulator_1 | 2018-07-07 17:19:47,560 INFO Included extra file \"/etc/supervisor/conf.d/supervisord.conf\" during parsing\n emulator_1 | 2018-07-07 17:19:47,570 INFO RPC interface 'supervisor' initialized\n emulator_1 | 2018-07-07 17:19:47,570 CRIT Server 'unix_http_server' running without any HTTP authentication checking\n emulator_1 | 2018-07-07 17:19:47,570 INFO supervisord started with pid 1\n emulator_1 | 2018-07-07 17:19:48,573 INFO spawned: 'socat-5554' with pid 74\n emulator_1 | 2018-07-07 17:19:48,574 INFO spawned: 'socat-5555' with pid 75\n emulator_1 | 2018-07-07 17:19:48,576 INFO spawned: 'socat-5037' with pid 76\n emulator_1 | 2018-07-07 17:19:48,578 INFO spawned: 'novnc' with pid 77\n emulator_1 | 2018-07-07 17:19:48,579 INFO spawned: 'socat-9008' with pid 78\n emulator_1 | 2018-07-07 17:19:48,582 INFO spawned: 'emulator' with pid 80\n emulator_1 | 2018-07-07 17:19:49,607 INFO success: socat-5554 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)\n emulator_1 | 2018-07-07 17:19:49,607 INFO success: socat-5555 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)\n emulator_1 | 2018-07-07 17:19:49,607 INFO success: socat-5037 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)\n emulator_1 | 2018-07-07 17:19:49,607 INFO success: novnc entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)\n emulator_1 | 2018-07-07 17:19:49,608 INFO success: socat-9008 entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)\n emulator_1 | 2018-07-07 17:19:49,608 INFO success: emulator entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)\n python_environment_1 | test/test_device.py .............. [ 51%]\n python_environment_1 | test/test_host.py .. [ 59%]\n python_environment_1 | test/test_host_serial.py ........ [ 88%]\n python_environment_1 | test/test_plugins.py ... [100%]\n python_environment_1 |\n python_environment_1 | ------------------ generated xml file: /code/test_result.xml -------------------\n python_environment_1 | ========================= 27 passed in 119.15 seconds ==========================\n purepythonadb_python_environment_1 exited with code 0\n Aborting on container exit...\n Stopping purepythonadb_emulator_1 ... done\n\nMore Information\n=================\n\nA pure Node.js client for the Android Debug Bridge\n---------------------------------------------------\n\nadbkit_\n\nADB documents\n--------------\n\n- protocol_\n- services_\n- sync_\n\n.. _adbkit: https://github.com/openstf/stf\n.. _protocol: https://android.googlesource.com/platform/system/core/+/master/adb/protocol.txt\n.. _services: https://android.googlesource.com/platform/system/core/+/master/adb/SERVICES.TXT\n.. _sync: https://android.googlesource.com/platform/system/core/+/master/adb/SYNC.TXT\n.. _`google/python-adb`: https://github.com/google/python-adb\n\n\n0.2.1 (2019-10-14)\n--------------------\n\n* Fixes #21: Rename the package name from \"adb\" to \"ppadb\"\n* Fixes #23: Support push dir to device\n* Fixes #25: Don't call logging.basicConfig() in the module\n\n\n0.1.6 (2019-01-21)\n-------------------\n\n* Fix #4 push does not preserve original timestap unlike equiv adb push from command line\n* Fix #6 forward_list should also check serial\n* Fix #8: adb/command/host/__init__.py can take an exception parsing \"devices\" data\n\n\n0.1.0 (2018-06-23)\n-------------------\n\n* First release on PyPI.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Swind/pure-python-adb", "keywords": "adb", "license": "MIT license", "maintainer": "", "maintainer_email": "", "name": "pure-python-adb", "package_url": "https://pypi.org/project/pure-python-adb/", "platform": "", "project_url": "https://pypi.org/project/pure-python-adb/", "project_urls": { "Homepage": "https://github.com/Swind/pure-python-adb" }, "release_url": "https://pypi.org/project/pure-python-adb/0.2.2.dev0/", "requires_dist": null, "requires_python": "", "summary": "Pure python implementation of the adb client", "version": "0.2.2.dev0" }, "last_serial": 5970168, "releases": { "0.1.1.dev0": [ { "comment_text": "", "digests": { "md5": "1b30aaa875912015a0bf28bc51a27160", "sha256": "d5ee923a37ad48629f401b29d790199f52477ab3c5fd0812828d526dfce98312" }, "downloads": -1, "filename": "pure-python-adb-0.1.1.dev0.tar.gz", "has_sig": false, "md5_digest": "1b30aaa875912015a0bf28bc51a27160", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12122, "upload_time": "2018-06-28T07:01:13", "url": "https://files.pythonhosted.org/packages/9c/c1/5274c9242475c88ad1cd292ed7f94a831b171dcd989ab3172a38dc9ea122/pure-python-adb-0.1.1.dev0.tar.gz" } ], "0.1.2.dev0": [ { "comment_text": "", "digests": { "md5": "6f2929daf263252b688b01edafb0326c", "sha256": "e683584f7297fb0c4c4379979cd38b5a83938edbb7b2ba61d05f02bf229e3b2e" }, "downloads": -1, "filename": "pure-python-adb-0.1.2.dev0.tar.gz", "has_sig": false, "md5_digest": "6f2929daf263252b688b01edafb0326c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12118, "upload_time": "2018-06-28T07:53:37", "url": "https://files.pythonhosted.org/packages/9d/cd/fc83e36f5ada75b118b8cd68d322d7433069a6972106db160b67b3e4fc43/pure-python-adb-0.1.2.dev0.tar.gz" } ], "0.1.3.dev0": [ { "comment_text": "", "digests": { "md5": "d3c1a797cd89802ba7f8c8c606af0de9", "sha256": "9256549336001e9a67a5cc5041d0777ff2d59368779a613d636f36fecb2ae4bd" }, "downloads": -1, "filename": "pure-python-adb-0.1.3.dev0.tar.gz", "has_sig": false, "md5_digest": "d3c1a797cd89802ba7f8c8c606af0de9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12128, "upload_time": "2018-07-04T06:57:57", "url": "https://files.pythonhosted.org/packages/ba/87/c6b5bc6f4b0d3064365b66b354e30c08fb971bdbc792c9c61ce8204d3375/pure-python-adb-0.1.3.dev0.tar.gz" } ], "0.1.4.dev0": [ { "comment_text": "", "digests": { "md5": "8f5e2d6bbc903294d9fa2317977a9740", "sha256": "6c370b458aea065ab4a490f357f1d58382f84556213b8e65b96adfe9b74487e6" }, "downloads": -1, "filename": "pure-python-adb-0.1.4.dev0.tar.gz", "has_sig": false, "md5_digest": "8f5e2d6bbc903294d9fa2317977a9740", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12236, "upload_time": "2018-07-04T08:17:33", "url": "https://files.pythonhosted.org/packages/fe/e9/d58d1d74568d2a9c46c05f78f8a82ed8cd9f8ae1149df4959137c5b2ce05/pure-python-adb-0.1.4.dev0.tar.gz" } ], "0.1.5.dev0": [ { "comment_text": "", "digests": { "md5": "012e644ca56fecd612c462c95fd6250f", "sha256": "29f2e69a13e8c9d72640db62c759466308356fef940c245b782a3d4a2cac69ae" }, "downloads": -1, "filename": "pure-python-adb-0.1.5.dev0.tar.gz", "has_sig": false, "md5_digest": "012e644ca56fecd612c462c95fd6250f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12429, "upload_time": "2018-07-04T08:50:11", "url": "https://files.pythonhosted.org/packages/bb/c9/45d03fba8adf0facfd0c26f5add3643eebaa93d9ea78ad5c3261bb7dd4fe/pure-python-adb-0.1.5.dev0.tar.gz" } ], "0.1.6.dev0": [ { "comment_text": "", "digests": { "md5": "daeb475151dda40274ad73d5dfab9563", "sha256": "b604bd6ac935a957daf66d6936fc7d781cbabdf97e52c82f7b790b55256d347a" }, "downloads": -1, "filename": "pure-python-adb-0.1.6.dev0.tar.gz", "has_sig": false, "md5_digest": "daeb475151dda40274ad73d5dfab9563", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17262, "upload_time": "2019-01-20T17:08:27", "url": "https://files.pythonhosted.org/packages/a6/c1/b46f9253b251ebf544039835427939a5842abfa19890ac0a5aee4b17b895/pure-python-adb-0.1.6.dev0.tar.gz" } ], "0.1.7.dev0": [ { "comment_text": "", "digests": { "md5": "a386d0ee786a52f022b4452a39f1d4bf", "sha256": "1ab9db40471bfecbaecb24ee91e129834c58d57f90ebe767b276bd43b6d89998" }, "downloads": -1, "filename": "pure-python-adb-0.1.7.dev0.tar.gz", "has_sig": false, "md5_digest": "a386d0ee786a52f022b4452a39f1d4bf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18034, "upload_time": "2019-06-26T11:22:53", "url": "https://files.pythonhosted.org/packages/e9/e3/272f4acff8b05b83e524cbbf22812815db3aa9b67ca3e689922c8db03253/pure-python-adb-0.1.7.dev0.tar.gz" } ], "0.2.2.dev0": [ { "comment_text": "", "digests": { "md5": "41663989992cdc8063f13666c5a53533", "sha256": "eaf3dfae61f9f87080fa33d22d03ba369f11c0af7a642b0a7a64f98e98d92ff6" }, "downloads": -1, "filename": "pure-python-adb-0.2.2.dev0.tar.gz", "has_sig": false, "md5_digest": "41663989992cdc8063f13666c5a53533", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23104, "upload_time": "2019-10-14T07:00:15", "url": "https://files.pythonhosted.org/packages/8e/23/4cbd9cd96de52758f1d38db1934340bd1c4241cc031adcbce7ceea80af56/pure-python-adb-0.2.2.dev0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "41663989992cdc8063f13666c5a53533", "sha256": "eaf3dfae61f9f87080fa33d22d03ba369f11c0af7a642b0a7a64f98e98d92ff6" }, "downloads": -1, "filename": "pure-python-adb-0.2.2.dev0.tar.gz", "has_sig": false, "md5_digest": "41663989992cdc8063f13666c5a53533", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23104, "upload_time": "2019-10-14T07:00:15", "url": "https://files.pythonhosted.org/packages/8e/23/4cbd9cd96de52758f1d38db1934340bd1c4241cc031adcbce7ceea80af56/pure-python-adb-0.2.2.dev0.tar.gz" } ] }