softmax-cli 0.26.22__tar.gz → 0.26.23__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 (23) hide show
  1. {softmax_cli-0.26.22 → softmax_cli-0.26.23}/AGENTS.md +1 -1
  2. {softmax_cli-0.26.22 → softmax_cli-0.26.23}/CLAUDE.md +1 -1
  3. {softmax_cli-0.26.22/src/softmax_cli.egg-info → softmax_cli-0.26.23}/PKG-INFO +2 -2
  4. {softmax_cli-0.26.22 → softmax_cli-0.26.23}/README.md +1 -1
  5. {softmax_cli-0.26.22 → softmax_cli-0.26.23}/src/softmax/players.py +24 -0
  6. {softmax_cli-0.26.22 → softmax_cli-0.26.23/src/softmax_cli.egg-info}/PKG-INFO +2 -2
  7. {softmax_cli-0.26.22 → softmax_cli-0.26.23}/tests/test_player_cli.py +27 -0
  8. {softmax_cli-0.26.22 → softmax_cli-0.26.23}/BUILD.bazel +0 -0
  9. {softmax_cli-0.26.22 → softmax_cli-0.26.23}/pyproject.toml +0 -0
  10. {softmax_cli-0.26.22 → softmax_cli-0.26.23}/setup.cfg +0 -0
  11. {softmax_cli-0.26.22 → softmax_cli-0.26.23}/src/softmax/__init__.py +0 -0
  12. {softmax_cli-0.26.22 → softmax_cli-0.26.23}/src/softmax/_console.py +0 -0
  13. {softmax_cli-0.26.22 → softmax_cli-0.26.23}/src/softmax/auth.py +0 -0
  14. {softmax_cli-0.26.22 → softmax_cli-0.26.23}/src/softmax/cli.py +0 -0
  15. {softmax_cli-0.26.22 → softmax_cli-0.26.23}/src/softmax/perform_login.py +0 -0
  16. {softmax_cli-0.26.22 → softmax_cli-0.26.23}/src/softmax_cli.egg-info/SOURCES.txt +0 -0
  17. {softmax_cli-0.26.22 → softmax_cli-0.26.23}/src/softmax_cli.egg-info/dependency_links.txt +0 -0
  18. {softmax_cli-0.26.22 → softmax_cli-0.26.23}/src/softmax_cli.egg-info/entry_points.txt +0 -0
  19. {softmax_cli-0.26.22 → softmax_cli-0.26.23}/src/softmax_cli.egg-info/requires.txt +0 -0
  20. {softmax_cli-0.26.22 → softmax_cli-0.26.23}/src/softmax_cli.egg-info/top_level.txt +0 -0
  21. {softmax_cli-0.26.22 → softmax_cli-0.26.23}/tests/BUILD.bazel +0 -0
  22. {softmax_cli-0.26.22 → softmax_cli-0.26.23}/tests/test_auth_login.py +0 -0
  23. {softmax_cli-0.26.22 → softmax_cli-0.26.23}/tests/test_python_api.py +0 -0
@@ -37,7 +37,7 @@ Tests cover auth/login, the Python API, player identity switching, and CLI plugi
37
37
  ## Lint
38
38
 
39
39
  ```bash
40
- uv run metta lint --fix # ruff (also runs via the Edit/Write hook)
40
+ ./bazel/fix_lint.sh # ruff (also runs via the Edit/Write hook)
41
41
  ```
42
42
 
43
43
  ## Source layout (`src/softmax/`)
@@ -37,7 +37,7 @@ Tests cover auth/login, the Python API, player identity switching, and CLI plugi
37
37
  ## Lint
38
38
 
39
39
  ```bash
40
- uv run metta lint --fix # ruff (also runs via the Edit/Write hook)
40
+ ./bazel/fix_lint.sh # ruff (also runs via the Edit/Write hook)
41
41
  ```
42
42
 
43
43
  ## Source layout (`src/softmax/`)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: softmax-cli
3
- Version: 0.26.22
3
+ Version: 0.26.23
4
4
  Summary: Softmax CLI — authentication and account tools
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: Programming Language :: Python :: 3.11
@@ -49,7 +49,7 @@ uv run softmax player unset # revert to your main user credential
49
49
 
50
50
  ```bash
51
51
  uv run metta pytest packages/softmax-cli/tests -v # run tests
52
- uv run metta lint --fix # lint/format
52
+ ./bazel/fix_lint.sh # lint/format
53
53
  ```
54
54
 
55
55
  See [AGENTS.md](AGENTS.md) for the source layout and versioning/compatibility notes.
@@ -29,7 +29,7 @@ uv run softmax player unset # revert to your main user credential
29
29
 
30
30
  ```bash
31
31
  uv run metta pytest packages/softmax-cli/tests -v # run tests
32
- uv run metta lint --fix # lint/format
32
+ ./bazel/fix_lint.sh # lint/format
33
33
  ```
34
34
 
35
35
  See [AGENTS.md](AGENTS.md) for the source layout and versioning/compatibility notes.
@@ -53,6 +53,17 @@ def list_players(*, server: str, token: str) -> list[PlayerResponse]:
53
53
  return [PlayerResponse.model_validate(entry) for entry in response.json()]
54
54
 
55
55
 
56
+ def create_player(*, server: str, token: str, name: str) -> PlayerResponse:
57
+ response = httpx.post(
58
+ f"{server.rstrip('/')}/observatory/players",
59
+ headers={"Authorization": f"Bearer {token}"},
60
+ json={"name": name},
61
+ timeout=10.0,
62
+ )
63
+ response.raise_for_status()
64
+ return PlayerResponse.model_validate(response.json())
65
+
66
+
56
67
  def login_player(*, server: str, token: str, player_id: str) -> PlayerLoginResponse:
57
68
  response = httpx.post(
58
69
  f"{server.rstrip('/')}/observatory/players/{player_id}/login",
@@ -102,6 +113,19 @@ def player_list(
102
113
  console.print("[dim]No active player; commands act as your main user.[/dim]")
103
114
 
104
115
 
116
+ @player_app.command("create")
117
+ def player_create(
118
+ name: Annotated[str, typer.Argument(help="Name for the new player.")],
119
+ server: Annotated[str, typer.Option("--server", help="API server URL.")] = DEFAULT_API_SERVER,
120
+ json_output: Annotated[bool, typer.Option("--json", help="Print raw JSON.")] = False,
121
+ ) -> None:
122
+ player = create_player(server=server, token=_user_token(server), name=name)
123
+ if json_output:
124
+ print(json.dumps(player.model_dump(mode="json"), indent=2))
125
+ return
126
+ console.print(f"[green]Created player[/green] [bold]{player.name}[/bold] ({player.id})")
127
+
128
+
105
129
  @player_app.command("use")
106
130
  def player_use(
107
131
  player_id: Annotated[str, typer.Argument(help="Player ID (ply_...) to act as.")],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: softmax-cli
3
- Version: 0.26.22
3
+ Version: 0.26.23
4
4
  Summary: Softmax CLI — authentication and account tools
5
5
  Classifier: Programming Language :: Python :: 3
6
6
  Classifier: Programming Language :: Python :: 3.11
@@ -49,7 +49,7 @@ uv run softmax player unset # revert to your main user credential
49
49
 
50
50
  ```bash
51
51
  uv run metta pytest packages/softmax-cli/tests -v # run tests
52
- uv run metta lint --fix # lint/format
52
+ ./bazel/fix_lint.sh # lint/format
53
53
  ```
54
54
 
55
55
  See [AGENTS.md](AGENTS.md) for the source layout and versioning/compatibility notes.
@@ -92,6 +92,33 @@ def test_list_json_includes_active_flag(httpserver: HTTPServer, _mock_user_auth:
92
92
  assert by_id[PLAYER_BETA["id"]] is False
93
93
 
94
94
 
95
+ def test_create_outputs_id(httpserver: HTTPServer, _mock_user_auth: None) -> None:
96
+ server = httpserver.url_for("")
97
+ httpserver.expect_request(
98
+ "/observatory/players",
99
+ method="POST",
100
+ headers={"Authorization": "Bearer user-token"},
101
+ ).respond_with_json(PLAYER_BETA)
102
+
103
+ result = CliRunner().invoke(app, ["player", "create", "Beta", "--server", server])
104
+
105
+ assert result.exit_code == 0, result.output
106
+ assert "Created player" in result.output
107
+ assert PLAYER_BETA["id"] in result.output
108
+
109
+
110
+ def test_create_json(httpserver: HTTPServer, _mock_user_auth: None) -> None:
111
+ server = httpserver.url_for("")
112
+ httpserver.expect_request("/observatory/players", method="POST").respond_with_json(PLAYER_BETA)
113
+
114
+ result = CliRunner().invoke(app, ["player", "create", "Beta", "--server", server, "--json"])
115
+
116
+ assert result.exit_code == 0, result.output
117
+ payload = json.loads(result.output)
118
+ assert payload["id"] == PLAYER_BETA["id"]
119
+ assert payload["name"] == "Beta"
120
+
121
+
95
122
  def test_use_mints_and_activates(httpserver: HTTPServer, _mock_user_auth: None) -> None:
96
123
  server = httpserver.url_for("")
97
124
  expires_at = (datetime.now(UTC) + timedelta(hours=24)).isoformat()
File without changes
File without changes