Skip to content

Commit d2dbcc7

Browse files
Codex-generated pull request (#890)
Co-authored-by: will brown <willccbb@users.noreply.github.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
1 parent f90b2c0 commit d2dbcc7

6 files changed

Lines changed: 68 additions & 14 deletions

File tree

docs/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ In the TUI, press `c` to open Copy Mode for prompt/completion text; highlight an
100100

101101
To publish the environment to the [Environments Hub](https://app.primeintellect.ai/dashboard/environments?ex_sort=most_stars), do:
102102
```bash
103-
prime env push --path ./environments/my_env
103+
prime env push my-env # equivalent to --path ./environments/my_env
104104
```
105105

106106
To run an evaluation directly from the Environments Hub, do:

skills/create-environments/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ prime eval run my-env -m gpt-4.1-mini -n 30 -r 3 -s
8888
2. Ask the user explicitly whether visibility should be `PUBLIC` or `PRIVATE`.
8989
3. Use:
9090
```bash
91-
prime env push --path ./environments/my_env --visibility PUBLIC
91+
prime env push my-env --visibility PUBLIC
9292
```
9393
or
9494
```bash
95-
prime env push --path ./environments/my_env --visibility PRIVATE
95+
prime env push my-env --visibility PRIVATE
9696
```
9797
4. For hosted or large-scale workflows, prefer running with the Hub slug after push:
9898
```bash

skills/evaluate-environments/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ key = "PRIME_API_KEY"
4949
2. Ask the user explicitly: should visibility be `PUBLIC` or `PRIVATE`?
5050
3. Push with chosen visibility:
5151
```bash
52-
prime env push --path ./environments/my_env --visibility PUBLIC
52+
prime env push my-env --visibility PUBLIC
5353
```
5454
or
5555
```bash
56-
prime env push --path ./environments/my_env --visibility PRIVATE
56+
prime env push my-env --visibility PRIVATE
5757
```
5858
4. For hosted eval workflows, prefer running large jobs against the Hub slug:
5959
```bash

skills/train-with-environments/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ prime eval run my-env -m gpt-4.1-mini -n 20 -r 3 -s
4444
2. Ask the user explicitly whether visibility should be `PUBLIC` or `PRIVATE`.
4545
3. Push with chosen visibility:
4646
```bash
47-
prime env push --path ./environments/my_env --visibility PUBLIC
47+
prime env push my-env --visibility PUBLIC
4848
```
4949
or
5050
```bash
51-
prime env push --path ./environments/my_env --visibility PRIVATE
51+
prime env push my-env --visibility PRIVATE
5252
```
5353
4. For hosted RL and shared workflows, prefer Hub IDs after push (for example `owner/my-env` in config `[[env]].id`).
5454

tests/test_build_script.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from pathlib import Path
2+
3+
from verifiers.scripts import build
4+
5+
6+
def test_resolve_env_push_target_defaults_to_environments_dir(tmp_path: Path):
7+
base_dir = tmp_path / "workspace" / "environments"
8+
env_name, env_path = build._resolve_env_push_target("my-env", str(base_dir))
9+
10+
assert env_name == "my-env"
11+
assert env_path == (base_dir / "my_env").resolve()
12+
13+
14+
def test_resolve_env_push_target_appends_env_id_to_custom_base_path(tmp_path: Path):
15+
base_dir = tmp_path / "workspace" / "custom_envs"
16+
env_name, env_path = build._resolve_env_push_target("env-name", str(base_dir))
17+
18+
assert env_name == "env-name"
19+
assert env_path == (base_dir / "env_name").resolve()
20+
21+
22+
def test_resolve_env_push_target_uses_explicit_environment_path_when_env_id_missing(
23+
tmp_path: Path,
24+
):
25+
explicit_env_path = tmp_path / "workspace" / "environments" / "already_normalized"
26+
env_name, env_path = build._resolve_env_push_target(None, str(explicit_env_path))
27+
28+
assert env_name == "already-normalized"
29+
assert env_path == explicit_env_path.resolve()

verifiers/scripts/build.py

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,22 @@ def _wait_for_ready(
317317
return last_status
318318

319319

320+
def _resolve_env_push_target(raw_env_id: str | None, raw_path: str) -> tuple[str, Path]:
321+
base_path = Path(raw_path).expanduser().resolve()
322+
323+
if raw_env_id is None:
324+
env_dir = base_path
325+
env_id_underscore = env_dir.name
326+
if not env_id_underscore:
327+
raise ValueError("Could not infer environment id from --path.")
328+
else:
329+
_, env_id_underscore = _normalize_env_id(raw_env_id)
330+
env_dir = base_path / env_id_underscore
331+
332+
env_id_dash = env_id_underscore.replace("_", "-")
333+
return env_id_dash, env_dir
334+
335+
320336
def main(argv: list[str] | None = None) -> int:
321337
parser = argparse.ArgumentParser(
322338
description=(
@@ -326,29 +342,38 @@ def main(argv: list[str] | None = None) -> int:
326342
)
327343
parser.add_argument(
328344
"env",
329-
help="Environment id (hyphenated, e.g. openenv-echo).",
345+
nargs="?",
346+
help=(
347+
"Optional environment id (hyphenated, e.g. openenv-echo). "
348+
"When provided, it is appended to --path as the final directory name "
349+
"after converting hyphens to underscores."
350+
),
330351
)
331352
parser.add_argument(
332353
"-p",
333354
"--path",
334355
default="./environments",
335-
help="Path to the environments directory (default: ./environments).",
356+
help=(
357+
"Base path for environments (default: ./environments). "
358+
"When env id is omitted, this should point directly to the target "
359+
"environment directory."
360+
),
336361
)
337362
args = parser.parse_args(argv)
338363

339364
try:
340-
env_id_dash, env_id_underscore = _normalize_env_id(args.env)
365+
env_id_dash, env_path = _resolve_env_push_target(args.env, args.path)
366+
env_id_underscore = env_path.name
341367
except ValueError as e:
342368
print(str(e), file=sys.stderr)
343369
return 2
344370

345-
environments_root = Path(args.path).expanduser().resolve()
346-
if not environments_root.exists() or not environments_root.is_dir():
347-
print(f"Environments path not found: {environments_root}", file=sys.stderr)
371+
if not env_path.exists() or not env_path.is_dir():
372+
print(f"Environment path not found: {env_path}", file=sys.stderr)
348373
return 2
349374

350375
try:
351-
project_dir = _resolve_project_dir(environments_root, env_id_underscore)
376+
project_dir = _resolve_project_dir(env_path.parent, env_id_underscore)
352377
dockerfile = _find_dockerfile(project_dir)
353378
except FileNotFoundError as e:
354379
print(str(e), file=sys.stderr)

0 commit comments

Comments
 (0)