(args=None)
| 1099 | |
| 1100 | |
| 1101 | def main(args=None): |
| 1102 | parser = ArgumentParser( |
| 1103 | prog="pybind11-stubgen", description="Generates stubs for specified modules" |
| 1104 | ) |
| 1105 | parser.add_argument( |
| 1106 | "-o", |
| 1107 | "--output-dir", |
| 1108 | help="the root directory for output stubs", |
| 1109 | default="./stubs", |
| 1110 | ) |
| 1111 | parser.add_argument( |
| 1112 | "--root-module-suffix", |
| 1113 | type=str, |
| 1114 | default="-stubs", |
| 1115 | dest="root_module_suffix", |
| 1116 | help="optional suffix to disambiguate from the original package", |
| 1117 | ) |
| 1118 | parser.add_argument( |
| 1119 | "--root_module_suffix", |
| 1120 | type=str, |
| 1121 | default=None, |
| 1122 | dest="root_module_suffix_deprecated", |
| 1123 | help="Deprecated. Use `--root-module-suffix`", |
| 1124 | ) |
| 1125 | parser.add_argument("--no-setup-py", action="store_true") |
| 1126 | parser.add_argument( |
| 1127 | "--non-stop", action="store_true", help="Deprecated. Use `--ignore-invalid=all`" |
| 1128 | ) |
| 1129 | parser.add_argument( |
| 1130 | "--ignore-invalid", |
| 1131 | nargs="+", |
| 1132 | choices=["signature", "defaultarg", "all"], |
| 1133 | default=[], |
| 1134 | help="Ignore invalid specified python expressions in docstrings", |
| 1135 | ) |
| 1136 | parser.add_argument( |
| 1137 | "--skip-signature-downgrade", |
| 1138 | action="store_true", |
| 1139 | help="Do not downgrade invalid function signatures to func(*args, **kwargs)", |
| 1140 | ) |
| 1141 | parser.add_argument( |
| 1142 | "--bare-numpy-ndarray", |
| 1143 | action="store_true", |
| 1144 | default=False, |
| 1145 | help="Render `numpy.ndarray` without (non-standardized) bracket-enclosed type and shape info", |
| 1146 | ) |
| 1147 | parser.add_argument( |
| 1148 | "module_names", nargs="+", metavar="MODULE_NAME", type=str, help="modules names" |
| 1149 | ) |
| 1150 | parser.add_argument("--log-level", default="INFO", help="Set output log level") |
| 1151 | |
| 1152 | sys_args = parser.parse_args(args or sys.argv[1:]) |
| 1153 | |
| 1154 | if sys_args.non_stop: |
| 1155 | sys_args.ignore_invalid = ["all"] |
| 1156 | warnings.warn( |
| 1157 | "`--non-stop` is deprecated in favor of `--ignore-invalid=all`", |
| 1158 | FutureWarning, |
no test coverage detected