| 163 | |
| 164 | |
| 165 | def _parse_args() -> argparse.Namespace: |
| 166 | parser = argparse.ArgumentParser( |
| 167 | description="Install executorch in your Python environment." |
| 168 | ) |
| 169 | parser.add_argument( |
| 170 | "--clean", |
| 171 | action="store_true", |
| 172 | help="clean build artifacts and pip-out instead of installing", |
| 173 | ) |
| 174 | parser.add_argument( |
| 175 | "--use-pt-pinned-commit", |
| 176 | action="store_true", |
| 177 | help="build from the pinned PyTorch commit instead of nightly", |
| 178 | ) |
| 179 | parser.add_argument( |
| 180 | "--editable", |
| 181 | "-e", |
| 182 | action="store_true", |
| 183 | help="build an editable pip wheel, changes to python code will be " |
| 184 | "picked up without rebuilding the wheel. Extension libraries will be " |
| 185 | "installed inside the source tree.", |
| 186 | ) |
| 187 | parser.add_argument( |
| 188 | "--minimal", |
| 189 | "-m", |
| 190 | action="store_true", |
| 191 | help="Only installs necessary dependencies for core executorch and skips " |
| 192 | " packages necessary for running example scripts.", |
| 193 | ) |
| 194 | allowed_optional_dependencies = ["cortex_m", "ethos_u", "vgf", "openvino"] |
| 195 | parser.add_argument( |
| 196 | "--optional-dependency", |
| 197 | action="append", |
| 198 | choices=allowed_optional_dependencies, |
| 199 | default=[], |
| 200 | metavar="EXTRA", |
| 201 | help="Install a named optional dependency from pyproject.toml. Can be " |
| 202 | "passed multiple times, for example " |
| 203 | "--optional-dependency ethos_u --optional-dependency openvino. " |
| 204 | f"Allowed values: {', '.join(allowed_optional_dependencies)}", |
| 205 | ) |
| 206 | return parser.parse_args() |
| 207 | |
| 208 | |
| 209 | def main(args): |