Adjust some setup.py bits rejected by pypi.
Also adds a script/basic docs for fetching assets and uploading.
diff --git a/bindings/python/iree/runtime/setup.py.in b/bindings/python/iree/runtime/setup.py.in
index 2d0cfac..524f9ef 100644
--- a/bindings/python/iree/runtime/setup.py.in
+++ b/bindings/python/iree/runtime/setup.py.in
@@ -19,17 +19,16 @@
version="@IREE_RELEASE_VERSION@",
author="The IREE Team",
author_email="iree-discuss@googlegroups.com",
- license="Apache",
description="IREE Python Runtime Components",
long_description=README,
long_description_content_type="text/markdown",
- url="https://github.com/google/iree",
+ license="Apache-2.0",
classifiers=[
- "Programming Language :: Python :: 3",
- "License :: OSI Approved :: Apache License",
- "Operating System :: OS Independent",
- "Development Status :: 3 - Alpha",
+ "Programming Language :: Python :: 3.7",
+ "Programming Language :: Python :: 3.8",
+ "Programming Language :: Python :: 3.9",
],
+ url="https://github.com/google/iree",
python_requires=">=3.7",
packages=find_namespace_packages(
include=["iree.runtime", "iree.runtime.*"]),
diff --git a/build_tools/python_deploy/fetch_github_release_files.py b/build_tools/python_deploy/fetch_github_release_files.py
new file mode 100755
index 0000000..08cee8c
--- /dev/null
+++ b/build_tools/python_deploy/fetch_github_release_files.py
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+# Copyright 2020 The IREE Authors
+#
+# Licensed under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+
+# Fetches all wheels and pypi artifacts from a github release.
+# Usage:
+# GITHUB_USER=github_username:token \
+# fetch_github_release_files candidate-20220108.8 ~/tmp/wheels
+#
+# You can then upload to pypi via:
+# pip install twine
+# export TWINE_USERNAME=...
+# export TWINE_PASSWORD='...'
+# twine upload ~/tmp/wheels
+
+import requests
+import requests.auth
+import json
+import os
+import sys
+
+
+def main(args):
+ if len(args) < 2:
+ print("Syntax: fetch_github_release_files.py <tag> <dir>")
+ sys.exit(1)
+ tag = args[0]
+ dir = args[1]
+ github_user = os.getenv("GITHUB_USER")
+ github_auth = None
+ if github_user is not None:
+ print("Using github user from GITHUB_USER env var")
+ github_auth = requests.auth.HTTPBasicAuth(github_user, "")
+ else:
+ print("No github user set. Recommend setting GITHUB_USER=user:token")
+ print("Fetching release from tag:", tag)
+ release_resp = requests.get(
+ f"https://api.github.com/repos/google/iree/releases/tags/{tag}",
+ headers={"Accept": "application/vnd.github.v3+json"},
+ auth=github_auth)
+ release_resp.raise_for_status()
+ release_json = json.loads(release_resp.text)
+ assets = release_json["assets"]
+ print(f"Release contains {len(assets)} assets: ")
+
+ os.makedirs(dir, exist_ok=True)
+ for asset in assets:
+ asset_name = asset["name"]
+ asset_url = asset["url"]
+ if not asset_name.endswith(".whl"):
+ print(f"SKIP: {asset_name}")
+ continue
+ print(f"Downloading {asset_name} from {asset_url}")
+ asset_resp = requests.get(asset_url,
+ headers={"Accept": "application/octet-stream"},
+ auth=github_auth)
+ asset_resp.raise_for_status()
+ dest_file = os.path.join(dir, asset_name)
+ with open(dest_file, "wb") as f:
+ f.write(asset_resp.content)
+
+
+if __name__ == "__main__":
+ main(sys.argv[1:])
diff --git a/integrations/tensorflow/bindings/python/iree/tools/tf/setup.py.in b/integrations/tensorflow/bindings/python/iree/tools/tf/setup.py.in
index 0e7e59e..df15598 100644
--- a/integrations/tensorflow/bindings/python/iree/tools/tf/setup.py.in
+++ b/integrations/tensorflow/bindings/python/iree/tools/tf/setup.py.in
@@ -58,17 +58,16 @@
version="@IREE_RELEASE_VERSION@",
author="The IREE Team",
author_email="iree-discuss@googlegroups.com",
- license="Apache",
description="IREE TensorFlow Compiler Tools",
long_description=README,
long_description_content_type="text/markdown",
- url="https://github.com/google/iree",
+ license="Apache-2.0",
classifiers=[
- "Programming Language :: Python :: 3",
- "License :: OSI Approved :: Apache License",
- "Operating System :: OS Independent",
- "Development Status :: 3 - Alpha",
+ "Programming Language :: Python :: 3.7",
+ "Programming Language :: Python :: 3.8",
+ "Programming Language :: Python :: 3.9",
],
+ url="https://github.com/google/iree",
python_requires=">=3.7",
packages=find_namespace_packages(include=[
"iree.tools.tf",
diff --git a/integrations/tensorflow/bindings/python/iree/tools/tflite/setup.py.in b/integrations/tensorflow/bindings/python/iree/tools/tflite/setup.py.in
index 7952329..f26ad3e 100644
--- a/integrations/tensorflow/bindings/python/iree/tools/tflite/setup.py.in
+++ b/integrations/tensorflow/bindings/python/iree/tools/tflite/setup.py.in
@@ -58,17 +58,16 @@
version="@IREE_RELEASE_VERSION@",
author="The IREE Team",
author_email="iree-discuss@googlegroups.com",
- license="Apache",
description="IREE TFLite Compiler Tools",
long_description=README,
long_description_content_type="text/markdown",
- url="https://github.com/google/iree",
+ license="Apache-2.0",
classifiers=[
- "Programming Language :: Python :: 3",
- "License :: OSI Approved :: Apache License",
- "Operating System :: OS Independent",
- "Development Status :: 3 - Alpha",
+ "Programming Language :: Python :: 3.7",
+ "Programming Language :: Python :: 3.8",
+ "Programming Language :: Python :: 3.9",
],
+ url="https://github.com/google/iree",
python_requires=">=3.7",
packages=find_namespace_packages(include=[
"iree.tools.tflite",
diff --git a/integrations/tensorflow/bindings/python/iree/tools/xla/setup.py.in b/integrations/tensorflow/bindings/python/iree/tools/xla/setup.py.in
index a2d6a92..192824d 100644
--- a/integrations/tensorflow/bindings/python/iree/tools/xla/setup.py.in
+++ b/integrations/tensorflow/bindings/python/iree/tools/xla/setup.py.in
@@ -58,17 +58,16 @@
version="@IREE_RELEASE_VERSION@",
author="The IREE Team",
author_email="iree-discuss@googlegroups.com",
- license="Apache",
description="IREE XLA Compiler Tools",
long_description=README,
long_description_content_type="text/markdown",
- url="https://github.com/google/iree",
+ license="Apache-2.0",
classifiers=[
- "Programming Language :: Python :: 3",
- "License :: OSI Approved :: Apache License",
- "Operating System :: OS Independent",
- "Development Status :: 3 - Alpha",
+ "Programming Language :: Python :: 3.7",
+ "Programming Language :: Python :: 3.8",
+ "Programming Language :: Python :: 3.9",
],
+ url="https://github.com/google/iree",
python_requires=">=3.7",
packages=find_namespace_packages(include=[
"iree.tools.xla",
diff --git a/llvm-external-projects/iree-compiler-api/setup.py b/llvm-external-projects/iree-compiler-api/setup.py
index 3665f45..fbb0a2c 100644
--- a/llvm-external-projects/iree-compiler-api/setup.py
+++ b/llvm-external-projects/iree-compiler-api/setup.py
@@ -181,6 +181,12 @@
author_email="iree-discuss@googlegroups.com",
description="IREE Compiler API",
long_description="",
+ license="Apache-2.0",
+ classifiers=[
+ "Programming Language :: Python :: 3.7",
+ "Programming Language :: Python :: 3.8",
+ "Programming Language :: Python :: 3.9",
+ ],
ext_modules=[
CMakeExtension("iree.compiler._mlir_libs._mlir"),
CMakeExtension("iree.compiler._mlir_libs._ireeDialects"),