makcu 0.2.0__tar.gz → 2.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. {makcu-0.2.0/makcu.egg-info → makcu-2.1.1}/PKG-INFO +10 -10
  2. {makcu-0.2.0 → makcu-2.1.1}/README.md +9 -9
  3. {makcu-0.2.0 → makcu-2.1.1}/makcu/__init__.py +0 -18
  4. {makcu-0.2.0 → makcu-2.1.1}/makcu/__main__.py +13 -29
  5. {makcu-0.2.0 → makcu-2.1.1}/makcu/conftest.py +0 -2
  6. {makcu-0.2.0 → makcu-2.1.1}/makcu/connection.py +57 -83
  7. {makcu-0.2.0 → makcu-2.1.1}/makcu/controller.py +27 -71
  8. makcu-2.1.1/makcu/errors.py +14 -0
  9. makcu-2.1.1/makcu/makcu.pyi +11 -0
  10. {makcu-0.2.0 → makcu-2.1.1}/makcu/mouse.py +21 -41
  11. {makcu-0.2.0 → makcu-2.1.1}/makcu/test_suite.py +8 -22
  12. {makcu-0.2.0 → makcu-2.1.1/makcu.egg-info}/PKG-INFO +10 -10
  13. {makcu-0.2.0 → makcu-2.1.1}/pyproject.toml +1 -1
  14. makcu-0.2.0/makcu/errors.py +0 -19
  15. makcu-0.2.0/makcu/makcu.pyi +0 -13
  16. {makcu-0.2.0 → makcu-2.1.1}/LICENSE +0 -0
  17. {makcu-0.2.0 → makcu-2.1.1}/MANIFEST.in +0 -0
  18. {makcu-0.2.0 → makcu-2.1.1}/makcu/enums.py +0 -0
  19. {makcu-0.2.0 → makcu-2.1.1}/makcu/py.typed +0 -0
  20. {makcu-0.2.0 → makcu-2.1.1}/makcu.egg-info/SOURCES.txt +0 -0
  21. {makcu-0.2.0 → makcu-2.1.1}/makcu.egg-info/dependency_links.txt +0 -0
  22. {makcu-0.2.0 → makcu-2.1.1}/makcu.egg-info/requires.txt +0 -0
  23. {makcu-0.2.0 → makcu-2.1.1}/makcu.egg-info/top_level.txt +0 -0
  24. {makcu-0.2.0 → makcu-2.1.1}/setup.cfg +0 -0
  25. {makcu-0.2.0 → makcu-2.1.1}/tests/test_button_mask.py +0 -0
  26. {makcu-0.2.0 → makcu-2.1.1}/tests/test_capture_right_clicks.py +0 -0
  27. {makcu-0.2.0 → makcu-2.1.1}/tests/test_controller_behavior.py +0 -0
  28. {makcu-0.2.0 → makcu-2.1.1}/tests/test_device_info.py +0 -0
  29. {makcu-0.2.0 → makcu-2.1.1}/tests/test_firmware_version.py +0 -0
  30. {makcu-0.2.0 → makcu-2.1.1}/tests/test_get_button_states.py +0 -0
  31. {makcu-0.2.0 → makcu-2.1.1}/tests/test_get_raw_mask.py +0 -0
  32. {makcu-0.2.0 → makcu-2.1.1}/tests/test_is_button_pressed.py +0 -0
  33. {makcu-0.2.0 → makcu-2.1.1}/tests/test_lock_state.py +0 -0
  34. {makcu-0.2.0 → makcu-2.1.1}/tests/test_middle_click.py +0 -0
  35. {makcu-0.2.0 → makcu-2.1.1}/tests/test_port_connection.py +0 -0
  36. {makcu-0.2.0 → makcu-2.1.1}/tests/test_press_and_release.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: makcu
3
- Version: 0.2.0
3
+ Version: 2.1.1
4
4
  Summary: Python library for Makcu hardware device control
5
5
  Author: SleepyTotem
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -708,7 +708,7 @@ Requires-Dist: build>=0.10; extra == "dev"
708
708
  Requires-Dist: twine>=4.0; extra == "dev"
709
709
  Dynamic: license-file
710
710
 
711
- # 🖱️ Makcu Python Library v2.0
711
+ # 🖱️ Makcu Python Library v2.1.1
712
712
 
713
713
  [![PyPI Version](https://img.shields.io/pypi/v/makcu.svg)](https://pypi.org/project/makcu/)
714
714
  [![Python Support](https://img.shields.io/pypi/pyversions/makcu.svg)](https://pypi.org/project/makcu/)
@@ -716,15 +716,15 @@ Dynamic: license-file
716
716
 
717
717
  Makcu Py Lib is a high-performance Python library for controlling Makcu devices — now with **async/await support**, **zero-delay command execution**, and **automatic reconnection**!
718
718
 
719
- ## 🚀 What's New in v2.0
719
+ ## What's New in v2.0
720
720
 
721
- - **⚡ Async/Await Support**: Full async API for modern Python applications
722
- - **🎯 Zero-Delay Commands**: Removed all `sleep()` calls with proper command tracking
723
- - **🔄 Auto-Reconnection**: Automatic device reconnection on disconnect
724
- - **📊 Parallel Operations**: Execute multiple commands simultaneously
725
- - **🔍 Enhanced Debugging**: Better logging and error tracking
726
- - **🎮 Gaming-Optimized**: Sub-3ms command execution for 240Hz+ gaming
727
- - **🏎️ Ultra-Fast Performance**: 10-50x faster than >=v1.4
721
+ - **Async/Await Support**: Full async API for modern Python applications
722
+ - **Zero-Delay Commands**: Removed all `sleep()` calls with proper command tracking
723
+ - **Auto-Reconnection**: Automatic device reconnection on disconnect
724
+ - **Parallel Operations**: Execute multiple commands simultaneously
725
+ - **Enhanced Debugging**: Better logging and error tracking
726
+ - **Gaming-Optimized**: Sub-3ms command execution for 240Hz+ gaming
727
+ - **Ultra-Fast Performance**: 10-50x faster than >=v1.4
728
728
 
729
729
  ---
730
730
 
@@ -1,4 +1,4 @@
1
- # 🖱️ Makcu Python Library v2.0
1
+ # 🖱️ Makcu Python Library v2.1.1
2
2
 
3
3
  [![PyPI Version](https://img.shields.io/pypi/v/makcu.svg)](https://pypi.org/project/makcu/)
4
4
  [![Python Support](https://img.shields.io/pypi/pyversions/makcu.svg)](https://pypi.org/project/makcu/)
@@ -6,15 +6,15 @@
6
6
 
7
7
  Makcu Py Lib is a high-performance Python library for controlling Makcu devices — now with **async/await support**, **zero-delay command execution**, and **automatic reconnection**!
8
8
 
9
- ## 🚀 What's New in v2.0
9
+ ## What's New in v2.0
10
10
 
11
- - **⚡ Async/Await Support**: Full async API for modern Python applications
12
- - **🎯 Zero-Delay Commands**: Removed all `sleep()` calls with proper command tracking
13
- - **🔄 Auto-Reconnection**: Automatic device reconnection on disconnect
14
- - **📊 Parallel Operations**: Execute multiple commands simultaneously
15
- - **🔍 Enhanced Debugging**: Better logging and error tracking
16
- - **🎮 Gaming-Optimized**: Sub-3ms command execution for 240Hz+ gaming
17
- - **🏎️ Ultra-Fast Performance**: 10-50x faster than >=v1.4
11
+ - **Async/Await Support**: Full async API for modern Python applications
12
+ - **Zero-Delay Commands**: Removed all `sleep()` calls with proper command tracking
13
+ - **Auto-Reconnection**: Automatic device reconnection on disconnect
14
+ - **Parallel Operations**: Execute multiple commands simultaneously
15
+ - **Enhanced Debugging**: Better logging and error tracking
16
+ - **Gaming-Optimized**: Sub-3ms command execution for 240Hz+ gaming
17
+ - **Ultra-Fast Performance**: 10-50x faster than >=v1.4
18
18
 
19
19
  ---
20
20
 
@@ -1,13 +1,4 @@
1
- """
2
- Makcu Python Library v2.0
3
-
4
- High-performance library for controlling Makcu devices with async support,
5
- zero-delay command execution, and automatic reconnection.
6
- """
7
-
8
1
  from typing import List
9
-
10
- # Import main components
11
2
  from .controller import MakcuController, create_controller, create_async_controller
12
3
  from .enums import MouseButton
13
4
  from .errors import (
@@ -18,22 +9,15 @@ from .errors import (
18
9
  MakcuResponseError
19
10
  )
20
11
 
21
- # Version info
22
12
  __version__: str = "2.0.0"
23
13
  __author__: str = "SleepyTotem"
24
14
  __license__: str = "GPL"
25
15
 
26
- # Public API
27
16
  __all__: List[str] = [
28
- # Main controller
29
17
  "MakcuController",
30
18
  "create_controller",
31
19
  "create_async_controller",
32
-
33
- # Enums
34
20
  "MouseButton",
35
-
36
- # Errors
37
21
  "MakcuError",
38
22
  "MakcuConnectionError",
39
23
  "MakcuCommandError",
@@ -41,10 +25,8 @@ __all__: List[str] = [
41
25
  "MakcuResponseError",
42
26
  ]
43
27
 
44
- # Convenience imports for backward compatibility
45
28
  from .controller import MakcuController as Controller
46
29
 
47
- # Package metadata
48
30
  __doc__ = """
49
31
  Makcu Python Library provides a high-performance interface for controlling
50
32
  Makcu USB devices. Features include:
@@ -28,16 +28,12 @@ def debug_console():
28
28
 
29
29
  command_counter += 1
30
30
 
31
- # Send command and expect response for most commands
32
31
  response = transport.send_command(cmd, expect_response=True)
33
32
 
34
- # Handle the response properly
35
33
  if response and response.strip():
36
- # If response is just the command echoed back, that means success
37
34
  if response.strip() == cmd:
38
35
  print(f"{cmd}")
39
36
  else:
40
- # This is actual response data (like "km.MAKCU" for version)
41
37
  print(f"{response}")
42
38
  else:
43
39
  print("(no response)")
@@ -65,19 +61,16 @@ def test_port(port: str) -> None:
65
61
  print(f"❌ Unexpected error: {e}")
66
62
 
67
63
  def parse_html_results(html_file: Path):
68
- """Parse test results from the pytest HTML report"""
69
64
  if not html_file.exists():
70
65
  raise FileNotFoundError(f"HTML report not found: {html_file}")
71
66
 
72
67
  with open(html_file, 'r', encoding='utf-8') as f:
73
68
  content = f.read()
74
69
 
75
- # Extract the JSON data from the HTML file
76
70
  match = re.search(r'data-jsonblob="([^"]*)"', content)
77
71
  if not match:
78
72
  raise ValueError("Could not find JSON data in HTML report")
79
73
 
80
- # Decode HTML entities in the JSON string
81
74
  json_str = match.group(1)
82
75
  json_str = json_str.replace('"', '"').replace(''', "'").replace('&', '&')
83
76
 
@@ -89,13 +82,10 @@ def parse_html_results(html_file: Path):
89
82
  test_results = []
90
83
  total_ms = 0
91
84
 
92
- # Filter out the connect_to_port test from display
93
85
  skip_tests = {'test_connect_to_port'}
94
86
 
95
87
  for test_id, test_data_list in data.get('tests', {}).items():
96
- test_name = test_id.split('::')[-1] # Get just the test function name
97
-
98
- # Skip connection test from display
88
+ test_name = test_id.split('::')[-1]
99
89
  if test_name in skip_tests:
100
90
  continue
101
91
 
@@ -103,7 +93,6 @@ def parse_html_results(html_file: Path):
103
93
  status = test_data.get('result', 'UNKNOWN')
104
94
  duration_str = test_data.get('duration', '0 ms')
105
95
 
106
- # Parse duration (format: "X ms")
107
96
  duration_match = re.search(r'(\d+)\s*ms', duration_str)
108
97
  duration_ms = int(duration_match.group(1)) if duration_match else 0
109
98
  total_ms += duration_ms
@@ -113,7 +102,6 @@ def parse_html_results(html_file: Path):
113
102
  return test_results, total_ms
114
103
 
115
104
  def run_tests() -> NoReturn:
116
- """Run tests with beautiful console output"""
117
105
  try:
118
106
  from rich.console import Console
119
107
  from rich.table import Table
@@ -127,7 +115,7 @@ def run_tests() -> NoReturn:
127
115
  console = Console()
128
116
 
129
117
  header = Panel.fit(
130
- "[bold cyan]🧪 Makcu Test Suite v2.0[/bold cyan]\n[dim]High-Performance Python Library[/dim]",
118
+ "[bold cyan]Makcu Test Suite v2.1.1[/bold cyan]\n[dim]High-Performance Python Library[/dim]",
131
119
  border_style="bright_blue"
132
120
  )
133
121
  console.print(Align.center(header))
@@ -150,25 +138,23 @@ def run_tests() -> NoReturn:
150
138
  ) as progress:
151
139
  task = progress.add_task("[cyan]Running tests...", total=100)
152
140
 
153
- # Run pytest with minimal output, generating HTML report
154
141
  result = subprocess.run(
155
142
  [
156
143
  sys.executable, "-m", "pytest",
157
144
  str(test_file),
158
145
  "--rootdir", str(package_dir),
159
- "-q", # Quiet mode
160
- "--tb=no", # No traceback
146
+ "-q",
147
+ "--tb=no",
161
148
  "--html", str(html_file),
162
149
  "--self-contained-html"
163
150
  ],
164
- stdout=subprocess.DEVNULL, # Hide stdout completely
165
- stderr=subprocess.DEVNULL, # Hide stderr completely
151
+ stdout=subprocess.DEVNULL,
152
+ stderr=subprocess.DEVNULL,
166
153
  text=True
167
154
  )
168
155
 
169
156
  progress.update(task, completed=100)
170
157
 
171
- # Parse results from HTML file
172
158
  try:
173
159
  test_results, total_ms = parse_html_results(html_file)
174
160
  except (FileNotFoundError, ValueError) as e:
@@ -178,7 +164,6 @@ def run_tests() -> NoReturn:
178
164
 
179
165
  elapsed_time = time.time() - start_time
180
166
 
181
- # Table rendering
182
167
  table = Table(title="[bold]Test Results[/bold]", show_header=True, header_style="bold magenta")
183
168
  table.add_column("Test", style="cyan", no_wrap=True)
184
169
  table.add_column("Status", justify="center")
@@ -203,12 +188,12 @@ def run_tests() -> NoReturn:
203
188
  status_text = status
204
189
 
205
190
  time_str = f"{duration_ms}ms" if duration_ms else "-"
206
- if duration_ms < 3:
207
- perf = "[green]Excellent[/green]"
208
- elif duration_ms < 5:
209
- perf = "[cyan]🚀 Great[/cyan]"
210
- elif duration_ms < 10:
211
- perf = "[yellow]👍 Good[/yellow]"
191
+ if duration_ms <= 3:
192
+ perf = "[green]Excellent[/green]"
193
+ elif duration_ms <= 5:
194
+ perf = "[cyan]Great[/cyan]"
195
+ elif duration_ms <= 10:
196
+ perf = "[yellow]Good[/yellow]"
212
197
  elif duration_ms > 0:
213
198
  perf = "[red]🐌 Needs work[/red]"
214
199
  else:
@@ -255,7 +240,7 @@ def run_tests() -> NoReturn:
255
240
 
256
241
  package_dir: Path = Path(__file__).resolve().parent
257
242
  test_file: Path = package_dir / "test_suite.py"
258
- html_file: Path = package_dir.parent / "latest_pytest.html"
243
+ html_file: Path = Path.cwd() / "latest_pytest.html"
259
244
 
260
245
  result = pytest.main([
261
246
  str(test_file),
@@ -266,7 +251,6 @@ def run_tests() -> NoReturn:
266
251
  "--self-contained-html"
267
252
  ])
268
253
 
269
- # Try to parse HTML results even in fallback mode
270
254
  try:
271
255
  test_results, total_ms = parse_html_results(html_file)
272
256
  passed = sum(1 for _, status, _ in test_results if status.upper() == "PASSED")
@@ -1,10 +1,8 @@
1
1
  import pytest
2
- import time
3
2
  from makcu import MakcuController, MouseButton
4
3
 
5
4
  @pytest.fixture(scope="session")
6
5
  def makcu(request):
7
- """Session-scoped fixture with final cleanup at end of all tests"""
8
6
  ctrl = MakcuController(fallback_com_port="COM1", debug=False)
9
7
 
10
8
  def cleanup():