Skip to main content

Human-like mouse movement library implementing the WindMouse algorithm for bot detection avoidance

Project description

WindMouse

codecov PyPI - Version License: MIT Documentation Status

WindMouse is a Python library that generates human-like mouse movements to avoid bot detection in automation scripts. It implements the WindMouse algorithm, which creates realistic, non-linear trajectories with variable speed—mimicking natural human mouse behavior.

Why WindMouse?

Traditional automation tools move the mouse in straight lines at constant speeds, making them easy to detect. WindMouse solves this by:

  • Generating curved, natural-looking paths instead of straight lines
  • Varying movement speed dynamically throughout the trajectory
  • 🎯 Supporting multiple backends: AutoHotkey (Windows) and PyAutoGUI (cross-platform)
  • 🧩 Offering fine-grained control over movement physics (gravity, wind, damping)

Perfect for web scraping, game automation, UI testing, or any scenario where you need to simulate realistic human interaction.


Demo

Demo Animation

Demonstration of the WindMouse algorithm in action.


Installation

Standard Installation

pip install windmouse

Modern Alternative (using uv)

uv add windmouse

Optional Dependencies

WindMouse supports multiple backends. Choose the one that fits your needs:

For PyAutoGUI (cross-platform):

pip install windmouse[pyautogui]
# or with uv:
uv add "windmouse[pyautogui]"

For AutoHotkey (Windows only):

pip install windmouse[ahk]
# or with uv:
uv add "windmouse[ahk]"

Install all backends:

pip install windmouse[all]
# or with uv:
uv add "windmouse[all]"

Note for Windows + AHK users: You must have AutoHotkey installed on your system to use the ahk backend.


Quick Start

Using PyAutoGUI (Cross-Platform)

from windmouse.pyautogui_controller import PyautoguiMouseController
from windmouse import Coordinate

# Initialize the controller
mouse = PyautoguiMouseController()

# Set destination coordinates
mouse.dest_position = (Coordinate(800), Coordinate(600))

# Move the mouse using WindMouse algorithm
mouse.move_to_target(
    tick_delay=0.005,      # Small delay between steps
    step_duration=0.1      # Duration of each movement step
)

Using AutoHotkey (Windows Only)

from ahk import AHK
from windmouse.ahk_controller import AHKMouseController
from windmouse import Coordinate

# Initialize AHK and controller
ahk = AHK()
mouse = AHKMouseController(ahk)

# Set destination coordinates
mouse.dest_position = (Coordinate(800), Coordinate(600))

# Move the mouse using WindMouse algorithm
mouse.move_to_target(
    tick_delay=0.005,
    step_duration=0.1
)

Advanced: Fine-Tuning the Algorithm

You can customize the physics of the mouse movement:

from windmouse.pyautogui_controller import PyautoguiMouseController
from windmouse import Coordinate

mouse = PyautoguiMouseController(
    gravity_magnitude=9,    # Strength of attraction to target (default: 9)
    wind_magnitude=3,       # Randomness/curvature of path (default: 3)
    max_step=15,            # Maximum speed (default: 15)
    damped_distance=12      # Distance where movement starts to slow (default: 12)
)

mouse.dest_position = (Coordinate(1000), Coordinate(500))
mouse.move_to_target()

Drag and Drop

Hold a mouse button while moving (useful for drag-and-drop operations):

from windmouse import HoldMouseButton

mouse.dest_position = (Coordinate(500), Coordinate(300))
mouse.move_to_target(hold_button=HoldMouseButton.LEFT)

Documentation

📖 Read the Full Documentation on ReadTheDocs

The documentation includes:

  • Detailed algorithm explanation and mathematical background
  • API reference for all classes and methods
  • Advanced usage examples and best practices
  • Performance tuning guide

Contributing

Contributions are welcome! Whether it's bug reports, feature requests, or pull requests—your input helps make WindMouse better.

To contribute:

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

Please ensure your code follows the project's style guidelines and includes appropriate tests.


License

This project is licensed under the MIT License. See the LICENSE file for details.


Acknowledgments

The WindMouse algorithm is inspired by research on human-computer interaction and originally designed to prevent bot detection in automation scenarios. This implementation brings that algorithm to the Python ecosystem with a clean, extensible API.

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

windmouse-1.0.0.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

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

windmouse-1.0.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file windmouse-1.0.0.tar.gz.

File metadata

  • Download URL: windmouse-1.0.0.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for windmouse-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5d2641f8ac50cc9c86c36439883bfe1f13301f0f83e348858fe986a295178799
MD5 24676af0278c9e8691ff7cd91dfad5be
BLAKE2b-256 cfc5d6813f035c74089eff7f54092632d00dc43ab965af08f5740930a6eadc36

See more details on using hashes here.

Provenance

The following attestation bundles were made for windmouse-1.0.0.tar.gz:

Publisher: publish.yml on AsfhtgkDavid/windmouse

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

File details

Details for the file windmouse-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: windmouse-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for windmouse-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fc38899012fbade88f41325611cdc53eb8d78d5fa91e46626c9d3b6c0c2ecadb
MD5 8a64dcfbaa43ffb4af4f28f80c66d4a6
BLAKE2b-256 1edfc604b867541d928fde3ed3602aeba2096b2d21652a824105fc88426e21b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for windmouse-1.0.0-py3-none-any.whl:

Publisher: publish.yml on AsfhtgkDavid/windmouse

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