CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-azure-cognitiveservices-search-nspkg

Microsoft Azure Cognitive Services Search Namespace Package for Python 2/3 compatibility

64

1.25x

Quality

Pending

Does it follow best practices?

Impact

64%

1.25x

Average score across 6 eval scenarios

Overview
Eval results
Files

task.mdevals/scenario-5/

Azure Search Namespace Health Check

A small diagnostic module that verifies the search namespace relies on shared namespace wiring and guards against legacy package conflicts.

Capabilities

Rejects legacy azure package

  • Providing an installed-package list that contains azure==0.9.9 raises a RuntimeError whose message tells the user to uninstall the legacy package before proceeding. @test

Reports namespace wiring status

  • When the search namespace import succeeds, validate_namespace returns a NamespaceStatus with wired=True, namespace_paths mirroring azure.cognitiveservices.__path__, and detail noting that shared namespace wiring is active. @test
  • When the search namespace import fails, validate_namespace returns wired=False with an empty namespace_paths list and a detail string that explicitly says the namespace package dependency is missing. @test

Checks child module import

  • Calling ensure_search_import("custom") when that child module is absent under the search namespace returns ok=False, keeps module=None, captures an empty search_path, and includes a message that the child is not importable. @test
  • When a module named custom is preloaded under the search namespace, ensure_search_import("custom") returns ok=True, provides the loaded module, and captures its __path__ entries in search_path. @test

Implementation

@generates

API

from dataclasses import dataclass
from typing import List, Optional, Any

@dataclass
class NamespaceStatus:
    wired: bool
    namespace_paths: List[str]
    detail: str

def detect_legacy_conflict(installed: List[str]) -> None:
    """
    Raise RuntimeError if an azure==0.x legacy package string is present in installed.
    """
    ...

def validate_namespace() -> NamespaceStatus:
    """
    Attempt to import the search namespace and report whether parent namespace wiring is active.
    namespace_paths mirrors the current azure.cognitiveservices.__path__ as plain strings.
    """
    ...

@dataclass
class ImportResult:
    ok: bool
    module: Optional[Any]
    message: str
    search_path: List[str]

def ensure_search_import(child: str) -> ImportResult:
    """
    Attempt to import azure.cognitiveservices.search.<child> and describe the result.
    On success, returns the module and its __path__ entries as search_path.
    """
    ...

Dependencies { .dependencies }

azure-cognitiveservices-search-nspkg { .dependency }

Provides namespace wiring so search-specific child clients share the azure.cognitiveservices namespace across distributions.

Install with Tessl CLI

npx tessl i tessl/pypi-azure-cognitiveservices-search-nspkg

tile.json