Skip to main content

Modern macOS GUI automation library for Python

Project description

PyAutoX

Modern macOS GUI Automation for Python

Python Version License macOS

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 dimensions
  • screenshot(region=None) - Capture screen or region

Mouse

  • position() - Get current mouse position
  • moveTo(x, y, duration=0) - Move mouse to coordinates
  • click(x=None, y=None, clicks=1, interval=0, button='left') - Click mouse
  • doubleClick() - Double click
  • rightClick() - Right click

Keyboard

  • press(key) - Press and release a key
  • keyDown(key) - Press a key down
  • keyUp(key) - Release a key
  • typewrite(text, interval=0) - Type text

Location

  • locateOnScreen(image, confidence=0.9) - Find image on screen
  • locateAllOnScreen(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.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.

Acknowledgments

Contact


Made with love for the macOS Python community

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyautox-0.1.0.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyautox-0.1.0-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

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

Hashes for pyautox-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e0280d0b681fae6bd2d149f2e6f491c3eb470e91ce8af26253798ec7d40d9c9d
MD5 2736f6b80fe63c9ae131113dff13954d
BLAKE2b-256 15fa49c12d1ed0b563854f7fde05992e79e53265363c94db4645595ac83c63e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyautox-0.1.0.tar.gz:

Publisher: publish.yml on VoyagerTechHQ/pyautox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for pyautox-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 29db20ece12fc9b881236494d8bf619cc0e1f88121bd2ae5f3f4466ff3e56876
MD5 fac666f77aa14a108f04378bc30a20c5
BLAKE2b-256 428c19af35d1cb8fe23f90d02b93b6de88d5d9a511d929c66af835ac5b61aeae

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyautox-0.1.0-py3-none-any.whl:

Publisher: publish.yml on VoyagerTechHQ/pyautox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page