Skip to main content

Automated mouse clicking script

Project description

clickpy

Automated mouse clicker script.

Installation

I've only tested this packag with Python 3.9. You'll need to download and install it, or use pyenv and set your local version with this command:

pyenv local 3.9

I also recommend using pipx for installing standalone packages, as it will add a layer of isolation to your installation. But pip will work too:

pipx install clickpy
# -- or --
pip install clickpy

Development

Using Poetry to manage the virtual environment and packages. I also highly recommend using Pyenv to install and manage your python interpreters.

This script uses pyautogui for clicking and Typer for CLI parsing.

Testing

This project utilizes pytest and pytest-mock. Both should be included in pyproject.toml dev dependencies, and .vscode/settings.json should already be setup to use these libraries.

Please type annotate any mocks used, which should be MockerFixture if you use pytest-mock.

Scripts

The following is for developers. You don't need to run these scripts to install and run from pip.

# define your local python version
pyenv local 3.9.6
# install all deps from pyproject.toml
poetry install

To run clickpy with poetry. This will activate the virtualenv, and then run the script defined in [tool.poetry.scripts] in pyproject.toml.

poetry run clickpy

TODO: might look into tox later, also pre-commit looks interesting.

# activate virtual environment first
poetry shell
# run tests, also outputs code coverage
pytest -v --cov=clickpy tests/

# -- or --

# run this outside virtualenv
poetry run pytest -v --cov=clickpy tests/
# run tox tests
poetry env tox

# -- or --
poetry shel
tox

# you may need to run this command, if pyautogui throws errors
touch ~/.Xauthority
# run this to generate report
coverage html
# open html coverage
open htmlcov/index.html

# -- or --

# for windows, opening html coverage
start htmlcov/index.html

Open coverage report in bash. This should also work with Windows Git Bash

# open html coverage doc, windows doesn't have open.
[ -x "$(command -v open)" ] && open htmlcov/index.html || start htmlcov/index.html
# same command for fish shell
[ -x (command -v open) ] && open htmlcov/index.html || start htmlcov/index.html

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

clickpy-0.5.1a0.tar.gz (4.5 kB view hashes)

Uploaded source

Built Distribution

clickpy-0.5.1a0-py3-none-any.whl (5.0 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page