Path Generator
A Python library for generating human-like mouse paths using PD (Proportional-Derivative) control.
Installation
Core Library
Install the core library (only requires numpy):
pip install pathgenerator
With Windows Emulator
Install with pywin32 for high-performance cursor emulation (Windows only):
pip install pathgenerator[windows]
With Server
Install with the optional FastAPI server:
pip install pathgenerator[server]
Usage
Human Motion Parameters
mouse_velocity: Base movement velocity (unitless, 0.1-1.0).kp_start/kp_end: Correction strength at start vs. end.stabilization: Damping factor to smooth out jitters (0.0-1.0).noise: Amount of random hand tremor (0.0-10.0+).overshoot_prob: Probability of overshooting the target and correcting (0.0-1.0).arc_strength: Tendency to move in a curved arc (0.0-0.5).keep_prob_start/keep_prob_end: Point density (drop probability) at start/end.offset_x/offset_y: Global offset added to all points.
Generating Paths
from pathgenerator import PDPathGenerator
gen = PDPathGenerator()
path, progress, steps, params = gen.generate_path(
start_x=100.0, start_y=100.0,
end_x=1800.0, end_y=900.0,
mouse_velocity=0.65,
noise=2.6,
offset_x=0, offset_y=0 # Optional viewport offset
)
Tuning Workflow (Server + JSON)
The easiest way to find realistic parameters is to use the interactive playground.
(Requires: pip install pathgenerator[server])
- Launch the server:
python -m pathgenerator.server
- Tune settings at
http://127.0.0.1:8001. - Download JSON: Click "Export Preset" to save your settings as
human_relaxed.json. - Load in Python:
# Initialize generator with your custom preset gen = PDPathGenerator("human_relaxed.json") # All generated paths will now use those settings by default path, *_ = gen.generate_path(100, 100, 500, 500)
Executing Paths (Windows Only)
The PathEmulator class includes a helper get_position() to simplify generating paths from your current mouse location.
from pathgenerator import PDPathGenerator, PathEmulator
# Requires: pip install pathgenerator[windows]
emulator = PathEmulator()
gen = PDPathGenerator()
# 1. Get current mouse position
start_x, start_y = emulator.get_position()
# 2. Generate path to target (e.g., 500, 500)
# calculate offset if you are targeting a window relative to screen 0,0
path, *_ = gen.generate_path(start_x, start_y, 500, 500)
# 3. Move the mouse (optional delay to control playback speed)
emulator.execute_path(path, delay_between_points=0.001)
Metadata
Release files for pathgenerator 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pathgenerator-0.1.2.tar.gz | 2.1 MB | Without provenance | Details for pathgenerator-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pathgenerator-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for pathgenerator-0.1.2-py3-none-any.whl |
Total release size: 2.1 MB
Release files / pathgenerator-0.1.2.tar.gz
| Download URL | pathgenerator-0.1.2.tar.gz |
|---|---|
| Size | 2.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c10e4637c679b0de104290dc57723a72a338ec79977b8b41af5348a37986475
|
|
BLAKE2b-256 checksum How to use checksums |
7a4fe87a9b470eebdeb404b447b4ec2dd1731b1af270280b41aef2861c888d29
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / pathgenerator-0.1.2-py3-none-any.whl
| Download URL | pathgenerator-0.1.2-py3-none-any.whl |
|---|---|
| Size | 24.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ca1393aa7067365da626080b8f30139393b3da89939db2bae8c9000167ed37c1
|
|
BLAKE2b-256 checksum How to use checksums |
ecf014b57ec458c13d8bc9fd8dca39d1a782d7a96e49ab815aaeaf1fe34d5aa7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for pathgenerator 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.