scikit_build_core.utils package

Submodules

scikit_build_core.utils.typing module

scikit_build_core.utils.typing.get_inner_type(_target, /)[source]

Takes a type like list[str] and returns str, or dict[str, int] and returns int.

Return type:

type[Any]

scikit_build_core.utils.typing.get_target_raw_type(target, /)[source]

Takes a type like Optional[str] and returns str, or Optional[Dict[str, int]] and returns dict. Returns Union for a Union with more than one non-none type. Literal is also a valid return. Works through Annotated.

Return type:

Any

scikit_build_core.utils.typing.is_union_type(raw_target)[source]

Check if raw_target is a Union type (either typing.Union or types.UnionType). Handles both typing.Union[A, B] and PEP 604 syntax (A | B).

Return type:

bool

scikit_build_core.utils.typing.process_annotated(target, /)[source]

Splits annotated into raw type and annotations. If not annotated, the annotations will be empty.

Return type:

tuple[Any, tuple[Any, ...]]

scikit_build_core.utils.typing.process_union(target, /)[source]

Filters None out of Unions. If a Union only has one item, return that item.

Return type:

Any