diff --git a/python/python/tests/test_package_metadata.py b/python/python/tests/test_package_metadata.py index 5792f457b..27def814f 100644 --- a/python/python/tests/test_package_metadata.py +++ b/python/python/tests/test_package_metadata.py @@ -9,6 +9,15 @@ from pathlib import Path import pytest +@pytest.mark.parametrize("name", ["JobInfo", "JobDescription", "JobFailureInfo"]) +def test_job_metadata_types_have_resolvable_modules(name): + """Documentation tools resolve re-exports through each type's module.""" + public_type = getattr(importlib.import_module("lancedb.job"), name) + defining_module = importlib.import_module(public_type.__module__) + + assert getattr(defining_module, public_type.__name__, None) is public_type + + def test_pyo3_abi_matches_minimum_supported_python(): project_dir = Path(__file__).parents[2] pyproject = (project_dir / "pyproject.toml").read_text() diff --git a/python/src/job.rs b/python/src/job.rs index 4922c701a..e22b2f897 100644 --- a/python/src/job.rs +++ b/python/src/job.rs @@ -151,7 +151,7 @@ impl Job { } /// A row from `Connection.list_jobs`: one server-side job. -#[pyclass(get_all, skip_from_py_object)] +#[pyclass(module = "lancedb._lancedb", get_all, skip_from_py_object)] #[derive(Clone)] pub struct JobInfo { job_id: String, @@ -184,7 +184,7 @@ impl From for JobInfo { } /// The server's account of why a job failed. -#[pyclass(get_all, skip_from_py_object)] +#[pyclass(module = "lancedb._lancedb", get_all, skip_from_py_object)] #[derive(Clone)] pub struct JobFailureInfo { phase: Option, @@ -203,7 +203,7 @@ impl JobFailureInfo { } /// The server-side record behind a `Job` handle. -#[pyclass(get_all, skip_from_py_object)] +#[pyclass(module = "lancedb._lancedb", get_all, skip_from_py_object)] #[derive(Clone)] pub struct JobDescription { job_id: String,