diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index e54cff092f1..9e2233fe5e3 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -27,7 +27,9 @@ jobs: # Create the softlink to the workspace as install.sh requires to run from its parent directory ln -s "${WORKSPACE}" executorch # Install executorch - source executorch/install.sh + # source executorch/install.sh + sleep 300 + python3 -m pip install executorch # Just print out the list of packages for debugging pip list diff --git a/docs/website/docs/tutorials/setting_up_executorch.md b/docs/website/docs/tutorials/setting_up_executorch.md index ee6b8908520..317ded2b561 100644 --- a/docs/website/docs/tutorials/setting_up_executorch.md +++ b/docs/website/docs/tutorials/setting_up_executorch.md @@ -21,29 +21,27 @@ pip install --pre torch -i https://download.pytorch.org/whl/nightly/cpu **Step 2: Set up Executorch**. This will install an `executorch` pip package to your conda environment. ```bash -mkdir -p ~/src/ -cd ~/src/ # Do one of these, depending on how your auth is set up git clone https://github.com/pytorch/executorch.git git clone git@github.com:pytorch/executorch.git -# Run the following to get all submodules +# [Runtime requirement] Run the following to get all submodules, only need for runtime setup git submodule update --init --recursive -./executorch/install.sh +pip install executorch # cd into a directory that doesn't contain a `./executorch/exir` directory, since # otherwise python will try using it for `import executorch.exir...` instead of using the # installed pip package. -cd ~/ +cd executorch ``` **Step 3: Try it out** Via python script: ``` -python ~/src/executorch/examples/export/export_example.py -m "add" +python ~/executorch/examples/export/export_example.py -m "add" ``` Or via python interpreter: diff --git a/pyproject.toml b/pyproject.toml index 38c877e80f8..46a30d19e5d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,9 +11,6 @@ dependencies=[ "sympy", ] -[tool.setuptools.packages.find] -where = ["src"] - [tool.setuptools.package-data] "*" = ["*.fbs", "*.yaml"] diff --git a/setup.py b/setup.py new file mode 100644 index 00000000000..34877e86f26 --- /dev/null +++ b/setup.py @@ -0,0 +1,57 @@ +# from setuptools import setup, find_packages +import os +import shutil + +from setuptools import setup +from setuptools.command.develop import develop +from setuptools.command.egg_info import egg_info +from setuptools.command.install import install + + +def custom_command(): + src_dst_list = [ + ("schema/scalar_type.fbs", "exir/serialize/scalar_type.fbs"), + ("schema/schema.fbs", "exir/serialize/schema.fbs"), + ] + for src, dst in src_dst_list: + print(f"copying from {src} to {dst}") + shutil.copyfile(src, dst) + + for _, dst in src_dst_list: + if not os.path.isfile(dst): + raise FileNotFoundError( + f"Could not find {dst}, copying file from {src} fails." + ) + + +class CustomInstallCommand(install): + def run(self): + custom_command() + install.run(self) + + +class CustomDevelopCommand(develop): + def run(self): + custom_command() + develop.run(self) + + +class CustomEggInfoCommand(egg_info): + def run(self): + custom_command() + egg_info.run(self) + + +setup( + package_dir={ + "executorch/backends": "backends", + "executorch/exir": "exir", + "executorch/schema": "schema", + "executorch/extension": "extension", + }, + cmdclass={ + "install": CustomInstallCommand, + "develop": CustomDevelopCommand, + "egg_info": CustomEggInfoCommand, + }, +) diff --git a/third-party/buck2 b/third-party/buck2 new file mode 160000 index 00000000000..4b1e57b3bc4 --- /dev/null +++ b/third-party/buck2 @@ -0,0 +1 @@ +Subproject commit 4b1e57b3bc4434c7a46cb18e6c7b80d989541fc4