balatrobot 0.7.2__tar.gz → 0.7.4__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.

Potentially problematic release.


This version of balatrobot might be problematic. Click here for more details.

Files changed (90) hide show
  1. {balatrobot-0.7.2 → balatrobot-0.7.4}/.github/workflows/release_please.yml +10 -4
  2. {balatrobot-0.7.2 → balatrobot-0.7.4}/CHANGELOG.md +14 -0
  3. {balatrobot-0.7.2 → balatrobot-0.7.4}/PKG-INFO +1 -1
  4. {balatrobot-0.7.2 → balatrobot-0.7.4}/balatro.sh +15 -12
  5. {balatrobot-0.7.2 → balatrobot-0.7.4}/balatrobot.json +1 -1
  6. {balatrobot-0.7.2 → balatrobot-0.7.4}/pyproject.toml +1 -1
  7. {balatrobot-0.7.2 → balatrobot-0.7.4}/src/balatrobot/__init__.py +1 -1
  8. {balatrobot-0.7.2 → balatrobot-0.7.4}/src/balatrobot/client.py +16 -0
  9. {balatrobot-0.7.2 → balatrobot-0.7.4}/uv.lock +1 -1
  10. {balatrobot-0.7.2 → balatrobot-0.7.4}/.claude/commands/commit-msg.md +0 -0
  11. {balatrobot-0.7.2 → balatrobot-0.7.4}/.claude/commands/commit.md +0 -0
  12. {balatrobot-0.7.2 → balatrobot-0.7.4}/.claude/commands/test.md +0 -0
  13. {balatrobot-0.7.2 → balatrobot-0.7.4}/.claude/settings.json +0 -0
  14. {balatrobot-0.7.2 → balatrobot-0.7.4}/.cursor/rules/docs-formatting.mdc +0 -0
  15. {balatrobot-0.7.2 → balatrobot-0.7.4}/.cursor/rules/python-development.mdc +0 -0
  16. {balatrobot-0.7.2 → balatrobot-0.7.4}/.editorconfig +0 -0
  17. {balatrobot-0.7.2 → balatrobot-0.7.4}/.envrc.example +0 -0
  18. {balatrobot-0.7.2 → balatrobot-0.7.4}/.gitattributes +0 -0
  19. {balatrobot-0.7.2 → balatrobot-0.7.4}/.github/workflows/code_quality.yml +0 -0
  20. {balatrobot-0.7.2 → balatrobot-0.7.4}/.github/workflows/deploy_docs.yml +0 -0
  21. {balatrobot-0.7.2 → balatrobot-0.7.4}/.github/workflows/release-pypi.yml +0 -0
  22. {balatrobot-0.7.2 → balatrobot-0.7.4}/.gitignore +0 -0
  23. {balatrobot-0.7.2 → balatrobot-0.7.4}/.gitmodules +0 -0
  24. {balatrobot-0.7.2 → balatrobot-0.7.4}/.mdformat.toml +0 -0
  25. {balatrobot-0.7.2 → balatrobot-0.7.4}/.python-version +0 -0
  26. {balatrobot-0.7.2 → balatrobot-0.7.4}/.vscode/extensions.json +0 -0
  27. {balatrobot-0.7.2 → balatrobot-0.7.4}/.vscode/settings.json +0 -0
  28. {balatrobot-0.7.2 → balatrobot-0.7.4}/CLAUDE.md +0 -0
  29. {balatrobot-0.7.2 → balatrobot-0.7.4}/LICENSE +0 -0
  30. {balatrobot-0.7.2 → balatrobot-0.7.4}/Makefile +0 -0
  31. {balatrobot-0.7.2 → balatrobot-0.7.4}/README.md +0 -0
  32. {balatrobot-0.7.2 → balatrobot-0.7.4}/balatrobot.lua +0 -0
  33. {balatrobot-0.7.2 → balatrobot-0.7.4}/bots/example.py +0 -0
  34. {balatrobot-0.7.2 → balatrobot-0.7.4}/bots/replay.py +0 -0
  35. {balatrobot-0.7.2 → balatrobot-0.7.4}/docs/assets/balatrobot.svg +0 -0
  36. {balatrobot-0.7.2 → balatrobot-0.7.4}/docs/balatrobot-api.md +0 -0
  37. {balatrobot-0.7.2 → balatrobot-0.7.4}/docs/contributing.md +0 -0
  38. {balatrobot-0.7.2 → balatrobot-0.7.4}/docs/developing-bots.md +0 -0
  39. {balatrobot-0.7.2 → balatrobot-0.7.4}/docs/index.md +0 -0
  40. {balatrobot-0.7.2 → balatrobot-0.7.4}/docs/installation.md +0 -0
  41. {balatrobot-0.7.2 → balatrobot-0.7.4}/docs/logging-systems.md +0 -0
  42. {balatrobot-0.7.2 → balatrobot-0.7.4}/docs/protocol-api.md +0 -0
  43. {balatrobot-0.7.2 → balatrobot-0.7.4}/mkdocs.yml +0 -0
  44. {balatrobot-0.7.2 → balatrobot-0.7.4}/runs/.gitkeep +0 -0
  45. {balatrobot-0.7.2 → balatrobot-0.7.4}/src/balatrobot/enums.py +0 -0
  46. {balatrobot-0.7.2 → balatrobot-0.7.4}/src/balatrobot/exceptions.py +0 -0
  47. {balatrobot-0.7.2 → balatrobot-0.7.4}/src/balatrobot/models.py +0 -0
  48. {balatrobot-0.7.2 → balatrobot-0.7.4}/src/balatrobot/py.typed +0 -0
  49. {balatrobot-0.7.2 → balatrobot-0.7.4}/src/lua/api.lua +0 -0
  50. {balatrobot-0.7.2 → balatrobot-0.7.4}/src/lua/log.lua +0 -0
  51. {balatrobot-0.7.2 → balatrobot-0.7.4}/src/lua/settings.lua +0 -0
  52. {balatrobot-0.7.2 → balatrobot-0.7.4}/src/lua/types.lua +0 -0
  53. {balatrobot-0.7.2 → balatrobot-0.7.4}/src/lua/utils.lua +0 -0
  54. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/balatrobot/conftest.py +0 -0
  55. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/balatrobot/test_client.py +0 -0
  56. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/balatrobot/test_exceptions.py +0 -0
  57. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/balatrobot/test_models.py +0 -0
  58. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/conftest.py +0 -0
  59. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/lua/__init__.py +0 -0
  60. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/lua/conftest.py +0 -0
  61. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/lua/endpoints/__init__.py +0 -0
  62. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/lua/endpoints/checkpoints/basic_shop_setup.jkr +0 -0
  63. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/lua/endpoints/checkpoints/buy_cant_use.jkr +0 -0
  64. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/lua/endpoints/checkpoints/plasma_deck.jkr +0 -0
  65. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/lua/endpoints/test_cash_out.py +0 -0
  66. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/lua/endpoints/test_get_gamestate.py +0 -0
  67. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/lua/endpoints/test_get_save_info.py +0 -0
  68. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/lua/endpoints/test_go_to_menu.py +0 -0
  69. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/lua/endpoints/test_load_save.py +0 -0
  70. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/lua/endpoints/test_play_hand_or_discard.py +0 -0
  71. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/lua/endpoints/test_rearrange_consumables.py +0 -0
  72. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/lua/endpoints/test_rearrange_hand.py +0 -0
  73. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/lua/endpoints/test_rearrange_jokers.py +0 -0
  74. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/lua/endpoints/test_sell_consumable.py +0 -0
  75. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/lua/endpoints/test_sell_joker.py +0 -0
  76. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/lua/endpoints/test_shop.py +0 -0
  77. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/lua/endpoints/test_skip_or_select_blind.py +0 -0
  78. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/lua/endpoints/test_start_run.py +0 -0
  79. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/lua/endpoints/test_use_consumable.py +0 -0
  80. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/lua/test_connection.py +0 -0
  81. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/lua/test_log.py +0 -0
  82. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/lua/test_protocol_errors.py +0 -0
  83. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/runs/buy_joker.jsonl +0 -0
  84. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/runs/no_shop.jsonl +0 -0
  85. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/runs/rearrange_consumables.jsonl +0 -0
  86. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/runs/rearrange_jokers.jsonl +0 -0
  87. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/runs/sell_consumables.jsonl +0 -0
  88. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/runs/sell_jokers.jsonl +0 -0
  89. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/runs/shop_reroll.jsonl +0 -0
  90. {balatrobot-0.7.2 → balatrobot-0.7.4}/tests/runs/use_consumable.planet.jsonl +0 -0
@@ -66,11 +66,17 @@ jobs:
66
66
  - name: Notify consumer repo of new balatrobot release
67
67
  if: ${{ steps.release.outputs.release_created }}
68
68
  env:
69
- TARGET_REPO: "coder/balatrollm"
70
- TARGET_TOKEN: ${{ secrets.TARGET_REPO_PAT }}
69
+ BALATROLLM_REPO: "coder/balatrollm"
70
+ BALATROLLM_TOKEN: ${{ secrets.BALATROLLM_TOKEN }}
71
+ BALATRO_REPO: "S1M0N38/balatro"
72
+ BALATRO_TOKEN: ${{ secrets.BALATRO_TOKEN }}
71
73
  run: |
72
74
  VERSION="${{ steps.release.outputs.version }}"
73
75
  curl -X POST -H "Accept: application/vnd.github+json" \
74
- -H "Authorization: token $TARGET_TOKEN" \
75
- https://api.github.com/repos/$TARGET_REPO/dispatches \
76
+ -H "Authorization: token $BALATROLLM_TOKEN" \
77
+ https://api.github.com/repos/$BALATROLLM_REPO/dispatches \
78
+ -d "{\"event_type\":\"balatrobot_release\",\"client_payload\":{\"version\":\"$VERSION\"}}"
79
+ curl -X POST -H "Accept: application/vnd.github+json" \
80
+ -H "Authorization: token $BALATRO_TOKEN" \
81
+ https://api.github.com/repos/$BALATRO_REPO/dispatches \
76
82
  -d "{\"event_type\":\"balatrobot_release\",\"client_payload\":{\"version\":\"$VERSION\"}}"
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.7.4](https://github.com/coder/balatrobot/compare/v0.7.3...v0.7.4) (2025-10-28)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * add timeout to socket.recv ([12d086a](https://github.com/coder/balatrobot/commit/12d086a80294f08fe449012c2a3a27708d7aada0))
9
+
10
+ ## [0.7.3](https://github.com/coder/balatrobot/compare/v0.7.2...v0.7.3) (2025-10-25)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * use comma-separated list of ports ([42a566a](https://github.com/coder/balatrobot/commit/42a566a85bf119c5657e89de0fca73d194aad62b))
16
+
3
17
  ## [0.7.2](https://github.com/coder/balatrobot/compare/v0.7.1...v0.7.2) (2025-10-24)
4
18
 
5
19
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: balatrobot
3
- Version: 0.7.2
3
+ Version: 0.7.4
4
4
  Summary: A framework for Balatro bot development
5
5
  Project-URL: Homepage, https://github.com/coder/balatrobot
6
6
  Project-URL: Issues, https://github.com/coder/balatrobot/issues
@@ -31,13 +31,13 @@ esac
31
31
  show_usage() {
32
32
  cat <<EOF
33
33
  Usage: $0 [OPTIONS]
34
- $0 -p PORT [OPTIONS]
34
+ $0 --ports PORT1,PORT2,... [OPTIONS]
35
35
  $0 --kill
36
36
  $0 --status
37
37
 
38
38
  Options:
39
- -p, --port PORT Specify port for Balatro instance (can be used multiple times)
40
- Default: 12346 if no port specified
39
+ --ports PORTS Comma-separated list of ports for Balatro instances
40
+ Default: 12346 if not specified
41
41
  --headless Enable headless mode (sets BALATROBOT_HEADLESS=1)
42
42
  --fast Enable fast mode (sets BALATROBOT_FAST=1)
43
43
  --audio Enable audio (disabled by default, sets BALATROBOT_AUDIO=1)
@@ -49,8 +49,8 @@ Options:
49
49
 
50
50
  Examples:
51
51
  $0 # Start single instance on default port 12346
52
- $0 -p 12347 # Start single instance on port 12347
53
- $0 -p 12346 -p 12347 # Start two instances on ports 12346 and 12347
52
+ $0 --ports 12347 # Start single instance on port 12347
53
+ $0 --ports 12346,12347 # Start two instances on ports 12346 and 12347
54
54
  $0 --headless --fast # Start with headless and fast mode on default port
55
55
  $0 --audio # Start with audio enabled on default port
56
56
  $0 --render-on-api # Start with on-demand rendering on default port
@@ -64,16 +64,19 @@ EOF
64
64
  parse_arguments() {
65
65
  while [[ $# -gt 0 ]]; do
66
66
  case $1 in
67
- -p | --port)
67
+ --ports)
68
68
  if [[ -z "$2" ]] || [[ "$2" =~ ^- ]]; then
69
- echo "Error: --port requires a port number" >&2
69
+ echo "Error: --ports requires a comma-separated list of ports" >&2
70
70
  exit 1
71
71
  fi
72
- if ! [[ "$2" =~ ^[0-9]+$ ]] || [[ "$2" -lt 1024 ]] || [[ "$2" -gt 65535 ]]; then
73
- echo "Error: Port must be a number between 1024 and 65535" >&2
74
- exit 1
75
- fi
76
- PORTS+=("$2")
72
+ IFS=',' read -ra port_list <<< "$2"
73
+ for port in "${port_list[@]}"; do
74
+ if ! [[ "$port" =~ ^[0-9]+$ ]] || [[ "$port" -lt 1024 ]] || [[ "$port" -gt 65535 ]]; then
75
+ echo "Error: Port must be a number between 1024 and 65535 (got: $port)" >&2
76
+ exit 1
77
+ fi
78
+ PORTS+=("$port")
79
+ done
77
80
  shift 2
78
81
  ;;
79
82
  --headless)
@@ -14,7 +14,7 @@
14
14
  "badge_colour": "4CAF50",
15
15
  "badge_text_colour": "FFFFFF",
16
16
  "display_name": "BB",
17
- "version": "0.7.1",
17
+ "version": "0.7.3",
18
18
  "dependencies": [
19
19
  "Steamodded (>=1.*)"
20
20
  ]
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "balatrobot"
3
- version = "0.7.2"
3
+ version = "0.7.4"
4
4
  description = "A framework for Balatro bot development"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -5,7 +5,7 @@ from .enums import Actions, Decks, Stakes, State
5
5
  from .exceptions import BalatroError
6
6
  from .models import G
7
7
 
8
- __version__ = "0.7.2"
8
+ __version__ = "0.7.4"
9
9
  __all__ = [
10
10
  # Main client
11
11
  "BalatroClient",
@@ -6,6 +6,7 @@ import platform
6
6
  import re
7
7
  import shutil
8
8
  import socket
9
+ import time
9
10
  from pathlib import Path
10
11
  from typing import Self
11
12
 
@@ -186,6 +187,9 @@ class BalatroClient:
186
187
  logger.debug(f"Sending API request: {name}")
187
188
 
188
189
  try:
190
+ # Start timing measurement
191
+ start_time = time.perf_counter()
192
+
189
193
  # Send request
190
194
  message = request.model_dump_json() + "\n"
191
195
  self._socket.send(message.encode())
@@ -216,6 +220,18 @@ class BalatroClient:
216
220
  logger.debug(f"API request {name} completed successfully")
217
221
  return response_data
218
222
 
223
+ except socket.timeout as e:
224
+ # Calculate elapsed time and log timeout
225
+ elapsed_time = time.perf_counter() - start_time
226
+ logger.warning(
227
+ f"Timeout on API request {name}: took {elapsed_time:.3f}s, "
228
+ f"exceeded timeout of {self.timeout}s (port: {self.port})"
229
+ )
230
+ raise ConnectionFailedError(
231
+ f"Socket timeout during communication: {e}",
232
+ error_code="E008",
233
+ context={"error": str(e), "elapsed_time": elapsed_time},
234
+ ) from e
219
235
  except socket.error as e:
220
236
  logger.error(f"Socket error during API request {name}: {e}")
221
237
  raise ConnectionFailedError(
@@ -36,7 +36,7 @@ wheels = [
36
36
 
37
37
  [[package]]
38
38
  name = "balatrobot"
39
- version = "0.7.1"
39
+ version = "0.7.3"
40
40
  source = { editable = "." }
41
41
  dependencies = [
42
42
  { name = "pydantic" },
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes