Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/uipath-agent-framework/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "uipath-agent-framework"
version = "0.1.0"
version = "0.1.1"
description = "Python SDK that enables developers to build and deploy Microsoft Agent Framework agents to the UiPath Cloud Platform"
readme = "README.md"
requires-python = ">=3.11"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def agent_framework_new_middleware(name: str) -> MiddlewareResult:

try:
with console.spinner(f"Creating new agent {name} in current directory ..."):
generate_pyproject(directory, name)
generate_script(directory)
console.success("Created 'main.py' file.")
console.success("Created 'agent_framework.json' file.")
Expand Down
23 changes: 22 additions & 1 deletion packages/uipath-agent-framework/tests/test_cli_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ def test_middleware_scaffolds_project_files(tmp_path, monkeypatch):
assert (tmp_path / "pyproject.toml").exists()


def test_middleware_reports_error_with_stacktrace_on_failure(monkeypatch):
def test_middleware_reports_error_with_stacktrace_on_failure(tmp_path, monkeypatch):
# The middleware scaffolds into the current directory, so keep the files
# it writes before failing out of the source tree.
monkeypatch.chdir(tmp_path)

def boom(*args, **kwargs):
raise OSError("disk full")

Expand All @@ -35,3 +39,20 @@ def boom(*args, **kwargs):

assert result.should_continue is False
assert result.should_include_stacktrace is True


def test_middleware_writes_pyproject_once(tmp_path, monkeypatch):
"""The scaffold generated pyproject.toml twice per run; guard against that."""
monkeypatch.chdir(tmp_path)
calls = []
original = cli_new.generate_pyproject

def counting(directory, project_name):
calls.append(directory)
return original(directory, project_name)

monkeypatch.setattr(cli_new, "generate_pyproject", counting)
result = agent_framework_new_middleware("demo")

assert result.should_continue is False
assert len(calls) == 1
2 changes: 1 addition & 1 deletion packages/uipath-agent-framework/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/uipath-google-adk/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "uipath-google-adk"
version = "0.1.0"
version = "0.1.1"
description = "Python SDK that enables developers to build and deploy Google ADK agents to the UiPath Cloud Platform"
readme = "README.md"
requires-python = ">=3.11"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ def google_adk_new_middleware(name: str) -> MiddlewareResult:

try:
with console.spinner(f"Creating new agent {name} in current directory ..."):
generate_pyproject(directory, name)
generate_script(directory)
console.success("Created 'main.py' file.")
console.success("Created 'google_adk.json' file.")
Expand Down
18 changes: 18 additions & 0 deletions packages/uipath-google-adk/tests/test_cli_new.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Tests for _cli/cli_new.py — project scaffolding middleware."""

from uipath_google_adk._cli import cli_new
from uipath_google_adk._cli.cli_new import (
generate_pyproject,
generate_script,
Expand Down Expand Up @@ -30,3 +31,20 @@ def test_creates_project_and_stops_pipeline(self, tmp_path, monkeypatch):
assert (tmp_path / "main.py").exists()
assert (tmp_path / "google_adk.json").exists()
assert (tmp_path / "pyproject.toml").exists()


def test_middleware_writes_pyproject_once(tmp_path, monkeypatch):
"""The scaffold generated pyproject.toml twice per run; guard against that."""
monkeypatch.chdir(tmp_path)
calls = []
original = cli_new.generate_pyproject

def counting(directory, project_name):
calls.append(directory)
return original(directory, project_name)

monkeypatch.setattr(cli_new, "generate_pyproject", counting)
result = google_adk_new_middleware("demo")

assert result.should_continue is False
assert len(calls) == 1
2 changes: 1 addition & 1 deletion packages/uipath-google-adk/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/uipath-llamaindex/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "uipath-llamaindex"
version = "0.6.1"
version = "0.6.2"
description = "Python SDK that enables developers to build and deploy LlamaIndex agents to the UiPath Cloud Platform"
readme = { file = "README.md", content-type = "text/markdown" }
requires-python = ">=3.11"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def llamaindex_new_middleware(name: str) -> MiddlewareResult:

try:
with console.spinner(f"Creating new agent {name} in current directory ..."):
generate_pyproject(directory, name)
generate_script(directory)
console.success("Created 'main.py' file.")
console.success("Created 'llama_index.json' file.")
Expand Down
41 changes: 41 additions & 0 deletions packages/uipath-llamaindex/tests/cli/test_new.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
"""Tests for the `uipath new` LlamaIndex scaffolding middleware."""

import pytest

from uipath_llamaindex._cli import cli_new
from uipath_llamaindex._cli.cli_new import llamaindex_new_middleware


def test_middleware_scaffolds_project_files(
tmp_path, monkeypatch: pytest.MonkeyPatch
) -> None:
"""The middleware writes main.py, llama_index.json and pyproject into cwd."""
monkeypatch.chdir(tmp_path)

result = llamaindex_new_middleware("my-agent")

assert result.should_continue is False
for name in ("main.py", "llama_index.json", "pyproject.toml"):
assert (tmp_path / name).exists()
pyproject = (tmp_path / "pyproject.toml").read_text()
assert 'name = "my-agent"' in pyproject
assert "uipath-llamaindex" in pyproject


def test_middleware_writes_pyproject_once(
tmp_path, monkeypatch: pytest.MonkeyPatch
) -> None:
"""The scaffold generated pyproject.toml twice per run; guard against that."""
monkeypatch.chdir(tmp_path)
calls = []
original = cli_new.generate_pyproject

def counting(directory, project_name):
calls.append(directory)
return original(directory, project_name)

monkeypatch.setattr(cli_new, "generate_pyproject", counting)
result = llamaindex_new_middleware("demo")

assert result.should_continue is False
assert len(calls) == 1
17 changes: 10 additions & 7 deletions packages/uipath-llamaindex/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/uipath-openai-agents/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "uipath-openai-agents"
version = "0.1.1"
version = "0.1.2"
description = "Python SDK that enables developers to build and deploy OpenAI agents to the UiPath Cloud Platform"
readme = "README.md"
requires-python = ">=3.11"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ def openai_agents_new_middleware(name: str) -> MiddlewareResult:

try:
with console.spinner(f"Creating new agent {name} in current directory ..."):
generate_pyproject(directory, name)
generate_script(directory)
console.success("Created 'main.py' file.")
console.success("Created 'openai_agents.json' file.")
Expand Down
17 changes: 17 additions & 0 deletions packages/uipath-openai-agents/tests/test_cli_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,20 @@ def boom(*args, **kwargs):
assert errors and "disk full" in errors[0]
assert result.should_continue is False
assert result.should_include_stacktrace is True


def test_middleware_writes_pyproject_once(tmp_path, monkeypatch):
"""The scaffold generated pyproject.toml twice per run; guard against that."""
monkeypatch.chdir(tmp_path)
calls = []
original = cli_new.generate_pyproject

def counting(directory, project_name):
calls.append(directory)
return original(directory, project_name)

monkeypatch.setattr(cli_new, "generate_pyproject", counting)
result = openai_agents_new_middleware("demo")

assert result.should_continue is False
assert len(calls) == 1
17 changes: 10 additions & 7 deletions packages/uipath-openai-agents/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading