{"id":15712918,"url":"https://github.com/kaluluosi/async-adbc","last_synced_at":"2025-07-16T22:35:14.724Z","repository":{"id":165855802,"uuid":"640115531","full_name":"kaluluosi/async-adbc","owner":"kaluluosi","description":"async-adbc is a pure python ADB Client implement with usefull utils.","archived":false,"fork":false,"pushed_at":"2025-06-28T12:39:23.000Z","size":41914,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-28T12:56:35.906Z","etag":null,"topics":["adb","adbc","android","performance","python","python-adb"],"latest_commit_sha":null,"homepage":"https://kaluluosi.github.io/async-adbc/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kaluluosi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-05-13T03:33:07.000Z","updated_at":"2025-06-23T08:54:12.000Z","dependencies_parsed_at":"2024-10-03T21:20:40.686Z","dependency_job_id":"11d0e371-51b4-43c8-aece-61bfcf443009","html_url":"https://github.com/kaluluosi/async-adbc","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/kaluluosi/async-adbc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaluluosi%2Fasync-adbc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaluluosi%2Fasync-adbc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaluluosi%2Fasync-adbc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaluluosi%2Fasync-adbc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaluluosi","download_url":"https://codeload.github.com/kaluluosi/async-adbc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaluluosi%2Fasync-adbc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262605592,"owners_count":23335888,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adb","adbc","android","performance","python","python-adb"],"created_at":"2024-10-03T21:20:30.679Z","updated_at":"2025-07-03T22:07:40.092Z","avatar_url":"https://github.com/kaluluosi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# async-adbc\n\n[![Test-测试](https://github.com/kaluluosi/async-adbc/actions/workflows/test.yml/badge.svg)](https://github.com/kaluluosi/async-adbc/actions/workflows/test.yml)\n\n\nADBC是ADB Client的纯python异步实现，ADBC直接跟ADB Server通信不需要靠进程调用命令行来执行ADB命令。\n有以下特性：\n1. 支持async/await和同步调用\n2. 封装了一些性能测试相关的方法，供性能采集工具使用\n3. 以`service（服务）`为单位封装命令方法，能够跟 `adb`和`android shell`命令更加一致。\n\n\n## 安装\n\n```shell\npip install async-adbc\n```\n## 快速入门\n\n### 使用`ADBClient`\n`ADBClient`对应的是`adb`命令\n\n\u003e**note**\n\u003e当连接设备只有一个的时候，`adb`命令可以省略`-s \u003cserialno\u003e`，但是`ADBClient`不会包含这种默认设备的命令方法。因为`async-adbc`认为`adb`和`device`应该职责分明不应有太多的潜规则。因此用户想要操作某个设备一定要使用`Device`对象下的方法，`Device`下的方法相当于是帮我们默认传递了`-s \u003cserialno\u003e`。\n\n```python\nfrom async_adbc import ADBClient\n\nadbc = ADBClient() # 默认连接 127.0.0.1:5037 ，也就是本机的adb server\nversion = awaitadbc.version() # 对应 `adb version`\nprint(version)\n\n# 获取Android设备对象，对应 `adb devices`\ndevices = adbc.devices()\nfor device in devices:\n    print(device.serialno)\n```\n\n### 使用`Device`\n`Device`对象是对Android设备的抽象，所有需要指定 `-s \u003cserialno\u003e` 的操作都被封装到 `Device` 类中。\n\n```python\nfrom async_adbc import ADBClient\n\nadbc = ADBClient()\n\n# 获取Android设备对象，对应 `adb devices`\ndefault_device = adbc.device() # 获取 `adb devices` 的第一个设备\n\nproduct_model = await defualt_device.prop.get(\"ro.product.model\")\nprint(product_model)\n\n# `device.pm` 对应 `adb shell pm`\npackages = await default_device.pm.list_packages()\nprint(packages)\n\n# `device.shell` 对应 `adb shell`\nret = await default_device.shell(\"echo hello\")\nprint(ret)\n\n# 封装了 `fps` ，用来获取安卓游戏的帧率，方案参考了`solopi`\nfps_stat = await default_device.fps.stat(\"PKG_NAME\")\nprint(fps_stat)\n\n# 封装了 `mem`，用来获取安卓设备的内存信息\nmem_stat = await default_device.mem.stat(\"PKB_NAME\")\nprint(mem_stat)\n\n# 还有流量、温度等等工具的封装...\n```\n\n\n## 参考\n1. adb协议 https://github.com/kaluluosi/adbDocumentation/blob/master/README.zh-cn.md\n2. ppadb https://github.com/Swind/pure-python-adb\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaluluosi%2Fasync-adbc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaluluosi%2Fasync-adbc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaluluosi%2Fasync-adbc/lists"}