aicodinggym-cli 0.5.0__tar.gz → 0.5.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aicodinggym-cli
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: CLI tool for AI Coding Gym platform
5
5
  Author-email: AICodingGym Team <datasmithlab@gmail.com>
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aicodinggym-cli
3
- Version: 0.5.0
3
+ Version: 0.5.1
4
4
  Summary: CLI tool for AI Coding Gym platform
5
5
  Author-email: AICodingGym Team <datasmithlab@gmail.com>
6
6
  License-Expression: MIT
@@ -1,6 +1,8 @@
1
1
  """HTTP API client for the AI Coding Gym backend at aicodinggym.com."""
2
2
 
3
+ import gzip
3
4
  import os
5
+ from pathlib import Path
4
6
 
5
7
  import requests
6
8
 
@@ -123,15 +125,17 @@ def mlebench_download_file(url: str, dest_path: str, timeout: int = 300) -> None
123
125
  def mlebench_submit_csv(user_id: str, competition_id: str, csv_path: str) -> dict:
124
126
  """Upload a prediction CSV for an MLE-bench competition."""
125
127
  try:
128
+ csv_name = Path(csv_path).name
126
129
  with open(csv_path, "rb") as f:
127
- resp = requests.post(
128
- f"{API_BASE}/competitions/{competition_id}/submit",
129
- data={"user_id": user_id, "competition_id": competition_id},
130
- files={"file": (f.name, f, "text/csv")},
131
- timeout=60,
132
- )
133
- resp.raise_for_status()
134
- return resp.json()
130
+ compressed = gzip.compress(f.read())
131
+ resp = requests.post(
132
+ f"{API_BASE}/competitions/{competition_id}/submit",
133
+ data={"user_id": user_id, "competition_id": competition_id},
134
+ files={"file": (csv_name + ".gz", compressed, "application/gzip")},
135
+ timeout=120,
136
+ )
137
+ resp.raise_for_status()
138
+ return resp.json()
135
139
  except requests.ConnectionError:
136
140
  raise APIError(
137
141
  f"Cannot connect to {API_BASE}.\n"
@@ -145,12 +145,12 @@ def _install_gym_environment(dest: Path) -> None:
145
145
 
146
146
  # Append to .gitignore
147
147
  gitignore = dest / ".gitignore"
148
- existing = gitignore.read_text() if gitignore.exists() else ""
148
+ existing = gitignore.read_text(encoding="utf-8") if gitignore.exists() else ""
149
149
  existing_lines = set(existing.splitlines())
150
150
  new_entries = [f for f in downloaded if f not in existing_lines and f"/{f}" not in existing_lines]
151
151
  if new_entries:
152
152
  block = "\n# gym-environment\n" + "\n".join(new_entries) + "\n"
153
- with open(gitignore, "a") as fh:
153
+ with open(gitignore, "a", encoding="utf-8", newline="\n") as fh:
154
154
  fh.write(block)
155
155
 
156
156
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "aicodinggym-cli"
3
- version = "0.5.0"
3
+ version = "0.5.1"
4
4
  description = "CLI tool for AI Coding Gym platform"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"