diff --git a/docs/reference/cli.md b/docs/reference/cli.md index bc3ab13b5..693f163b3 100644 --- a/docs/reference/cli.md +++ b/docs/reference/cli.md @@ -4,6 +4,10 @@ Scikit-build-core has a few integrated CLI tools. These are not guaranteed to be stable between releases yet, but can still be useful to investigate your environment. +```{program-output} python -m scikit_build_core + +``` + ## Build utilities ```{program-output} python -m scikit_build_core.build --help @@ -36,7 +40,7 @@ Example: ``` -## Wheel tag +## Building environment info ```{program-output} python -m scikit_build_core.builder.wheel_tag --help diff --git a/src/scikit_build_core/__main__.py b/src/scikit_build_core/__main__.py new file mode 100644 index 000000000..b81330ee5 --- /dev/null +++ b/src/scikit_build_core/__main__.py @@ -0,0 +1,40 @@ +from __future__ import annotations + +from ._logging import rich_print + +__all__ = ["main"] + + +def __dir__() -> list[str]: + return __all__ + + +def main() -> None: + rich_print("{blue}A top level CLI is not currently provided for scikit-build-core.") + rich_print("{blue}However, the following modules have CLI utilities:") + rich_print( + " python -m scikit_build_core.build requires {green}Get the build requirements" + ) + rich_print( + " python -m scikit_build_core.build project-table {green}Get the project table (with dynamic metadata)" + ) + rich_print( + " python -m scikit_build_core.builder {green}Info about the system" + ) + rich_print( + " python -m scikit_build_core.builder.wheel_tag {green}Info about the computed wheel tag" + ) + rich_print( + " python -m scikit_build_core.builder.sysconfig {green}Info from sysconfig" + ) + rich_print( + " python -m scikit_build_core.file_api.query {green}Request CMake file API" + ) + rich_print( + " python -m scikit_build_core.file_api.reply {green}Process CMake file API" + ) + rich_print() + + +if __name__ == "__main__": + main() diff --git a/src/scikit_build_core/_logging.py b/src/scikit_build_core/_logging.py index ebe2a2500..ac4b83131 100644 --- a/src/scikit_build_core/_logging.py +++ b/src/scikit_build_core/_logging.py @@ -305,8 +305,7 @@ def rich_print( ``color=`` argument will set a default color to apply to every argument, and is available to arguments as ``{color}``. """ - if color: - kwargs["color"] = _style[color] + kwargs["color"] = _style[color] if color else "" args_1 = tuple(str(arg) for arg in args) args_1_gen = ( diff --git a/src/scikit_build_core/build/__main__.py b/src/scikit_build_core/build/__main__.py index 9b42a16fd..6f3aa5dab 100644 --- a/src/scikit_build_core/build/__main__.py +++ b/src/scikit_build_core/build/__main__.py @@ -55,7 +55,7 @@ def main() -> None: description="Build backend utilities.", ) - subparsers = parser.add_subparsers(help="Commands") + subparsers = parser.add_subparsers(required=True, help="Commands") requires = subparsers.add_parser( "requires", help="Get the build requirements",