Modern macOS GUI automation library for Python
Project description
PyAutoX
Modern macOS GUI Automation for Python
PyAutoX is a modern, fast, and reliable GUI automation library specifically designed for macOS. It provides a clean Python API for controlling the mouse, keyboard, and screen, with 100% compatibility with PyAutoGUI's interface.
Why PyAutoX?
PyAutoGUI has been stagnant for 4+ years and has poor macOS support. PyAutoX is built from the ground up for macOS, using native APIs for maximum reliability and performance.
Key Features
- macOS Native: Uses Quartz Event Services and Core Graphics for 95%+ reliability
- Modern & Fast: Built with async/await support and type hints
- 100% Compatible: Drop-in replacement for PyAutoGUI on macOS
- Focused: Specialized for macOS, not a cross-platform compromise
- Active Development: Regularly maintained and updated
Comparison
| Feature | PyAutoGUI | PyAutoX |
|---|---|---|
| macOS Reliability | ~60% | 95%+ |
| Native APIs | No | Quartz + Core Graphics |
| Async Support | No | Yes |
| Type Hints | No | Yes |
| Last Updated | 2020 | Active |
| macOS Focused | No | Yes |
Quick Start
Installation
# Install using uv (recommended)
uv pip install pyautox
# Or using pip
pip install pyautox
Basic Usage
import pyautox as ag
# Initialize
ag.init()
# Get screen size
width, height = ag.size()
print(f"Screen: {width}x{height}")
# Move mouse to center
ag.moveTo(width // 2, height // 2, duration=1.0)
# Click
ag.click()
# Type text
ag.typewrite("Hello from PyAutoX!", interval=0.05)
# Take screenshot
screenshot = ag.screenshot()
screenshot.save("screenshot.png")
# Locate image on screen
button_location = ag.locateOnScreen("button.png")
if button_location:
ag.click(button_location.left, button_location.top)
Documentation
Core Functions
Screen
size()- Get screen dimensionsscreenshot(region=None)- Capture screen or region
Mouse
position()- Get current mouse positionmoveTo(x, y, duration=0)- Move mouse to coordinatesclick(x=None, y=None, clicks=1, interval=0, button='left')- Click mousedoubleClick()- Double clickrightClick()- Right click
Keyboard
press(key)- Press and release a keykeyDown(key)- Press a key downkeyUp(key)- Release a keytypewrite(text, interval=0)- Type text
Location
locateOnScreen(image, confidence=0.9)- Find image on screenlocateAllOnScreen(image, confidence=0.9)- Find all matches
Architecture
PyAutoX uses a three-layer architecture:
┌─────────────────────────────────────────────────────────┐
│ User API Layer (pyautox/__init__.py) │
│ PyAutoGUI-compatible functions │
└────────────────────┬────────────────────────────────────┘
│
┌────────────────────▼────────────────────────────────────┐
│ Core Layer (pyautox/core/automation_core.py) │
│ Backend management, async/sync handling │
└────────────────────┬────────────────────────────────────┘
│
┌────────────────────▼────────────────────────────────────┐
│ Backend Layer (pyautox/backends/macos_backend.py) │
│ macOS-specific implementation using native APIs │
└────────────────────┬────────────────────────────────────┘
│
┌──────▼──────┐
│ macOS API │
└─────────────┘
Development
Prerequisites
- Python 3.10+
- macOS 10.14+
- uv (recommended) or pip
Setup
# Clone the repository
git clone https://github.com/VoyagerTechHQ/pyautox.git
cd pyautox
# Create virtual environment
uv venv
source .venv/bin/activate
# Install in development mode
uv pip install -e ".[locate]"
# Run tests
pytest
Project Structure
pyautox/
├── pyautox/ # Main package
│ ├── __init__.py # User API
│ ├── core/ # Core logic
│ │ ├── automation_core.py
│ │ ├── backend_base.py
│ │ └── types.py
│ └── backends/ # Platform backends
│ └── macos_backend.py
├── examples/ # Example scripts
├── tests/ # Test suite
├── pyproject.toml # Project configuration
└── README.md
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.
Acknowledgments
Contact
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Made with love for the macOS Python community
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyautox-0.1.0.tar.gz.
File metadata
- Download URL: pyautox-0.1.0.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0280d0b681fae6bd2d149f2e6f491c3eb470e91ce8af26253798ec7d40d9c9d
|
|
| MD5 |
2736f6b80fe63c9ae131113dff13954d
|
|
| BLAKE2b-256 |
15fa49c12d1ed0b563854f7fde05992e79e53265363c94db4645595ac83c63e7
|
Provenance
The following attestation bundles were made for pyautox-0.1.0.tar.gz:
Publisher:
publish.yml on VoyagerTechHQ/pyautox
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyautox-0.1.0.tar.gz -
Subject digest:
e0280d0b681fae6bd2d149f2e6f491c3eb470e91ce8af26253798ec7d40d9c9d - Sigstore transparency entry: 956484038
- Sigstore integration time:
-
Permalink:
VoyagerTechHQ/pyautox@cc4533cd399cd189f6e09f527fb8e3b1d273bf80 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/VoyagerTechHQ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cc4533cd399cd189f6e09f527fb8e3b1d273bf80 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyautox-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pyautox-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29db20ece12fc9b881236494d8bf619cc0e1f88121bd2ae5f3f4466ff3e56876
|
|
| MD5 |
fac666f77aa14a108f04378bc30a20c5
|
|
| BLAKE2b-256 |
428c19af35d1cb8fe23f90d02b93b6de88d5d9a511d929c66af835ac5b61aeae
|
Provenance
The following attestation bundles were made for pyautox-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on VoyagerTechHQ/pyautox
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyautox-0.1.0-py3-none-any.whl -
Subject digest:
29db20ece12fc9b881236494d8bf619cc0e1f88121bd2ae5f3f4466ff3e56876 - Sigstore transparency entry: 956484040
- Sigstore integration time:
-
Permalink:
VoyagerTechHQ/pyautox@cc4533cd399cd189f6e09f527fb8e3b1d273bf80 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/VoyagerTechHQ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cc4533cd399cd189f6e09f527fb8e3b1d273bf80 -
Trigger Event:
release
-
Statement type: