diff --git a/python/conftest.py b/python/conftest.py deleted file mode 100644 index 776624b0d..000000000 --- a/python/conftest.py +++ /dev/null @@ -1,20 +0,0 @@ -# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -"""Root conftest for Python tests. - -Pre-register openshell as a namespace package so subpackage tests (e.g., -the prover) can run without the full Rust build that generates proto stubs. -""" - -from __future__ import annotations - -import sys -import types -from pathlib import Path - -if "openshell" not in sys.modules: - _pkg = types.ModuleType("openshell") - _pkg.__path__ = [str(Path(__file__).resolve().parent / "openshell")] - _pkg.__package__ = "openshell" - sys.modules["openshell"] = _pkg diff --git a/python/openshell/__init__.py b/python/openshell/__init__.py index 27f8aaae9..7dbcd97f3 100644 --- a/python/openshell/__init__.py +++ b/python/openshell/__init__.py @@ -5,18 +5,23 @@ from __future__ import annotations -from .sandbox import ( - ClusterInferenceConfig, - ExecChunk, - ExecResult, - InferenceRouteClient, - Sandbox, - SandboxClient, - SandboxError, - SandboxRef, - SandboxSession, - TlsConfig, -) +try: + from .sandbox import ( + ClusterInferenceConfig, + ExecChunk, + ExecResult, + InferenceRouteClient, + Sandbox, + SandboxClient, + SandboxError, + SandboxRef, + SandboxSession, + TlsConfig, + ) +except ImportError: + # Proto stubs not yet generated (requires Rust build). + # Subpackages like openshell.prover can still be imported. + pass try: from importlib.metadata import version