Skip to content

Commit

Permalink
bump spec check to 1
Browse files Browse the repository at this point in the history
  • Loading branch information
jo-fang committed Jun 25, 2024
1 parent 1f3c28f commit 60be105
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/workspaces/01_loading_and_cloning_workspaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
project = os.getenv("WANDB_PROJECT")

# 1. Load a workspace from URL
url = "https://wandb.ai/megatruong/workspace-api-demo2?nw=vnizqj6vq3"
url = "https://wandb.ai/megatruong/workspace-api-demo2?nw=puwusholo4x"
workspace = ws.Workspace.from_url(url)

# 2a. Edit the workspace and save to the same view
Expand Down
8 changes: 4 additions & 4 deletions tests/test_workspaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def test_filter_expr(expr, spec):


def test_load_workspace_from_url():
url = "https://wandb.ai/megatruong/workspace-api-demo?nw=vs71wsgdvrz"
url = "https://wandb.ai/megatruong/workspace-api-demo?nw=puwusholo4x"
workspace = ws.Workspace.from_url(url) # noqa: F841


Expand Down Expand Up @@ -192,9 +192,9 @@ def test_validate_no_emoji(example, should_pass):
"example, should_pass",
[
({}, False), # No version
({"version": 4}, False), # Lower version
({"version": 5}, True), # Expected version
({"version": 6}, False), # Higher version
({"section":{"version": 4}}, False), # Lower version
({"section":{"version": 5}}, True), # Expected version
({"section":{"version": 6}}, False), # Higher version
],
)
def test_validate_spec_version(example, should_pass):
Expand Down
3 changes: 2 additions & 1 deletion wandb_workspaces/utils/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ def validate_no_emoji(s: str) -> str:
def validate_spec_version(
spec: Dict[str, Any], *, expected_version: int
) -> Dict[str, Any]:
actual_version = spec.get("version", -1)
spec_section = spec.get("section", {})
actual_version = spec_section.get("version", -1)

if actual_version < expected_version:
raise SpecVersionError(
Expand Down
2 changes: 1 addition & 1 deletion wandb_workspaces/workspaces/internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
)
from wandb_workspaces.utils.validators import validate_spec_version

CLIENT_SPEC_VERSION = -1
CLIENT_SPEC_VERSION = 1
SPEC_VERSION_KEY = "version"


Expand Down

0 comments on commit 60be105

Please sign in to comment.