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.
- {aicodinggym_cli-0.5.0 → aicodinggym_cli-0.5.1}/PKG-INFO +1 -1
- {aicodinggym_cli-0.5.0 → aicodinggym_cli-0.5.1}/aicodinggym_cli.egg-info/PKG-INFO +1 -1
- {aicodinggym_cli-0.5.0 → aicodinggym_cli-0.5.1}/api.py +12 -8
- {aicodinggym_cli-0.5.0 → aicodinggym_cli-0.5.1}/cli.py +2 -2
- {aicodinggym_cli-0.5.0 → aicodinggym_cli-0.5.1}/pyproject.toml +1 -1
- {aicodinggym_cli-0.5.0 → aicodinggym_cli-0.5.1}/README.md +0 -0
- {aicodinggym_cli-0.5.0 → aicodinggym_cli-0.5.1}/__init__.py +0 -0
- {aicodinggym_cli-0.5.0 → aicodinggym_cli-0.5.1}/aicodinggym_cli.egg-info/SOURCES.txt +0 -0
- {aicodinggym_cli-0.5.0 → aicodinggym_cli-0.5.1}/aicodinggym_cli.egg-info/dependency_links.txt +0 -0
- {aicodinggym_cli-0.5.0 → aicodinggym_cli-0.5.1}/aicodinggym_cli.egg-info/entry_points.txt +0 -0
- {aicodinggym_cli-0.5.0 → aicodinggym_cli-0.5.1}/aicodinggym_cli.egg-info/requires.txt +0 -0
- {aicodinggym_cli-0.5.0 → aicodinggym_cli-0.5.1}/aicodinggym_cli.egg-info/top_level.txt +0 -0
- {aicodinggym_cli-0.5.0 → aicodinggym_cli-0.5.1}/config.py +0 -0
- {aicodinggym_cli-0.5.0 → aicodinggym_cli-0.5.1}/git_ops.py +0 -0
- {aicodinggym_cli-0.5.0 → aicodinggym_cli-0.5.1}/setup.cfg +0 -0
|
@@ -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
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{aicodinggym_cli-0.5.0 → aicodinggym_cli-0.5.1}/aicodinggym_cli.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|