Build AI methods with your coding agent, then run them anywhere: as an MCP for chatbots, as a webapp for people, or via API for your software.
Feature/graph and method cli (#727)
Thomas Hebrardebb422781865
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex c3c5b40db..a483e103c 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1,5 +1,13 @@# Changelog+## [Unreleased]++### Added++- **GitHub URL support for CLI method targets** — All CLI commands accepting a method target (`pipelex validate method`, `pipelex run method`, `pipelex build inputs method`, etc.) now accept a public GitHub URL (e.g., `https://github.com/org/repo/tree/main/methods/my-method`). The repository is cloned automatically, and the method package is discovered and validated. Subdirectory URLs are supported.+- **Local path support for CLI method targets** — Method targets can now also be local filesystem paths pointing to a directory containing a `METHODS.toml`. This works for both `pipelex` and `pipelex-agent` CLIs.+- Added `clone_default_branch()` in `mthds` package for shallow-cloning a git repository's default branch.+## [v0.18.5] - 2026-03-01### Changeddiff --git a/pipelex/builder/builder_loop.py b/pipelex/builder/builder_loop.pyindex 801603307..5dc994836 100644--- a/pipelex/builder/builder_loop.py+++ b/pipelex/builder/builder_loop.py@@ -2,7 +2,7 @@ import refrom pathlib import Pathfrom typing import TYPE_CHECKING, cast-from mthds.client.models.pipeline_inputs import PipelineInputs+from mthds.models.pipeline_inputs import PipelineInputsfrom mthds.package.bundle_scanner import build_domain_exports_from_scan, scan_bundles_for_domain_infofrom mthds.package.discovery import MANIFEST_FILENAMEfrom mthds.package.manifest.parser import serialize_manifest_to_tomldiff --git a/pipelex/cli/installed_methods.py b/pipelex/cli/installed_methods.pyindex 2f36526ff..9b7cd4d51 100644--- a/pipelex/cli/installed_methods.py+++ b/pipelex/cli/installed_methods.py@@ -108,7 +108,7 @@ def discover_installed_methods(return methods-def _discover_method_at(method_dir: Path, seen_dirs: set[Path]) -> InstalledMethod | None:+def discover_method_at(method_dir: Path, seen_dirs: set[Path]) -> InstalledMethod | None:"""Try to discover a single method at *method_dir*.Returns an ``InstalledMethod`` if the directory contains a ``METHODS.toml``,@@ -165,7 +165,7 @@ def discover_methods_from_library_dirs(continue# First, check if the directory itself is a method- method = _discover_method_at(lib_dir, seen_dirs)+ method = discover_method_at(lib_dir, seen_dirs)if method is not None:methods.append(method)continue@@ -173,7 +173,7 @@ def discover_methods_from_library_dirs(# Otherwise, recursively find all METHODS.toml files below this directoryfor manifest_path in sorted(lib_dir.rglob(MANIFEST_FILENAME)):method_dir = manifest_path.parent- sub_method = _discover_method_at(method_dir, seen_dirs)+ sub_method = discover_method_at(method_dir, seen_dirs)if sub_method is not None:methods.append(sub_method)diff --git a/pipelex/cli/method_resolver.py b/pipelex/cli/method_resolver.pyindex 059b91450..c1be08374 100644--- a/pipelex/cli/method_resolver.py+++ b/pipelex/cli/method_resolver.py@@ -1,12 +1,20 @@from __future__ import annotations+import atexit+import shutil+import tempfile+from pathlib import Path+import typer+from mthds.package.exceptions import VCSFetchError+from mthds.package.vcs_resolver import clone_default_branchfrom pipelex.cli.installed_methods import (DuplicateMethodNameError,InstalledMethod,MethodNotFoundError,discover_installed_methods,+ discover_method_at,find_method_by_name,)@@ -52,44 +60,215 @@ def _find_method_by_exported_pipe(pipe_code: str) -> InstalledMethod:return matches[0]-def resolve_method_target(- method_name: str,- pipe_override: str | None = None,- library_dirs: list[str] | None = None,-) -> tuple[str, list[str], InstalledMethod]:- """Resolve a method name to (pipe_code, library_dirs, method).+def is_github_url(target: str) -> bool:+ """Return True if *target* looks like a GitHub URL."""+ return target.startswith(("https://github.com/", "http://github.com/"))- Finds the installed method by name, determines the pipe to run- (using pipe_override or main_pipe), and returns the library directories- needed to load the method's bundles along with the method itself.++def parse_github_url(url: str) -> tuple[str, str | None]:+ """Extract an HTTPS clone URL and optional sub-path from a GitHub URL.++ Handles plain repo URLs (``https://github.com/org/repo``), repo URLs+ with a trailing ``.git``, and subdirectory URLs such as+ ``https://github.com/org/repo/tree/branch/path/to/dir`` or the shorthand+ ``https://github.com/org/repo/path/to/dir`` that GitHub auto-resolves.Args:- method_name: The installed method name to resolve.- pipe_override: Optional pipe code override (takes precedence over main_pipe).- library_dirs: Additional directories to search for methods.+ url: A GitHub URL pointing to a repository or a subdirectory within it.Returns:- A tuple of (pipe_code, library_dirs, installed_method) for execution.+ A tuple of (clone_url, sub_path). *sub_path* is ``None`` when the URL+ points to the repository root.+ """+ clean = url.rstrip("/")++ # Strip .git suffix before parsing+ if clean.endswith(".git"):+ return (clean, None)++ # Split off the scheme + github.com prefix+ # URL looks like https://github.com/owner/repo[/rest...]+ for prefix in ("https://github.com/", "http://github.com/"):+ if clean.startswith(prefix):+ remainder = clean[len(prefix) :]+ break+ else:+ # Should not happen since callers check is_github_url first+ clone_url = f"{clean}.git"+ return (clone_url, None)++ parts = remainder.split("/")+ if len(parts) < 2:+ clone_url = f"{clean}.git"+ return (clone_url, None)++ owner = parts[0]+ repo = parts[1]+ scheme = "https" if clean.startswith("https") else "http"+ clone_url = f"{scheme}://github.com/{owner}/{repo}.git"++ # No extra path segments → repo root+ if len(parts) <= 2:+ return (clone_url, None)++ # Handle /tree/<branch>/path/... or /blob/<branch>/path/...+ rest = parts[2:]+ if rest[0] in {"tree", "blob"} and len(rest) >= 2:+ # Skip the segment type and branch name+ sub_parts = rest[2:]+ sub_path = "/".join(sub_parts) if sub_parts else None+ else:+ # Shorthand: https://github.com/owner/repo/path/to/dir+ sub_path = "/".join(rest)++ return (clone_url, sub_path or None)+++def is_local_path(target: str) -> bool:+ """Return True if *target* looks like a filesystem path (absolute or relative with separators)."""+ if target.startswith(("https://", "http://")):+ return False+ return "/" in target or "\\" in target+++def resolve_method_from_path(method_path: str) -> InstalledMethod:+ """Discover a method package from a local filesystem path.++ Args:+ method_path: A filesystem path to a directory containing a method package.++ Returns:+ The discovered ``InstalledMethod``.Raises:- typer.Exit: On resolution errors with user-friendly messages.+ typer.Exit: If the path doesn't exist or contains no method package."""+ method_dir = Path(method_path)+ if not method_dir.is_dir():+ typer.secho(+ f"Directory '{method_path}' does not exist.",+ fg=typer.colors.RED,+ err=True,+ )+ raise typer.Exit(1)++ seen_dirs: set[Path] = set()+ method = discover_method_at(method_dir, seen_dirs)+ if method is None:+ typer.secho(+ f"No method package (METHODS.toml) found at '{method_path}'.",+ fg=typer.colors.RED,+ err=True,+ )+ raise typer.Exit(1)++ return method+++def resolve_method_from_url(url: str) -> InstalledMethod:+ """Clone a remote repository and discover the method package inside it.++ Supports both repo-root URLs (``https://github.com/org/repo``) and+ subdirectory URLs (``https://github.com/org/repo/tree/main/path/to/method``+ or the shorthand ``https://github.com/org/repo/path/to/method``).++ Uses a temporary directory that persists for the duration of the CLI+ process, so the cloned files remain available for subsequent steps.++ Args:+ url: A GitHub URL pointing to a repository or subdirectory+ containing a method package.++ Returns:+ The discovered ``InstalledMethod``.++ Raises:+ typer.Exit: On clone failure or if no method package is found.+ """+ clone_url, sub_path = parse_github_url(url)+ dest = Path(tempfile.mkdtemp(prefix="mthds_remote_"))+ atexit.register(shutil.rmtree, dest, True)+try:- method = find_method_by_name(method_name, library_dirs=library_dirs)- except MethodNotFoundError as exc:+ clone_default_branch(clone_url, dest)+ except VCSFetchError as exc:typer.secho(- f"Method '{method_name}' is not installed. Check installed methods with: ls ~/.mthds/methods/ or ls .mthds/methods/",+ f"Failed to clone repository from '{url}': {exc.message}",fg=typer.colors.RED,err=True,)raise typer.Exit(1) from exc- except DuplicateMethodNameError as exc:++ # Determine the method directory (repo root or a sub-path within it)+ method_dir = dest / sub_path if sub_path else dest++ if not method_dir.is_dir():typer.secho(- f"Ambiguous method name '{method_name}': {exc.message}",+ f"Path '{sub_path}' not found in the cloned repository from '{url}'.",fg=typer.colors.RED,err=True,)- raise typer.Exit(1) from exc+ raise typer.Exit(1)++ # Discover the method package+ seen_dirs: set[Path] = set()+ method = discover_method_at(method_dir, seen_dirs)+ if method is None:+ typer.secho(+ f"No method package (METHODS.toml) found at '{url}'.",+ fg=typer.colors.RED,+ err=True,+ )+ raise typer.Exit(1)++ return method+++def resolve_method_target(+ method_name: str,+ pipe_override: str | None = None,+ library_dirs: list[str] | None = None,+) -> tuple[str, list[str], InstalledMethod]:+ """Resolve a method name or GitHub URL to (pipe_code, library_dirs, method).++ Finds the installed method by name (or clones from a GitHub URL),+ determines the pipe to run (using pipe_override or main_pipe), and+ returns the library directories needed to load the method's bundles+ along with the method itself.++ Args:+ method_name: The installed method name or GitHub URL to resolve.+ pipe_override: Optional pipe code override (takes precedence over main_pipe).+ library_dirs: Additional directories to search for methods.++ Returns:+ A tuple of (pipe_code, library_dirs, installed_method) for execution.++ Raises:+ typer.Exit: On resolution errors with user-friendly messages.+ """+ method: InstalledMethod+ if is_github_url(method_name):+ method = resolve_method_from_url(method_name)+ elif is_local_path(method_name):+ method = resolve_method_from_path(method_name)+ else:+ try:+ method = find_method_by_name(method_name, library_dirs=library_dirs)+ except MethodNotFoundError as exc:+ typer.secho(+ f"Method '{method_name}' is not installed. Check installed methods with: ls ~/.mthds/methods/ or ls .mthds/methods/",+ fg=typer.colors.RED,+ err=True,+ )+ raise typer.Exit(1) from exc+ except DuplicateMethodNameError as exc:+ typer.secho(+ f"Ambiguous method name '{method_name}': {exc.message}",+ fg=typer.colors.RED,+ err=True,+ )+ raise typer.Exit(1) from exc# Determine pipe codepipe_code: strdiff --git a/pipelex/core/concepts/concept.py b/pipelex/core/concepts/concept.pyindex 9707b06ed..478d8ce89 100644--- a/pipelex/core/concepts/concept.py+++ b/pipelex/core/concepts/concept.py@@ -1,7 +1,7 @@from typing import Any, Callablefrom kajson.kajson_manager import KajsonManager-from mthds.client.models.concept import ConceptAbstract+from mthds.models.concept import ConceptAbstractfrom pydantic import field_validatorfrom pipelex import logdiff --git a/pipelex/core/memory/working_memory.py b/pipelex/core/memory/working_memory.pyindex 2f8bed7f0..bdb9454ee 100644--- a/pipelex/core/memory/working_memory.py+++ b/pipelex/core/memory/working_memory.py@@ -1,7 +1,7 @@from operator import attrgetterfrom typing import Any, cast-from mthds.client.models.working_memory import WorkingMemoryAbstract+from mthds.models.working_memory import WorkingMemoryAbstractfrom pydantic import Field, model_validatorfrom typing_extensions import overridediff --git a/pipelex/core/memory/working_memory_factory.py b/pipelex/core/memory/working_memory_factory.pyindex 95096f0ac..89859f590 100644--- a/pipelex/core/memory/working_memory_factory.py+++ b/pipelex/core/memory/working_memory_factory.py@@ -1,5 +1,5 @@import shortuuid-from mthds.client.models.pipeline_inputs import PipelineInputs+from mthds.models.pipeline_inputs import PipelineInputsfrom pydantic import BaseModelfrom pipelex import logdiff --git a/pipelex/core/pipes/pipe_output.py b/pipelex/core/pipes/pipe_output.pyindex f6cae7b74..23fa91b3f 100644--- a/pipelex/core/pipes/pipe_output.py+++ b/pipelex/core/pipes/pipe_output.py@@ -1,6 +1,6 @@from typing import TypeVar-from mthds.client.models.pipe_output import PipeOutputAbstract+from mthds.models.pipe_output import PipeOutputAbstractfrom pydantic import Fieldfrom pipelex.core.memory.working_memory import WorkingMemorydiff --git a/pipelex/core/stuffs/stuff.py b/pipelex/core/stuffs/stuff.pyindex a36361009..9a1c81ec4 100644--- a/pipelex/core/stuffs/stuff.py+++ b/pipelex/core/stuffs/stuff.py@@ -2,7 +2,7 @@from typing import Any, cast, get_args, get_originfrom kajson import kajson-from mthds.client.models.stuff import DictStuffAbstract, StuffAbstract+from mthds.models.stuff import DictStuffAbstract, StuffAbstractfrom pydantic import ValidationErrorfrom typing_extensions import overridediff --git a/pipelex/core/stuffs/stuff_content.py b/pipelex/core/stuffs/stuff_content.pyindex 975d376ed..56b670f07 100644--- a/pipelex/core/stuffs/stuff_content.py+++ b/pipelex/core/stuffs/stuff_content.py@@ -1,7 +1,7 @@from typing import Any, TypeVar, finalfrom kajson import kajson-from mthds.client.models.stuff import StuffContentAbstract+from mthds.models.stuff import StuffContentAbstractfrom rich.json import JSONfrom typing_extensions import overridediff --git a/pipelex/core/stuffs/stuff_factory.py b/pipelex/core/stuffs/stuff_factory.pyindex 51b5c4d2e..2fe782082 100644--- a/pipelex/core/stuffs/stuff_factory.py+++ b/pipelex/core/stuffs/stuff_factory.py@@ -1,7 +1,7 @@from typing import Any, castimport shortuuid-from mthds.client.models.pipeline_inputs import StuffContentOrData+from mthds.models.pipeline_inputs import StuffContentOrDatafrom pydantic import BaseModel, ValidationError, field_validatorfrom pipelex.core.concepts.concept import Conceptdiff --git a/pipelex/pipeline/pipeline_run_setup.py b/pipelex/pipeline/pipeline_run_setup.pyindex 60e1bb11a..67aeff08c 100644--- a/pipelex/pipeline/pipeline_run_setup.py+++ b/pipelex/pipeline/pipeline_run_setup.py@@ -1,7 +1,7 @@from pathlib import Pathfrom typing import TYPE_CHECKING-from mthds.client.models.pipeline_inputs import PipelineInputs+from mthds.models.pipeline_inputs import PipelineInputsfrom pipelex import logfrom pipelex.core.interpreter.interpreter import PipelexInterpreterdiff --git a/pipelex/pipeline/runner.py b/pipelex/pipeline/runner.pyindex 4cef85b60..f671242cf 100644--- a/pipelex/pipeline/runner.py+++ b/pipelex/pipeline/runner.py@@ -27,10 +27,10 @@ from pipelex.tools.typing.pydantic_utils import format_pydantic_validation_errorif TYPE_CHECKING:import asyncio- from mthds.client.models.pipe_output import VariableMultiplicity- from mthds.client.models.pipeline_inputs import PipelineInputs- from mthds.client.models.working_memory import WorkingMemoryAbstractfrom mthds.client.pipeline import PipelineStartResponse+ from mthds.models.pipe_output import VariableMultiplicity+ from mthds.models.pipeline_inputs import PipelineInputs+ from mthds.models.working_memory import WorkingMemoryAbstractfrom pipelex.core.memory.working_memory import WorkingMemoryfrom pipelex.core.pipes.pipe_output import PipeOutputdiff --git a/pyproject.toml b/pyproject.tomlindex d2a9a145f..986422137 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -28,7 +28,7 @@ dependencies = ["json2html>=1.3.0","kajson==0.3.1","markdown>=3.6",- "mthds>=0.0.6",+ "mthds>=0.0.7","networkx>=3.4.2","openai>=1.108.1","opentelemetry-api",diff --git a/tests/integration/pipelex/core/memory/test_working_memory_factory.py b/tests/integration/pipelex/core/memory/test_working_memory_factory.pyindex e8a152464..ccc524a9b 100644--- a/tests/integration/pipelex/core/memory/test_working_memory_factory.py+++ b/tests/integration/pipelex/core/memory/test_working_memory_factory.py@@ -9,7 +9,7 @@ from pipelex.core.stuffs.text_content import TextContentfrom tests.cases.images import ImageTestCasesif TYPE_CHECKING:- from mthds.client.models.pipeline_inputs import PipelineInputs+ from mthds.models.pipeline_inputs import PipelineInputsclass TestWorkingMemoryFactory:diff --git a/tests/unit/pipelex/cli/test_installed_methods.py b/tests/unit/pipelex/cli/test_installed_methods.pyindex 4eccdf2d8..e04078902 100644--- a/tests/unit/pipelex/cli/test_installed_methods.py+++ b/tests/unit/pipelex/cli/test_installed_methods.py@@ -26,6 +26,9 @@ version = "0.1.0"description = "A test method"{name_line}main_pipe = "test_pipe"++[exports.test]+pipes = ["test_pipe"]"""diff --git a/tests/unit/pipelex/cli/test_method_resolver.py b/tests/unit/pipelex/cli/test_method_resolver.pynew file mode 100644index 000000000..b74f55f70--- /dev/null+++ b/tests/unit/pipelex/cli/test_method_resolver.py@@ -0,0 +1,225 @@+"""Unit tests for GitHub URL and local path support in resolve_method_target."""++from __future__ import annotations++from typing import TYPE_CHECKING++import pytest+import typer+from mthds.package.discovery import MANIFEST_FILENAME+from mthds.package.exceptions import VCSFetchError++from pipelex.cli.method_resolver import (+ is_github_url,+ is_local_path,+ parse_github_url,+ resolve_method_from_path,+ resolve_method_from_url,+ resolve_method_target,+)++if TYPE_CHECKING:+ from pathlib import Path++ from pytest_mock import MockerFixture++MINIMAL_MANIFEST = """\+[package]+address = "github.com/test/remote-method"+version = "0.1.0"+description = "A remote test method"+name = "remote-method"+main_pipe = "test_pipe"++[exports.test]+pipes = ["test_pipe"]+"""+++def _write_method_package(dest: Path) -> None:+ """Write a minimal method package (METHODS.toml + .mthds file) into *dest*."""+ dest.mkdir(parents=True, exist_ok=True)+ (dest / MANIFEST_FILENAME).write_text(MINIMAL_MANIFEST, encoding="utf-8")+ (dest / "core.mthds").write_text("# placeholder", encoding="utf-8")+++class TestResolveMethodTarget:+ """Tests for GitHub URL detection, parsing, and resolution in the method resolver."""++ @pytest.mark.parametrize(+ "url",+ [+ "https://github.com/org/repo",+ "https://github.com/org/repo.git",+ "https://github.com/org/repo/",+ "http://github.com/org/repo",+ "https://github.com/org/repo/tree/main/methods/my-method",+ ],+ )+ def test_is_github_url_positive(self, url: str) -> None:+ """Various valid GitHub URLs are correctly detected."""+ assert is_github_url(url) is True++ @pytest.mark.parametrize(+ "target",+ [+ "my-method",+ "some-random-string",+ "github.com/org/repo",+ "https://gitlab.com/org/repo",+ "",+ ],+ )+ def test_is_github_url_negative(self, target: str) -> None:+ """Method names and non-GitHub strings are not detected as GitHub URLs."""+ assert is_github_url(target) is False++ @pytest.mark.parametrize(+ ("url", "expected_clone_url", "expected_sub_path"),+ [+ ("https://github.com/org/repo", "https://github.com/org/repo.git", None),+ ("https://github.com/org/repo/", "https://github.com/org/repo.git", None),+ ("https://github.com/org/repo.git", "https://github.com/org/repo.git", None),+ ("http://github.com/org/repo", "http://github.com/org/repo.git", None),+ (+ "https://github.com/org/repo/tree/main/methods/my-method",+ "https://github.com/org/repo.git",+ "methods/my-method",+ ),+ (+ "https://github.com/org/repo/methods/my-method",+ "https://github.com/org/repo.git",+ "methods/my-method",+ ),+ ],+ )+ def test_parse_github_url(self, url: str, expected_clone_url: str, expected_sub_path: str | None) -> None:+ """Clone URL and sub-path are correctly extracted from various GitHub URL formats."""+ clone_url, sub_path = parse_github_url(url)+ assert clone_url == expected_clone_url+ assert sub_path == expected_sub_path++ def test_resolve_method_from_url_success(self, mocker: MockerFixture, tmp_path: Path) -> None:+ """A successful clone containing a valid package returns an InstalledMethod."""+ dest_dir = tmp_path / "cloned"++ def fake_clone(_clone_url: str, destination: Path) -> None:+ _write_method_package(destination)++ mocker.patch("pipelex.cli.method_resolver.clone_default_branch", side_effect=fake_clone)+ mocker.patch("pipelex.cli.method_resolver.tempfile.mkdtemp", return_value=str(dest_dir))++ method = resolve_method_from_url("https://github.com/test/remote-method")++ assert method.name == "remote-method"+ assert method.manifest.main_pipe == "test_pipe"+ assert len(method.mthds_files) == 1++ def test_resolve_method_from_url_with_sub_path(self, mocker: MockerFixture, tmp_path: Path) -> None:+ """A subdirectory URL correctly discovers the method in the sub-path."""+ dest_dir = tmp_path / "cloned"++ def fake_clone(_clone_url: str, destination: Path) -> None:+ destination.mkdir(parents=True, exist_ok=True)+ _write_method_package(destination / "methods" / "my-method")++ mocker.patch("pipelex.cli.method_resolver.clone_default_branch", side_effect=fake_clone)+ mocker.patch("pipelex.cli.method_resolver.tempfile.mkdtemp", return_value=str(dest_dir))++ method = resolve_method_from_url("https://github.com/test/repo/methods/my-method")++ assert method.name == "remote-method"+ assert method.manifest.main_pipe == "test_pipe"++ def test_resolve_method_from_url_clone_failure(self, mocker: MockerFixture, tmp_path: Path) -> None:+ """A VCSFetchError during clone raises typer.Exit."""+ mocker.patch(+ "pipelex.cli.method_resolver.clone_default_branch",+ side_effect=VCSFetchError("connection refused"),+ )+ mocker.patch("pipelex.cli.method_resolver.tempfile.mkdtemp", return_value=str(tmp_path / "dest"))++ with pytest.raises(typer.Exit):+ resolve_method_from_url("https://github.com/test/broken-repo")++ def test_resolve_method_from_url_no_manifest(self, mocker: MockerFixture, tmp_path: Path) -> None:+ """A clone that contains no METHODS.toml raises typer.Exit."""+ dest_dir = tmp_path / "empty"++ def fake_clone(_clone_url: str, destination: Path) -> None:+ destination.mkdir(parents=True, exist_ok=True)++ mocker.patch("pipelex.cli.method_resolver.clone_default_branch", side_effect=fake_clone)+ mocker.patch("pipelex.cli.method_resolver.tempfile.mkdtemp", return_value=str(dest_dir))++ with pytest.raises(typer.Exit):+ resolve_method_from_url("https://github.com/test/no-manifest")++ def test_resolve_method_target_dispatches_to_url(self, mocker: MockerFixture, tmp_path: Path) -> None:+ """resolve_method_target dispatches to resolve_method_from_url for GitHub URLs."""+ dest_dir = tmp_path / "dispatched"++ def fake_clone(_clone_url: str, destination: Path) -> None:+ _write_method_package(destination)++ mocker.patch("pipelex.cli.method_resolver.clone_default_branch", side_effect=fake_clone)+ mocker.patch("pipelex.cli.method_resolver.tempfile.mkdtemp", return_value=str(dest_dir))++ pipe_code, lib_dirs, method = resolve_method_target("https://github.com/test/remote-method")++ assert pipe_code == "test_pipe"+ assert method.name == "remote-method"+ assert len(lib_dirs) == 1++ @pytest.mark.parametrize(+ ("target", "expected"),+ [+ ("/absolute/path/to/method", True),+ ("./relative/path", True),+ ("../parent/path", True),+ ("path/with/slash", True),+ ("my-method", False),+ ("simple_name", False),+ ("", False),+ ("https://gitlab.com/org/repo", False),+ ("http://bitbucket.org/org/repo", False),+ ],+ )+ def test_is_local_path(self, target: str, expected: bool) -> None:+ """Strings with path separators are detected as local paths; URLs are not."""+ assert is_local_path(target) is expected++ def test_resolve_method_from_path_success(self, tmp_path: Path) -> None:+ """A local directory with a valid method package is discovered."""+ method_dir = tmp_path / "local-method"+ _write_method_package(method_dir)++ method = resolve_method_from_path(str(method_dir))++ assert method.name == "remote-method"+ assert method.manifest.main_pipe == "test_pipe"+ assert len(method.mthds_files) == 1++ def test_resolve_method_from_path_not_a_directory(self, tmp_path: Path) -> None:+ """A non-existent path raises typer.Exit."""+ with pytest.raises(typer.Exit):+ resolve_method_from_path(str(tmp_path / "does-not-exist"))++ def test_resolve_method_from_path_no_manifest(self, tmp_path: Path) -> None:+ """A directory without METHODS.toml raises typer.Exit."""+ empty_dir = tmp_path / "empty"+ empty_dir.mkdir()++ with pytest.raises(typer.Exit):+ resolve_method_from_path(str(empty_dir))++ def test_resolve_method_target_dispatches_to_local_path(self, tmp_path: Path) -> None:+ """resolve_method_target dispatches to resolve_method_from_path for local paths."""+ method_dir = tmp_path / "local-method"+ _write_method_package(method_dir)++ pipe_code, lib_dirs, method = resolve_method_target(str(method_dir))++ assert pipe_code == "test_pipe"+ assert method.name == "remote-method"+ assert len(lib_dirs) == 1diff --git a/tests/unit/pipelex/core/stuffs/data.py b/tests/unit/pipelex/core/stuffs/data.pyindex 0338e2bce..2a6cd07fa 100644--- a/tests/unit/pipelex/core/stuffs/data.py+++ b/tests/unit/pipelex/core/stuffs/data.py@@ -1,7 +1,7 @@from typing import ClassVarfrom markupsafe import escape-from mthds.client.models.pipeline_inputs import StuffContentOrData+from mthds.models.pipeline_inputs import StuffContentOrDatafrom pydantic import Fieldfrom pipelex.core.concepts.concept_factory import ConceptFactorydiff --git a/tests/unit/pipelex/core/stuffs/test_stuff_factory_implicit_memory.py b/tests/unit/pipelex/core/stuffs/test_stuff_factory_implicit_memory.pyindex e00b49396..2c3ff718f 100644--- a/tests/unit/pipelex/core/stuffs/test_stuff_factory_implicit_memory.py+++ b/tests/unit/pipelex/core/stuffs/test_stuff_factory_implicit_memory.py@@ -3,7 +3,7 @@ from pathlib import Pathfrom typing import Any, Callableimport pytest-from mthds.client.models.pipeline_inputs import StuffContentOrData+from mthds.models.pipeline_inputs import StuffContentOrDatafrom pipelex import log, pretty_printfrom pipelex.core.concepts.concept_factory import ConceptFactorydiff --git a/uv.lock b/uv.lockindex c1cf8b8b5..642ac0c3f 100644--- a/uv.lock+++ b/uv.lock@@ -2393,7 +2393,7 @@ wheels = [[[package]]name = "mthds"-version = "0.0.6"+version = "0.0.7"source = { registry = "https://pypi.org/simple" }dependencies = [{ name = "backports-strenum", marker = "python_full_version < '3.11'" },@@ -2404,9 +2404,9 @@ dependencies = [{ name = "tomlkit" },{ name = "typing-extensions" },]-sdist = { url = "https://files.pythonhosted.org/packages/6f/ad/4effa77d1b8b49a2b8b761f401336d0d145277d7cdc796fab67212993ea6/mthds-0.0.6.tar.gz", hash = "sha256:82e425e3b9dd6c0af1faf016cd95c26e54cf0c01129b48c9fb8da27cccd39043", size = 110295, upload-time = "2026-02-25T18:08:59.83Z" }+sdist = { url = "https://files.pythonhosted.org/packages/ba/09/9291d9dee7ea35a49eee3119a3ba26059038d0a9ed719aec76ba9d824b05/mthds-0.0.7.tar.gz", hash = "sha256:ef36899caa41d07a75662bc142d9068a789e2f5050ac94c96c6fa93baa80518b", size = 112046, upload-time = "2026-03-02T01:07:31.42Z" }wheels = [- { url = "https://files.pythonhosted.org/packages/3d/c7/3bac46a06a59eb0aba9625ebef1142a1e796265c1fb9deb29e01a2255004/mthds-0.0.6-py3-none-any.whl", hash = "sha256:7083633765269e3ab8f62ae5c489fe70d4d6de526e19e86bc9ebfa8d6d76e22d", size = 48141, upload-time = "2026-02-25T18:08:58.604Z" },+ { url = "https://files.pythonhosted.org/packages/57/7b/c6919613a73480f6070f7eca2a23d69fa4b402548fd3fc427a2708c91ee3/mthds-0.0.7-py3-none-any.whl", hash = "sha256:a53565819f414c8d2f1f9af3ff64c23ad2fd7d96a1299a171750f666c2139eb9", size = 49165, upload-time = "2026-03-02T01:07:29.949Z" },][[package]]@@ -3431,7 +3431,7 @@ requires-dist = [{ name = "mkdocs-material", marker = "extra == 'docs'", specifier = ">=9.6.14" },{ name = "mkdocs-meta-manager", marker = "extra == 'docs'", specifier = ">=1.1.0" },{ name = "moto", extras = ["s3"], marker = "extra == 'dev'", specifier = ">=5.0.0" },- { name = "mthds", specifier = ">=0.0.6" },+ { name = "mthds", specifier = ">=0.0.7" },{ name = "mypy", marker = "extra == 'dev'", specifier = "==1.19.1" },{ name = "networkx", specifier = ">=3.4.2" },{ name = "openai", specifier = ">=1.108.1" },