PyADBKit is a Python library for interacting with Android devices using the Android Debug Bridge (ADB) protocol. It provides a high-level, asynchronous API for common ADB operations.
- Connect to and manage Android devices
- Execute shell commands on devices
- Install and uninstall applications
- Push and pull files
- Reboot devices
- Get device information
- And more...
You can install PyADBKit using pip:
pip install pyadbkit- Python 3.7+
- ADB (Android Debug Bridge) installed and accessible in your system PATH
Here's a quick example of how to use PyADBKit:
import asyncio
from pyadbkit import Client
async def main():
client = Client()
# List connected devices
devices = await client.devices()
print(f"Connected devices: {devices}")
# Execute a shell common
serial = devices[0]['serial'] # Use the first device
result = await client.shell(serial, 'ls /sdcard')
print(f"Files in /sdcard: {result}")
# Install an APK
await client.install(serial, 'path/to/your/app.apk')
print("App installed successfully")
asyncio.run(main())For more examples, check out the examples directory in the repository.
To set up the development environment:
-
Clone the repository:
git clone https://github.com/yourusername/pyadbkit.git cd pyadbkit -
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate` -
Install the development dependencies:
pip install -r requirements.txt
To run the tests:
pytest tests/To run code quality checks:
flake8 src/ tests/
mypy src/This project uses GitHub Actions for continuous integration. The CI pipeline runs automatically on every push and pull request to the main branch. It performs the following checks:
- Runs tests on multiple Python versions (3.7, 3.8, 3.9, 3.10)
- Runs code quality checks using flake8
- Runs type checking using mypy
You can view the CI configuration in the .github/workflows/ci.yml file.
Contributions are welcome! Please see the Contributing Guide for more details.
This project is licensed under the MIT License. See the LICENSE file for details.