Installation Guide๏ƒ

This guide covers all the ways to install the Makcu Python library and get started with controlling your Makcu device.

Requirements๏ƒ

System Requirements:

  • Python 3.7 or higher

  • Windows, macOS, or Linux

  • USB port for device connection

Python Dependencies:

The Makcu library automatically installs these dependencies:

  • pyserial - Serial communication

  • asyncio - Async support (Python 3.7+)

Installation Methods๏ƒ

Install Specific Version๏ƒ

To install a specific version:

# Install latest v2.x
pip install "makcu>=2.0.0,<3.0.0"

# Install exact version
pip install makcu==2.3.1

From Source (Development)๏ƒ

For development or the latest features:

# Clone the repository
git clone https://github.com/SleepyTotem/makcu-py-lib
cd makcu-py-lib

# Install in development mode
pip install -e .

Development Installation with Dependencies:

# Install with development dependencies
pip install -e .[dev]

# Or install test dependencies
pip install -e .[test]

Virtual Environment Setup๏ƒ

Using conda๏ƒ

# Create conda environment
conda create -n makcu-env python=3.9
conda activate makcu-env

# Install makcu
pip install makcu

Docker Installation๏ƒ

For containerized applications:

FROM python:3.9-slim

# Install makcu
RUN pip install makcu

# Your application code
COPY . /app
WORKDIR /app

CMD ["python", "your_app.py"]

Note: USB device access in Docker requires additional configuration:

# Run with device access
docker run --device=/dev/ttyUSB0 your-image

Post-Installation Setup๏ƒ

Device Connection๏ƒ

After installation, connect your Makcu device:

  1. Plug in your Makcu device via USB

  2. Windows will automatically install drivers

  3. The device appears as a COM port (Windows) or /dev/tty* (Linux/macOS)

Verify Device Connection:

from makcu import create_controller

try:
    makcu = create_controller()
    print("โœ… Device connected successfully!")
    print(f"Device info: {makcu.get_device_info()}")
    makcu.disconnect()
except Exception as e:
    print(f"โŒ Connection failed: {e}")

Command-Line Tools๏ƒ

Test your installation with built-in tools:

# Interactive debug console
python -m makcu --debug

# Test specific port
python -m makcu --testPort COM3

# Run test suite
python -m makcu --runtest

Troubleshooting Installation๏ƒ

Common Issues๏ƒ

Permission Errors (Linux/macOS):

# Add user to dialout group (Linux)
sudo usermod -a -G dialout $USER

# Log out and back in, or run:
sudo chmod 666 /dev/ttyUSB0

Driver Issues (Windows):

  1. Download CH343 drivers from manufacturer

  2. Install drivers manually if Windows doesnโ€™t auto-install

  3. Check Device Manager for COM port assignment

Python Version Issues:

# Check Python version
python --version

# Must be 3.7 or higher
# Upgrade if needed
python -m pip install --upgrade pip

Dependency Conflicts๏ƒ

If you encounter dependency conflicts:

# Create clean environment
python -m venv clean-env
source clean-env/bin/activate  # or activate.bat on Windows

# Install only makcu
pip install makcu

Specific Conflict Resolution:

# Force reinstall
pip install --force-reinstall makcu

# Install with no dependencies (advanced)
pip install --no-deps makcu
pip install pyserial  # Install dependencies manually

Offline Installation๏ƒ

For systems without internet access:

Download Packages:

# On internet-connected machine
pip download makcu -d makcu-packages/

# Transfer makcu-packages/ to offline machine

# Install offline
pip install makcu --find-links makcu-packages/ --no-index

Verification Tests๏ƒ

Quick Test๏ƒ

#!/usr/bin/env python3
"""Quick installation test"""

import sys
import makcu
from makcu import create_controller, MouseButton

def test_installation():
    print(f"โœ… Makcu imported successfully")
    print(f"๐Ÿ“ฆ Version: {makcu.__version__}")

    try:
        # Test controller creation
        controller = create_controller()
        print(f"โœ… Controller created")

        # Test device info
        info = controller.get_device_info()
        print(f"๐Ÿ“ฑ Device: {info}")

        controller.disconnect()
        print(f"โœ… All tests passed!")

    except Exception as e:
        print(f"โŒ Test failed: {e}")
        return False

    return True

if __name__ == "__main__":
    success = test_installation()
    sys.exit(0 if success else 1)

Full Test Suite๏ƒ

Run the comprehensive test suite:

# Run all tests
python -m makcu --runtest

# This will:
# 1. Test device connection
# 2. Verify all mouse functions
# 3. Check button states and locking
# 4. Generate HTML report

Upgrading๏ƒ

Upgrade to Latest Version๏ƒ

# Upgrade to latest
pip install --upgrade makcu

# Check new version
python -c "import makcu; print(makcu.__version__)"

Migration Between Versions๏ƒ

From v1.x to v2.x:

Most code remains compatible, but v2.x adds async support:

# v1.x code (still works)
from makcu import create_controller
makcu = create_controller()
makcu.click(MouseButton.LEFT)

# v2.x async code (new)
import asyncio
from makcu import create_async_controller

async def main():
    async with await create_async_controller() as makcu:
        await makcu.click(MouseButton.LEFT)

asyncio.run(main())

Uninstallation๏ƒ

To remove Makcu completely:

# Uninstall makcu
pip uninstall makcu

# Remove configuration (if any)
# Location varies by OS

Getting Help๏ƒ

If installation fails:

  1. Check Requirements: Python 3.7+, pip up-to-date

  2. Try Virtual Environment: Isolate from other packages

  3. Update pip: python -m pip install --upgrade pip

  4. Check Issues: GitHub Issues

  5. Ask for Help: GitHub Discussions

System Information for Bug Reports:

import sys
import platform

print(f"Python: {sys.version}")
print(f"Platform: {platform.platform()}")
print(f"Architecture: {platform.architecture()}")

try:
    import makcu
    print(f"Makcu: {makcu.__version__}")
except ImportError as e:
    print(f"Makcu import failed: {e}")

Next Steps๏ƒ

After successful installation:

  1. ๐Ÿ“– Read the Getting Started with Makcu Python Library guide

  2. ๐Ÿš€ Try the Async Usage examples

  3. ๐Ÿ“š Explore the api/index reference

  4. ๐ŸŽฎ Check out examples/index for your use case