Step 5/n: Add new setup*.py scripts.
* All setup scripts are generated into the build tree and run from there, which eliminates a lot of the confusion of the previous approach.
* Also, since deprecating bazel for python building, a lot of the prior complexity goes away.
* Adds some new boiler-plate docs as well.
* Removes the old packaging support.
diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt
index 0fdc05e..90a844c 100644
--- a/bindings/python/CMakeLists.txt
+++ b/bindings/python/CMakeLists.txt
@@ -17,5 +17,24 @@
set(PYBIND_COPTS "-fexceptions")
set(PYBIND_EXTENSION_COPTS "-fvisibility=hidden")
-add_subdirectory(pyiree)
+# Generated setup scripts.
+# TODO: Make the version configurable.
+set(IREE_PYTHON_VERSION "0.1a1")
+configure_file(setup.py setup.py COPYONLY)
+configure_file(setup_compiler.py.in setup_compiler.py)
+configure_file(setup_runtime.py.in setup_runtime.py)
+configure_file(setup_tools_core.py.in setup_tools_core.py)
+configure_file(setup_tools_tf.py.in setup_tools_tf.py)
+
+# Namespace packages.
+add_subdirectory(pyiree/common) # Deprecated
+add_subdirectory(pyiree/compiler2)
+add_subdirectory(pyiree/rt)
+
+if(${IREE_BUILD_COMPILER})
+add_subdirectory(pyiree/compiler) # Deprecated
+add_subdirectory(pyiree/tools/core)
+endif()
+
+# Tests.
add_subdirectory(tests)
diff --git a/bindings/python/README.md b/bindings/python/README.md
index 4307803..18b7b44 100644
--- a/bindings/python/README.md
+++ b/bindings/python/README.md
@@ -1,19 +1,43 @@
-# IREE Python Sandbox
+# IREE Python API
-This directory contains various integration-oriented Python utilities that are
-not intended to be a public API. They are, however, useful for lower level
-compiler interop work. And of course, they are useful since we presently lack a
-real API :)
+Top-level packages:
-We're still untangling build support, jupyter integration, etc for OSS builds.
-Stand by.
+* `pyiree.compiler2` : Main compiler API (soon to be renamed to 'compiler').
+* `pyiree.rt` : Runtime components for executing binaries.
+* `pyiree.tools.core` : Core tools for executing the compiler.
+* `pyiree.tools.tf` : TensorFlow compiler tools (if enabled).
-## Issues:
+Deprecated packages:
-* This is called `pyiree` vs `iree` to avoid pythonpath collisions that tend
- to arise when an iree directory is inside of an iree directory.
-* The above could be solved in the bazel build by making iree/bindings/python
- its own sub-workspace.
-* However, doing so presently breaks both flatbuffer and tablegen generation
- because of fixes needed to those build rules so that they are sub-worksapce
- aware.
+* `pyiree.compiler`
+* `pyiree.common`
+* `pyiree.tf.compiler`
+
+## Installing
+
+First perform a normal CMake build with the following options:
+
+* `-DIREE_BUILD_PYTHON_BINDINGS=ON` : Enables Python Bindings
+* `-DIREE_BUILD_TENSORFLOW_COMPILER=ON` (optional) : Enables building the
+ TensorFlow compilers (note: requires additional dependencies. see overall
+ build docs).
+
+Then from the build directory, run:
+
+```shell
+# Install into a local installation or virtualenv.
+python bindings/python/setup.py install
+
+# Build wheels.
+python bindings/python/setup.py bdist_wheel
+```
+
+## Development mode
+
+For development, just set your `PYTHONPATH` environment variable to the
+`bindings/python` directory in your CMake build dir.
+
+## Run tests
+
+Tests under `bindings/python/tests` can be run directly once installed.
+Additional tests under `integrations/tensorflow/e2e` will be runnable soon.
diff --git a/bindings/python/pyiree/CMakeLists.txt b/bindings/python/pyiree/CMakeLists.txt
deleted file mode 100644
index 73728d5..0000000
--- a/bindings/python/pyiree/CMakeLists.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright 2020 Google LLC
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-add_subdirectory(common)
-add_subdirectory(compiler2)
-add_subdirectory(rt)
-add_subdirectory(tools/core)
-
-if(${IREE_BUILD_COMPILER})
- add_subdirectory(compiler)
-endif()
diff --git a/bindings/python/pyiree/compiler2/CMakeLists.txt b/bindings/python/pyiree/compiler2/CMakeLists.txt
index c67229a..c9a4ef8 100644
--- a/bindings/python/pyiree/compiler2/CMakeLists.txt
+++ b/bindings/python/pyiree/compiler2/CMakeLists.txt
@@ -12,6 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+# Static and generated files.
+configure_file(README.md README.md COPYONLY)
+
iree_py_library(
NAME
compiler2
diff --git a/bindings/python/pyiree/compiler2/setup.py b/bindings/python/pyiree/compiler2/setup.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/bindings/python/pyiree/compiler2/setup.py
diff --git a/bindings/python/pyiree/compiler2/tf.py b/bindings/python/pyiree/compiler2/tf.py
index 17d098e..c9608af 100644
--- a/bindings/python/pyiree/compiler2/tf.py
+++ b/bindings/python/pyiree/compiler2/tf.py
@@ -20,7 +20,7 @@
import tempfile
from typing import List, Optional, Sequence, Set, Union
-from .tools import *
+from .tools import find_tool, invoke_immediate, invoke_pipeline
from .core import CompilerOptions, DEFAULT_TESTING_BACKENDS, build_compile_command_line
__all__ = [
diff --git a/bindings/python/pyiree/compiler2/tools.py b/bindings/python/pyiree/compiler2/tools.py
index fab668b..480600b 100644
--- a/bindings/python/pyiree/compiler2/tools.py
+++ b/bindings/python/pyiree/compiler2/tools.py
@@ -44,8 +44,8 @@
# Map of tool module to package name as distributed to archives (used for
# error messages).
_TOOL_MODULE_PACKAGES = {
- "pyiree.tools.tf": "pyiree_compiler_tf",
- "pyiree.tools.core": "pyiree_compiler_core",
+ "pyiree.tools.core": "google-iree-tools-core",
+ "pyiree.tools.tf": "google-iree-tools-tf",
}
# Environment variable holding directories to be searched for named tools.
diff --git a/bindings/python/pyiree/rt/CMakeLists.txt b/bindings/python/pyiree/rt/CMakeLists.txt
index 7828073..ef0f5bb 100644
--- a/bindings/python/pyiree/rt/CMakeLists.txt
+++ b/bindings/python/pyiree/rt/CMakeLists.txt
@@ -12,6 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+# Static and generated files.
+configure_file(README.md README.md COPYONLY)
+
iree_pyext_library(
NAME
PyExtRtLib
diff --git a/bindings/python/pyiree/rt/README.md b/bindings/python/pyiree/rt/README.md
new file mode 100644
index 0000000..44b94e1
--- /dev/null
+++ b/bindings/python/pyiree/rt/README.md
@@ -0,0 +1,4 @@
+# IREE Python Runtime Components
+
+This package provides an API for running compiled IREE binaries and interfacing
+with the hardware-abstraction-layer.
diff --git a/bindings/python/setup.py b/bindings/python/setup.py
new file mode 100644
index 0000000..3a669cc
--- /dev/null
+++ b/bindings/python/setup.py
@@ -0,0 +1,41 @@
+#!/usr/bin/python3
+
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Build platform specific wheel files for the pyiree.rt package.
+# Built artifacts are per-platform and build out of the build tree.
+
+import os
+import subprocess
+import sys
+
+# Make this setup position independent and make it not conflict with
+# parallel scripts.
+this_dir = os.path.abspath(os.path.dirname(__file__))
+
+
+def run_sub_setup(name):
+ sub_path = os.path.join(this_dir, f"{name}.py")
+ args = [sys.executable, sub_path] + sys.argv[1:]
+ print(f"##### Running sub setup: {' '.join(args)}")
+ subprocess.check_call(args)
+ print("")
+
+
+run_sub_setup("setup_compiler")
+run_sub_setup("setup_runtime")
+run_sub_setup("setup_tools_core")
+if os.path.exists(os.path.join(this_dir, "pyiree/tools/tf")):
+ run_sub_setup("setup_tools_tf")
diff --git a/bindings/python/setup_compiler.py.in b/bindings/python/setup_compiler.py.in
new file mode 100644
index 0000000..f8d637d
--- /dev/null
+++ b/bindings/python/setup_compiler.py.in
@@ -0,0 +1,57 @@
+#!/usr/bin/python3
+
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Build platform specific wheel files for the pyiree.rt package.
+# Built artifacts are per-platform and build out of the build tree.
+
+import os
+from setuptools import setup, find_namespace_packages
+
+# Make this setup position independent and make it not conflict with
+# parallel scripts.
+this_dir = os.path.abspath(os.path.dirname(__file__))
+setup_dir = os.path.join(this_dir, "setupbuild", "compiler")
+os.makedirs(setup_dir, exist_ok=True)
+os.chdir(setup_dir)
+
+def read(fname):
+ return open(os.path.join(this_dir, fname), "rt").read()
+
+
+setup(
+ name="google-iree-compiler",
+ version="@IREE_PYTHON_VERSION@",
+ author="The IREE Team",
+ author_email="iree-discuss@googlegroups.com",
+ license="Apache",
+ description="IREE Python Compiler API",
+ long_description=read("pyiree/compiler2/README.md"),
+ long_description_content_type="text/markdown",
+ url="https://github.com/google/iree",
+ classifiers=[
+ "Programming Language :: Python :: 3",
+ "License :: OSI Approved :: Apache License",
+ "Operating System :: OS Independent",
+ "Development Status :: 3 - Alpha",
+ ],
+ python_requires=">=3.6",
+ package_dir={"": this_dir},
+ packages=find_namespace_packages(
+ where=this_dir,
+ include=["pyiree.compiler2", "pyiree.compiler2.*"],
+ exclude=["*.CMakeFiles"]),
+ zip_safe=False, # This package is fine but not zipping is more versatile.
+)
diff --git a/bindings/python/setup_runtime.py.in b/bindings/python/setup_runtime.py.in
new file mode 100644
index 0000000..5893017
--- /dev/null
+++ b/bindings/python/setup_runtime.py.in
@@ -0,0 +1,66 @@
+#!/usr/bin/python3
+
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Build platform specific wheel files for the pyiree.rt package.
+# Built artifacts are per-platform and build out of the build tree.
+
+import os
+from setuptools import setup, find_namespace_packages, Extension
+import sysconfig
+
+# Make this setup position independent and make it not conflict with
+# parallel scripts.
+this_dir = os.path.abspath(os.path.dirname(__file__))
+setup_dir = os.path.join(this_dir, "setupbuild", "runtime")
+os.makedirs(setup_dir, exist_ok=True)
+os.chdir(setup_dir)
+
+
+def read(fname):
+ return open(os.path.join(this_dir, fname), "rt").read()
+
+
+setup(
+ name="google-iree-runtime",
+ version="@IREE_PYTHON_VERSION@",
+ author="The IREE Team",
+ author_email="iree-discuss@googlegroups.com",
+ license="Apache",
+ description="IREE Python Runtime Components",
+ long_description=read("pyiree/rt/README.md"),
+ long_description_content_type="text/markdown",
+ url="https://github.com/google/iree",
+ classifiers=[
+ "Programming Language :: Python :: 3",
+ "License :: OSI Approved :: Apache License",
+ "Operating System :: OS Independent",
+ "Development Status :: 3 - Alpha",
+ ],
+ python_requires=">=3.6",
+ package_dir={"": this_dir},
+ packages=find_namespace_packages(where=this_dir,
+ include=["pyiree.rt", "pyiree.rt.*"],
+ exclude=["*.CMakeFiles"]),
+ ext_modules=[
+ Extension(name="pyiree.rt.binding", sources=[]),
+ ],
+ # Matching the native extension as a data file keeps setuptools from
+ # "building" it (i.e. turning it into a static binary).
+ package_data={
+ "": [f"*{sysconfig.get_config_var('EXT_SUFFIX')}"],
+ },
+ zip_safe=False,
+)
diff --git a/bindings/python/setup_tools_core.py.in b/bindings/python/setup_tools_core.py.in
new file mode 100644
index 0000000..55104f5
--- /dev/null
+++ b/bindings/python/setup_tools_core.py.in
@@ -0,0 +1,80 @@
+#!/usr/bin/python3
+
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Build platform specific wheel files for the pyiree.rt package.
+# Built artifacts are per-platform and build out of the build tree.
+
+import os
+import platform
+from setuptools import setup, find_namespace_packages
+
+# Make this setup position independent and make it not conflict with
+# parallel scripts.
+this_dir = os.path.abspath(os.path.dirname(__file__))
+setup_dir = os.path.join(this_dir, "setupbuild", "tools_core")
+os.makedirs(setup_dir, exist_ok=True)
+os.chdir(setup_dir)
+
+exe_suffix = ".exe" if platform.system() == "Windows" else ""
+
+
+def read(fname):
+ return open(os.path.join(this_dir, fname), "rt").read()
+
+
+# Force platform specific wheel.
+# https://stackoverflow.com/questions/45150304
+try:
+ from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
+
+ class bdist_wheel(_bdist_wheel):
+
+ def finalize_options(self):
+ _bdist_wheel.finalize_options(self)
+ self.root_is_pure = False
+except ImportError:
+ bdist_wheel = None
+
+setup(
+ name="google-iree-tools-core",
+ version="@IREE_PYTHON_VERSION@",
+ author="The IREE Team",
+ author_email="iree-discuss@googlegroups.com",
+ license="Apache",
+ description="IREE Python Core Tools Binaries",
+ long_description=
+ "Package containing platform-specific binaries for core compiler tools",
+ long_description_content_type="text/plain",
+ url="https://github.com/google/iree",
+ classifiers=[
+ "Programming Language :: Python :: 3",
+ "License :: OSI Approved :: Apache License",
+ "Operating System :: OS Independent",
+ "Development Status :: 3 - Alpha",
+ ],
+ python_requires=">=3.6",
+ package_dir={"": this_dir},
+ packages=find_namespace_packages(where=this_dir,
+ include=["pyiree.tools.core"],
+ exclude=["*.CMakeFiles"]),
+ # Matching the native extension as a data file keeps setuptools from
+ # "building" it (i.e. turning it into a static binary).
+ package_data={
+ "pyiree.tools.core": [f"iree-translate{exe_suffix}",],
+ },
+ cmdclass={'bdist_wheel': bdist_wheel},
+ zip_safe=False,
+)
diff --git a/bindings/python/setup_tools_tf.py.in b/bindings/python/setup_tools_tf.py.in
new file mode 100644
index 0000000..a1b292e
--- /dev/null
+++ b/bindings/python/setup_tools_tf.py.in
@@ -0,0 +1,81 @@
+#!/usr/bin/python3
+
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Build platform specific wheel files for the pyiree.rt package.
+# Built artifacts are per-platform and build out of the build tree.
+
+import os
+import platform
+from setuptools import setup, find_namespace_packages
+
+# Make this setup position independent and make it not conflict with
+# parallel scripts.
+this_dir = os.path.abspath(os.path.dirname(__file__))
+setup_dir = os.path.join(this_dir, "setupbuild", "tools_tf")
+os.makedirs(setup_dir, exist_ok=True)
+os.chdir(setup_dir)
+
+exe_suffix = ".exe" if platform.system() == "Windows" else ""
+
+
+def read(fname):
+ return open(os.path.join(this_dir, fname), "rt").read()
+
+
+# Force platform specific wheel.
+# https://stackoverflow.com/questions/45150304
+try:
+ from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
+
+ class bdist_wheel(_bdist_wheel):
+
+ def finalize_options(self):
+ _bdist_wheel.finalize_options(self)
+ self.root_is_pure = False
+except ImportError:
+ bdist_wheel = None
+
+setup(
+ name="google-iree-tools-tf",
+ version="@IREE_PYTHON_VERSION@",
+ author="The IREE Team",
+ author_email="iree-discuss@googlegroups.com",
+ license="Apache",
+ description="IREE Python TensorFlow Tools Binaries",
+ long_description=
+ "Package containing platform-specific binaries for TensorFlow "
+ "compiler tools",
+ long_description_content_type="text/plain",
+ url="https://github.com/google/iree",
+ classifiers=[
+ "Programming Language :: Python :: 3",
+ "License :: OSI Approved :: Apache License",
+ "Operating System :: OS Independent",
+ "Development Status :: 3 - Alpha",
+ ],
+ python_requires=">=3.6",
+ package_dir={"": this_dir},
+ packages=find_namespace_packages(where=this_dir,
+ include=["pyiree.tools.tf"],
+ exclude=["*.CMakeFiles"]),
+ # Matching the native extension as a data file keeps setuptools from
+ # "building" it (i.e. turning it into a static binary).
+ package_data={
+ "pyiree.tools.tf": [f"iree-tf-import{exe_suffix}",],
+ },
+ cmdclass={'bdist_wheel': bdist_wheel},
+ zip_safe=False,
+)
diff --git a/build_tools/bazel/build_tensorflow.sh b/build_tools/bazel/build_tensorflow.sh
index cc9a407..055e586 100755
--- a/build_tools/bazel/build_tensorflow.sh
+++ b/build_tools/bazel/build_tensorflow.sh
@@ -84,7 +84,7 @@
--nosystem_rc --nohome_rc --noworkspace_rc \
--bazelrc=build_tools/bazel/iree.bazelrc \
query \
- //integrations/... + //colab/... + //packaging/... | \
+ //integrations/... + //colab/... | \
xargs bazel \
--nosystem_rc --nohome_rc --noworkspace_rc \
--bazelrc=build_tools/bazel/iree.bazelrc \
diff --git a/build_tools/cmake/bazel.bat.in b/build_tools/cmake/bazel.bat.in
index 2d2bfb2..93da790 100644
--- a/build_tools/cmake/bazel.bat.in
+++ b/build_tools/cmake/bazel.bat.in
@@ -1,3 +1,17 @@
@echo off
+REM Copyright 2020 Google LLC
+REM
+REM Licensed under the Apache License, Version 2.0 (the "License");
+REM you may not use this file except in compliance with the License.
+REM You may obtain a copy of the License at
+REM
+REM https://www.apache.org/licenses/LICENSE-2.0
+REM
+REM Unless required by applicable law or agreed to in writing, software
+REM distributed under the License is distributed on an "AS IS" BASIS,
+REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+REM See the License for the specific language governing permissions and
+REM limitations under the License.
+
cd /d "@_bazel_src_root@"
@IREE_BAZEL_EXECUTABLE@ @_bazel_startup_options@ %* || exit /b
diff --git a/build_tools/cmake/bazel.sh.in b/build_tools/cmake/bazel.sh.in
index 65385e2..ed2466f 100644
--- a/build_tools/cmake/bazel.sh.in
+++ b/build_tools/cmake/bazel.sh.in
@@ -1,3 +1,17 @@
#!/bin/bash
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
cd "@_bazel_src_root@"
exec '@IREE_BAZEL_EXECUTABLE@' @_bazel_startup_options@ "$@"
diff --git a/docs/get_started/cmake_options_and_variables.md b/docs/get_started/cmake_options_and_variables.md
index 18fff58..ad523a8 100644
--- a/docs/get_started/cmake_options_and_variables.md
+++ b/docs/get_started/cmake_options_and_variables.md
@@ -105,6 +105,15 @@
`MLIR_DIR` needs to be passed and that LLVM needs to be compiled with
`LLVM_ENABLE_RTTI` set to `ON`.
+#### `IREE_BUILD_TENSORFLOW_COMPILER`:BOOL
+
+Enables building of the TensorFlow to IREE compiler under
+`integrations/tensorflow`, including some native binaries and Python packages.
+Note that TensorFlow's build system is bazel-based and this will require a
+functioning `bazel` installation. A `bazel` wrapper script will be emitted
+in your build directory and `bazel-bin` link will point to artifacts. This
+can be used to manually invoke additional bazel actions if desired.
+
## MLIR-specific CMake Options and Variables
#### `MLIR_DIR`:STRING
diff --git a/docs/get_started/getting_started_python.md b/docs/get_started/getting_started_python.md
index af8a25b..955a179 100644
--- a/docs/get_started/getting_started_python.md
+++ b/docs/get_started/getting_started_python.md
@@ -1,11 +1,14 @@
# Getting Started with Python
-IREE has Python bindings geared towards lower level compiler interop that are
-not intended to be a public API, and integration with Python frontends such as
-TensorFlow.
+ NOTE: Iree's Python API is currently being reworked. Some of these
+ instructions may be in a state of flux as they document the end state.
-We do not yet provide a pip package for easy installation, so to use IREE's
-Python bindings you must build from source.
+IREE has two primary Python APIs:
+
+* Compiler API: `pyiree.compiler2`, `pyiree.compiler2.tf`
+* Runtime API: `pyiree.tf`
+
+There are additional ancillary modules that are not part of the public API.
## Prerequisites
@@ -13,22 +16,41 @@
[getting started guides](../get-started) for instructions.
> Note:<br>
-> Support is best with Bazel.
-> For CMake (excluding TensorFlow), set the `IREE_BUILD_PYTHON_BINDINGS` option.
+> Support is only complete with CMake.
+
+Minimally, the following CMake flags must be specified:
+
+* `-DIREE_BUILD_PYTHON_BINDINGS=ON`
+* `-DIREE_BUILD_TENSORFLOW_COMPILER=ON` : Optional. Also builds the
+ TensorFlow compiler integration.
+
+If building any parts of TensorFlow, you must have a working `bazel` command
+on your path. See the `.bazelversion` file at the root of the project for the
+recommended version.
## Python Setup
Install a recent version of [Python 3](https://www.python.org/downloads/) and
[pip](https://pip.pypa.io/en/stable/installing/), if needed.
+(Recommended) Setup a virtual environment (use your preferred mechanism):
+
+```shell
+# Note that venv is only available in python3 and is therefore a good check
+# that you are in fact running a python3 binary.
+python -m venv .venv
+source .venv/bin/activate
+# When done: run 'deactivate'
+```
+
Install packages:
```shell
-$ python3 -m pip install --upgrade pip
-$ python3 -m pip install numpy
+$ python -m pip install --upgrade pip
+$ python -m pip install numpy absl-py
# If using the TensorFlow integration
-$ python3 -m pip install tf-nightly
+$ python -m pip install tf-nightly
```
## Running Python Tests
@@ -40,29 +62,60 @@
$ ctest -L bindings/python
```
-To run tests for core Python bindings built with Bazel:
-
-```shell
-$ bazel test bindings/python/...
-```
-
To run tests for the TensorFlow integration, which include end-to-end backend
comparison tests:
```shell
-# Exclude tests that are skipped in the Kokoro CI
-$ bazel test \
- --build_tag_filters="-nokokoro" \
- --test_tag_filters="-nokokoro" \
- --define=iree_tensorflow=true \
- integrations/tensorflow/...
+cd build
+# TODO: Revisit once more patches land.
+ctest -L integrations/tensorflow/e2e
+
+# Or run individually as:
+export PYTHONPATH=bindings/python # In build dir
+python integrations/tensorflow/e2e/simple_arithmetic_test.py \
+ --target_backends=iree_vmla --artifacts_dir=/tmp/artifacts
```
+
## Using Colab
-See
-[start_colab_kernel.py](https://github.com/google/iree/blob/main/colab/start_colab_kernel.py)
-and [Using Colab](../using_iree/using_colab.md) for setup instructions, then
-take a look through the
-[Colab directory](https://github.com/google/iree/tree/main/colab) for some
-sample notebooks.
+There are some sample colabs in the `colab` folder. If you have built the
+project with CMake/ninja and set your `PYTHONPATH` to the `bindings/python`
+directory in the build dir (or installed per below), you should be able to
+start a kernel by following the stock instructions at
+https://colab.research.google.com/ .
+
+
+## Installing and Packaging
+
+There is a `setup.py` in the `bindings/python` directory under the build dir.
+To install into your (hopefully isolated) virtual env:
+
+```shell
+python bindings/python/setup.py install
+```
+
+To create wheels (platform dependent and locked to your Python version
+without further config):
+
+```shell
+python bindings/python/setup.py bdist_wheel
+```
+
+Note that it is often helpful to differentiate between the environment used to
+build and the one used to install. While this is just "normal" python
+knowledge, here is an incantation to do so:
+
+```shell
+# From parent/build environment.
+python -m pip freeze > /tmp/requirements.txt
+deactivate # If already in an environment
+
+# Enter new scratch environment.
+python -m venv ./.venv-scratch
+source ./.venv-scratch/bin/activate
+python -m pip install -r /tmp/requirements.txt
+
+# Install IREE into the new environment.
+python bindings/python/setup.py install
+```
diff --git a/packaging/python/.gitignore b/packaging/python/.gitignore
deleted file mode 100644
index b357fe2..0000000
--- a/packaging/python/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-build/
-dist/
-*.egg-info
-
diff --git a/packaging/python/BUILD.bazel b/packaging/python/BUILD.bazel
deleted file mode 100644
index 4e48edd..0000000
--- a/packaging/python/BUILD.bazel
+++ /dev/null
@@ -1,39 +0,0 @@
-# Copyright 2020 Google LLC
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-package(
- features = ["layering_check"],
- licenses = ["notice"],
-)
-
-# This is a dummy binary that has the side-effect of building all of the TF
-# python bindings. It is used to build wheel files.
-py_binary(
- name = "all_pyiree_packages",
- srcs = ["dummy_exclude_from_package.py"],
- legacy_create_init = False,
- main = "dummy_exclude_from_package.py",
- python_version = "PY3",
- tags = [
- # Do not build with ... expansion
- "manual",
- ],
- deps = [
- "//bindings/python:pathsetup", # build_cleaner: keep
- "//bindings/python/pyiree/compiler", # build_cleaner: keep
- "//bindings/python/pyiree/rt", # build_cleaner: keep
- "//integrations/tensorflow/bindings/python/pyiree/tf/compiler", # build_cleaner: keep
- "//integrations/tensorflow/bindings/python/pyiree/tf/support", # build_cleaner: keep
- ],
-)
diff --git a/packaging/python/README.md b/packaging/python/README.md
deleted file mode 100644
index 3d387a2..0000000
--- a/packaging/python/README.md
+++ /dev/null
@@ -1,87 +0,0 @@
-# Python packaging scripts.
-
-Note that packages will be placed in `packaging/python/dist` with the canonical
-instructions. However, the setup scripts can be run from anywhere and will
-create `build` and `dist` directories where run. Wheels can be installed with
-`pip3 install --user dist/*.whl`.
-
-## Building core wheels with CMake
-
-Most of IREE is built/packaged with CMake. For the parts that build with CMake,
-this is preferred.
-
-Canonical instructions follow:
-
-### Linux
-
-```shell
-export LDFLAGS=-fuse-ld=/usr/bin/ld.lld
-export PYIREE_CMAKE_BUILD_ROOT="${HOME?}/build-iree-release"
-export IREE_SRC="${HOME?}/src/iree"
-rm -Rf "${PYIREE_CMAKE_BUILD_ROOT?}"; mkdir -p "${PYIREE_CMAKE_BUILD_ROOT?}"
-cmake -GNinja -B"${PYIREE_CMAKE_BUILD_ROOT?}" -H"${IREE_SRC}" \
- -DCMAKE_BUILD_TYPE=Release \
- -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \
- -DIREE_BUILD_PYTHON_BINDINGS=ON -DIREE_BUILD_SAMPLES=OFF
-(cd "${PYIREE_CMAKE_BUILD_ROOT?}" && ninja)
-(cd "${IREE_SRC?}/packaging/python" && (
- rm -Rf build;
- python3 setup_compiler.py bdist_wheel;
- rm -Rf build;
- python3 setup_rt.py bdist_wheel))
-```
-
-## Building IREE/TensorFlow wheels
-
-If building TensorFlow integration wheels, then this must be done via Bazel. In
-this case, it can be easiest to just package everything from a Bazel build to
-avoid multiple steps.
-
-Canonical instructions follow:
-
-### Env Setup
-
-```shell
-IREE_SRC=$HOME/src/iree
-export PYIREE_BAZEL_BUILD_ROOT="$IREE_SRC/bazel-bin"
-if which cygpath; then
- export PYIREE_BAZEL_BUILD_ROOT="$(cygpath -w "$PYIREE_BAZEL_BUILD_ROOT")"
-fi
-```
-
-### Building:
-
-Optionally add: `--define=PYIREE_TF_DISABLE_KERNELS=1` to build a 'thin' (less
-functional) version without TensorFlow kernels. This should not be done for
-released binaries but can help while developing.
-
-Note that bazel does not always build properly named artifacts. See the tool
-`hack_python_package_from_runfiles.py` to extract and fixup artifacts from a
-bazel-bin directory. If using this mechanism, then the environment variable
-`PYIREE_PYTHON_ROOT` should be set to a suitable temp directory.
-
-```shell
-cd $IREE_SRC
-bazel build -c opt \
- //packaging/python:all_pyiree_packages
-```
-
-# Packaging
-
-```shell
-(cd $IREE_SRC/packaging/python && (
- rm -Rf build;
- python3 setup_tf.py bdist_wheel))
-```
-
-```shell
-(cd $IREE_SRC/packaging/python && (
- rm -Rf build;
- python3 setup_compiler.py bdist_wheel))
-```
-
-```shell
-(cd $IREE_SRC/packaging/python && (
- rm -Rf build;
- python3 setup_rt.py bdist_wheel))
-```
diff --git a/packaging/python/__init__.py b/packaging/python/__init__.py
deleted file mode 100644
index 8b13789..0000000
--- a/packaging/python/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/packaging/python/common_setup.py b/packaging/python/common_setup.py
deleted file mode 100644
index 727ce24..0000000
--- a/packaging/python/common_setup.py
+++ /dev/null
@@ -1,132 +0,0 @@
-# Copyright 2020 Google LLC
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os
-import platform
-import setuptools
-import sys
-import sysconfig
-from datetime import date
-
-
-def get_exe_suffix():
- if platform.system() == "Windows":
- return ".exe"
- else:
- return ""
-
-
-def get_package_dir(prefix=("bindings", "python")):
- explicit_root = os.environ.get("PYIREE_PYTHON_ROOT")
- if explicit_root:
- return explicit_root
-
- # Use env variables based on build system type.
- cmake_build_root = os.environ.get("PYIREE_CMAKE_BUILD_ROOT")
- bazel_build_root = os.environ.get("PYIREE_BAZEL_BUILD_ROOT")
-
- if cmake_build_root and bazel_build_root:
- print("ERROR: Both PYIREE_CMAKE_BUILD_ROOT and PYIREE_BAZEL_BUILD_ROOT"
- " cannot be set at the same time")
- sys.exit(1)
-
- if cmake_build_root:
- print("Using CMake build root:", cmake_build_root)
- pkg_dir = os.path.join(cmake_build_root, *prefix)
- elif bazel_build_root:
- print("Using Bazel build root:", bazel_build_root)
- if not os.path.isdir(bazel_build_root):
- print("ERROR: Could not find bazel-bin:", bazel_build_root)
- sys.exit(1)
- # Find the path to the runfiles of the built target:
- # //bindings/python/packaging:all_pyiree_packages
- runfiles_dir = os.path.join(
- bazel_build_root, "packaging", "python",
- "all_pyiree_packages%s.runfiles" % (get_exe_suffix(),))
- if not os.path.isdir(runfiles_dir):
- print("ERROR: Could not find build target 'all_pyiree_packages':",
- runfiles_dir)
- print("Make sure to build target",
- "//packaging/python:all_pyiree_packages")
- sys.exit(1)
- # And finally seek into the corresponding path in the runfiles dir.
- # Aren't bazel paths fun???
- # Note that the "iree_core" path segment corresponds to the workspace name.
- pkg_dir = os.path.join(runfiles_dir, "iree_core", *prefix)
- else:
- print("ERROR: No build directory specified. Set one of these variables:")
- print(" PYIREE_CMAKE_BUILD_ROOT=/path/to/cmake/build")
- sys.exit(1)
-
- if not os.path.exists(pkg_dir):
- print("ERROR: Package path does not exist:", pkg_dir)
- sys.exit(1)
- return pkg_dir
-
-
-def get_default_date_version():
- today = date.today()
- return today.strftime("%Y%m%d")
-
-
-def get_setup_defaults(sub_project, description, package_dir=None):
- if not package_dir:
- package_dir = get_package_dir()
- return {
- "name": "google-iree-%s" % (sub_project,),
- "version": get_default_date_version(),
- "author": "The IREE Team at Google",
- "author_email": "iree-discuss@googlegroups.com",
- "description": description,
- "long_description": description,
- "long_description_content_type": "text/plain",
- "url": "https://github.com/google/iree",
- "package_dir": {
- "": package_dir,
- },
- "classifiers": [
- "Programming Language :: Python :: 3",
- "License :: OSI Approved :: Apache License",
- "Operating System :: OS Independent",
- "Development Status :: 3 - Alpha",
- ],
- "python_requires": ">=3.6",
- }
-
-
-def setup(**kwargs):
- # See: https://stackoverflow.com/q/45150304
- try:
- from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
-
- class bdist_wheel(_bdist_wheel):
-
- def finalize_options(self):
- _bdist_wheel.finalize_options(self)
- self.root_is_pure = False
- except ImportError:
- bdist_wheel = None
-
- # Need to include platform specific extensions binaries:
- # Windows: .pyd
- # macOS: .dylib
- # Other: .so
- # Unfortunately, bazel is imprecise and scatters .so files around, so
- # need to be specific.
- package_data = {
- "": ["*%s" % (sysconfig.get_config_var("EXT_SUFFIX"),)],
- }
- setuptools.setup(package_data=package_data,
- cmdclass={"bdist_wheel": bdist_wheel},
- **kwargs)
diff --git a/packaging/python/dummy_exclude_from_package.py b/packaging/python/dummy_exclude_from_package.py
deleted file mode 100644
index 0ca47f8..0000000
--- a/packaging/python/dummy_exclude_from_package.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# Copyright 2020 Google LLC
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
diff --git a/packaging/python/hack_python_package_from_runfiles.py b/packaging/python/hack_python_package_from_runfiles.py
deleted file mode 100644
index 61c2d6e..0000000
--- a/packaging/python/hack_python_package_from_runfiles.py
+++ /dev/null
@@ -1,102 +0,0 @@
-#!/usr/bin/python
-# Copyright 2020 Google LLC
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Given a runfiles directory from a bazel build, does surgery to extract
-# a usable python package directory. In addition to the bazel directory
-# structure being unnecessarily obtuse, it is also really hard to actually
-# name files correctly. This affects python extension modules which must be
-# named with a specific extension suffix. Bazel is extremely unflexible and
-# we patch around it with this script. For the record, there are various ways
-# to write custom rules to do this more natively, but it is all complicated
-# and needless complexity. We opt for a script that is at least readable by
-# mere mortals and in one place.
-# Usage:
-# ./this_script <dest_dir> <path to bazel-bin>
-
-import os
-import platform
-import shutil
-import sys
-import sysconfig
-
-FILE_NAME_MAP = {
- "binding.so": "binding{}".format(sysconfig.get_config_var("EXT_SUFFIX")),
- "binding.pyd": False,
- "binding.dylib": False,
-}
-
-
-def get_exe_suffix():
- if platform.system() == "Windows":
- return ".exe"
- else:
- return ""
-
-
-def copy_prefix(dest_dir, runfiles_dir, prefix):
- # And finally seek into the corresponding path in the runfiles dir.
- # Aren't bazel paths fun???
- # Note that the "iree_core" path segment corresponds to the workspace name.
- pkg_dir = os.path.join(runfiles_dir, "iree_core", *prefix)
- if not os.path.exists(pkg_dir):
- return
- dest_dir = os.path.join(dest_dir)
- for root, dirs, files in os.walk(pkg_dir):
- assert root.startswith(pkg_dir)
- dest_prefix = root[len(pkg_dir):]
- if dest_prefix.startswith(os.path.sep):
- dest_prefix = dest_prefix[1:]
- local_dest_dir = os.path.join(dest_dir, dest_prefix)
- os.makedirs(local_dest_dir, exist_ok=True)
- for file in files:
- copy_file(os.path.join(root, file), local_dest_dir)
-
-
-def copy_file(src_file, dst_dir):
- basename = os.path.basename(src_file)
- dst_file = os.path.join(dst_dir, basename)
- mapped_name = FILE_NAME_MAP.get(basename)
- if mapped_name is False:
- # Skip.
- return
- elif mapped_name is not None:
- dst_file = os.path.join(dst_dir, mapped_name)
- shutil.copyfile(src_file, dst_file, follow_symlinks=True)
-
-
-def main():
- # Parse args.
- dest_dir = sys.argv[1]
- bazel_bin = sys.argv[2] if len(sys.argv) > 2 else os.path.join(
- os.path.dirname(__file__), "..", "..", "bazel-bin")
-
- # Find the path to the runfiles of the built target:
- # //bindings/python/packaging:all_pyiree_packages
- runfiles_dir = os.path.join(
- bazel_bin, "packaging", "python",
- "all_pyiree_packages%s.runfiles" % (get_exe_suffix(),))
- if not os.path.isdir(runfiles_dir):
- print("ERROR: Could not find build target 'all_pyiree_packages':",
- runfiles_dir)
- print("Make sure to build target", "//packaging/python:all_pyiree_packages")
- sys.exit(1)
-
- copy_prefix(dest_dir, runfiles_dir, ("bindings", "python"))
- copy_prefix(dest_dir, runfiles_dir,
- ("integrations", "tensorflow", "bindings", "python"))
-
-
-if __name__ == "__main__":
- main()
diff --git a/packaging/python/setup_compiler.py b/packaging/python/setup_compiler.py
deleted file mode 100644
index 57f4479..0000000
--- a/packaging/python/setup_compiler.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/python3
-
-# Copyright 2020 Google LLC
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Build platform specific wheel files for the pyiree.rt package.
-# Built artifacts are per-platform and build out of the build tree.
-# Usage:
-# ------
-# Windows with CMake:
-# export CMAKE_BUILD_ROOT='D:\src\build-iree' # Must be native path
-# python ./setup_compiler.py bdist_wheel
-
-import os
-import setuptools
-import sys
-
-# Ensure that path starts here for execution as a script.
-sys.path.insert(0, os.path.dirname(__file__))
-import common_setup
-
-
-def run():
- packages = setuptools.find_namespace_packages(
- common_setup.get_package_dir(),
- include=["pyiree.compiler", "pyiree.compiler.*"],
- exclude=["*.CMakeFiles"])
- print("Found packages:", packages)
- setup_kwargs = common_setup.get_setup_defaults(
- sub_project="compiler", description="IREE Generic Compiler")
- common_setup.setup(packages=packages,
- ext_modules=[
- setuptools.Extension(name="pyiree.compiler.binding",
- sources=[]),
- ],
- **setup_kwargs)
-
-
-if __name__ == "__main__":
- run()
diff --git a/packaging/python/setup_rt.py b/packaging/python/setup_rt.py
deleted file mode 100644
index c9fc948..0000000
--- a/packaging/python/setup_rt.py
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/python3
-
-# Copyright 2020 Google LLC
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Build platform specific wheel files for the pyiree.rt package.
-# Built artifacts are per-platform and build out of the build tree.
-
-import os
-import setuptools
-import sys
-
-# Ensure that path starts here for execution as a script.
-sys.path.insert(0, os.path.dirname(__file__))
-import common_setup
-
-
-def run():
- packages = setuptools.find_namespace_packages(
- common_setup.get_package_dir(),
- include=["pyiree.rt", "pyiree.rt.*"],
- exclude=["*.CMakeFiles"])
- print("Found packages:", packages)
- setup_kwargs = common_setup.get_setup_defaults(
- sub_project="rt",
- description="IREE Runtime Components (for executing compiled programs)")
- common_setup.setup(packages=packages,
- ext_modules=[
- setuptools.Extension(name="pyiree.rt.binding",
- sources=[]),
- ],
- **setup_kwargs)
-
-
-if __name__ == "__main__":
- run()
diff --git a/packaging/python/setup_tf.py b/packaging/python/setup_tf.py
deleted file mode 100644
index 252c756..0000000
--- a/packaging/python/setup_tf.py
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/python3
-
-# Copyright 2020 Google LLC
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Build platform specific wheel files for the pyiree.tf packages.
-# Built artifacts are per-platform and build out of the build tree.
-
-import os
-import platform
-import setuptools
-import sys
-
-# Ensure that path starts here for execution as a script.
-sys.path.insert(0, os.path.dirname(__file__))
-import common_setup
-
-
-def run():
- package_dir = common_setup.get_package_dir(prefix=("integrations",
- "tensorflow", "bindings",
- "python"))
- packages = setuptools.find_namespace_packages(package_dir,
- include=[
- "pyiree.tf.compiler",
- "pyiree.tf.compiler.*",
- "pyiree.tf.support",
- "pyiree.tf.support.*"
- ],
- exclude=["*.CMakeFiles"])
- print("Found packages:", packages)
- if not packages:
- print("ERROR: Did not find packages under", package_dir)
- sys.exit(1)
- setup_kwargs = common_setup.get_setup_defaults(
- sub_project="tf",
- description="IREE TensorFlow Compiler",
- package_dir=package_dir)
- common_setup.setup(packages=packages,
- ext_modules=[
- setuptools.Extension(name="pyiree.tf.compiler.binding",
- sources=[]),
- ],
- **setup_kwargs)
-
-
-if __name__ == "__main__":
- run()