2828
2929
3030def missing_exports (internal_obj , wrapped_obj ) -> None :
31+ """
32+ Special handling for:
33+ - Raw* classes: Internal implementation details that shouldn't be exposed
34+ - _global_ctx: Internal implementation detail
35+ - __self__, __class__: Python special attributes
36+ """
3137 # Special case enums - just make sure they exist since dir()
3238 # and other functions get overridden.
3339 if isinstance (wrapped_obj , EnumType ):
3440 return
3541
42+ # iterate through all the classes in datafusion._internal
3643 for attr in dir (internal_obj ):
37- if attr in ["_global_ctx" ]:
38- continue
39-
40- # Check if Raw* classes have corresponding wrapper classes
41- elif attr .startswith ("Raw" ):
42- base_class = attr [3 :] # Remove "Raw" prefix
43- assert hasattr (wrapped_obj , base_class )
44+ # Skip internal implementation details that shouldn't be exposed in public API
45+ if attr in ["_global_ctx" ] or attr .startswith ("Raw" ):
4446 continue
4547
4648 assert attr in dir (wrapped_obj )
@@ -55,11 +57,17 @@ def missing_exports(internal_obj, wrapped_obj) -> None:
5557
5658 if attr in ["__self__" , "__class__" ]:
5759 continue
60+
61+ # check if the class found in the internal module has a
62+ # wrapper exposed in the public module, datafusion
5863 if isinstance (internal_attr , list ):
5964 assert isinstance (wrapped_attr , list )
6065 for val in internal_attr :
66+ # Skip Raw* classes as they are internal
6167 if isinstance (val , str ) and val .startswith ("Raw" ):
68+ print ("Skipping Raw* class: " , val )
6269 continue
70+
6371 assert val in wrapped_attr
6472 elif hasattr (internal_attr , "__dict__" ):
6573 missing_exports (internal_attr , wrapped_attr )
@@ -68,7 +76,9 @@ def missing_exports(internal_obj, wrapped_obj) -> None:
6876def test_datafusion_missing_exports () -> None :
6977 """Check for any missing python exports.
7078
71- This test verifies that every exposed class, attribute, and function in
72- the internal (pyo3) module is also exposed in our python wrappers.
79+ This test verifies that every exposed class, attribute,
80+ and function in the internal (pyo3) module - datafusion._internal
81+ is also exposed in our python wrappers - datafusion -
82+ i.e., the ones exposed to the public.
7383 """
7484 missing_exports (datafusion ._internal , datafusion )
0 commit comments