Human-like mouse movement library implementing the WindMouse algorithm for bot detection avoidance
Project description
WindMouse
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
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
ahkbackend.
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:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'feat: Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - 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 GNU General Public License v3.0 (GPLv3).
Portions of this software are derived from the WindMouse reference implementation by Ben Land and have been refactored and modified.
Original work: https://ben.land/post/2021/04/25/windmouse-human-mouse-movement/
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
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 windmouse-1.0.2.tar.gz.
File metadata
- Download URL: windmouse-1.0.2.tar.gz
- Upload date:
- Size: 26.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7877f9e8bf0a4511d996e0bd7a80e7a1f66fed1ec9b3487c0caf837e2df8d92c
|
|
| MD5 |
4e26e49525efc4ee580aec5daeecd796
|
|
| BLAKE2b-256 |
3fc23ae355a81d97e97b9fc0ec9b215fc6ace498353077341cba239040ef7a46
|
Provenance
The following attestation bundles were made for windmouse-1.0.2.tar.gz:
Publisher:
publish.yml on AsfhtgkDavid/windmouse
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
windmouse-1.0.2.tar.gz -
Subject digest:
7877f9e8bf0a4511d996e0bd7a80e7a1f66fed1ec9b3487c0caf837e2df8d92c - Sigstore transparency entry: 833807683
- Sigstore integration time:
-
Permalink:
AsfhtgkDavid/windmouse@25a66926ad43cbcac2990e6812009163428c6aa7 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/AsfhtgkDavid
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@25a66926ad43cbcac2990e6812009163428c6aa7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file windmouse-1.0.2-py3-none-any.whl.
File metadata
- Download URL: windmouse-1.0.2-py3-none-any.whl
- Upload date:
- Size: 20.5 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 |
c0d7dd4734f7a474b9a8bfa4595b38bd7028d4c02c71bdb74be1a4cec15ad5ff
|
|
| MD5 |
aa5b626326fbc759ef9866b5dae3dcca
|
|
| BLAKE2b-256 |
b1025036b53673d14752385e1ab71d5d00f71a3f8edb98711303acd9a75ecd28
|
Provenance
The following attestation bundles were made for windmouse-1.0.2-py3-none-any.whl:
Publisher:
publish.yml on AsfhtgkDavid/windmouse
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
windmouse-1.0.2-py3-none-any.whl -
Subject digest:
c0d7dd4734f7a474b9a8bfa4595b38bd7028d4c02c71bdb74be1a4cec15ad5ff - Sigstore transparency entry: 833807686
- Sigstore integration time:
-
Permalink:
AsfhtgkDavid/windmouse@25a66926ad43cbcac2990e6812009163428c6aa7 -
Branch / Tag:
refs/tags/v1.0.2 - Owner: https://github.com/AsfhtgkDavid
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@25a66926ad43cbcac2990e6812009163428c6aa7 -
Trigger Event:
release
-
Statement type: