Tim Hall | 79d07d2 | 2020-04-27 18:20:16 +0100 | [diff] [blame] | 1 | # Copyright (C) 2020 Arm Limited or its affiliates. All rights reserved. |
| 2 | # |
| 3 | # SPDX-License-Identifier: Apache-2.0 |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the License); you may |
| 6 | # not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an AS IS BASIS, WITHOUT |
| 13 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
Tim Hall | 79d07d2 | 2020-04-27 18:20:16 +0100 | [diff] [blame] | 16 | # Description: |
| 17 | # Packaging for the Vela compiler |
Michael McGeagh | 1e05afa | 2020-12-03 13:08:32 +0000 | [diff] [blame] | 18 | import os |
Michael McGeagh | 3adc1e4 | 2020-11-25 14:23:08 +0000 | [diff] [blame] | 19 | import re |
Diego Russo | e8a1045 | 2020-04-21 17:39:10 +0100 | [diff] [blame] | 20 | |
| 21 | from setuptools import Extension |
| 22 | from setuptools import find_namespace_packages |
| 23 | from setuptools import setup |
Tim Hall | 79d07d2 | 2020-04-27 18:20:16 +0100 | [diff] [blame] | 24 | |
| 25 | # Read the contents of README.md file |
Michael McGeagh | 1e05afa | 2020-12-03 13:08:32 +0000 | [diff] [blame] | 26 | this_directory = os.path.abspath(os.path.dirname(__file__)) |
| 27 | with open(os.path.join(this_directory, "README.md"), encoding="utf-8") as f: |
Tim Hall | 79d07d2 | 2020-04-27 18:20:16 +0100 | [diff] [blame] | 28 | long_description = f.read() |
Michael McGeagh | 44c6fe9 | 2020-12-01 13:24:09 +0000 | [diff] [blame] | 29 | tag = "2.0.1" |
Michael McGeagh | 3adc1e4 | 2020-11-25 14:23:08 +0000 | [diff] [blame] | 30 | url = f"https://review.mlplatform.org/plugins/gitiles/ml/ethos-u/ethos-u-vela/+/refs/tags/{tag}/" |
Michael McGeagh | 1e05afa | 2020-12-03 13:08:32 +0000 | [diff] [blame] | 31 | # Find all markdown links that match the format: [text](link) |
| 32 | for match, link in re.findall(r"(\[.+?\]\((.+?)\))", long_description): |
| 33 | # If the link is a file that exists, replace it with the web link to the file instead |
| 34 | if os.path.exists(os.path.join(this_directory, link)): |
| 35 | url_link = match.replace(link, url + link) |
| 36 | long_description = long_description.replace(match, url_link) |
| 37 | if os.getenv("ETHOSU_VELA_DEBUG"): |
| 38 | # Verify the contents of the modifications made in a markdown renderer |
| 39 | with open(os.path.join(this_directory, "PYPI.md"), "wt", encoding="utf-8") as fout: |
| 40 | fout.write(long_description) |
Tim Hall | 79d07d2 | 2020-04-27 18:20:16 +0100 | [diff] [blame] | 41 | |
| 42 | mlw_module = Extension( |
| 43 | "ethosu.mlw_codec", |
| 44 | ["ethosu/mlw_codec/mlw_encode.c", "ethosu/mlw_codec/mlw_decode.c", "ethosu/mlw_codec/mlw_codecmodule.c"], |
| 45 | ) |
| 46 | |
| 47 | setup( |
| 48 | name="ethos-u-vela", |
| 49 | use_scm_version=True, |
Tim Hall | d13bd06 | 2020-11-12 23:29:25 +0000 | [diff] [blame] | 50 | description="Neural network model compiler for Arm Ethos-U NPUs", |
Tim Hall | 79d07d2 | 2020-04-27 18:20:16 +0100 | [diff] [blame] | 51 | long_description=long_description, |
| 52 | long_description_content_type="text/markdown", |
| 53 | url="https://git.mlplatform.org/ml/ethos-u/ethos-u-vela.git/", |
| 54 | author="Arm Ltd.", |
| 55 | license="Apache License 2.0", |
| 56 | classifiers=[ |
Tim Hall | e76a533 | 2020-06-23 09:52:07 +0100 | [diff] [blame] | 57 | "Development Status :: 5 - Production/Stable", |
Tim Hall | 79d07d2 | 2020-04-27 18:20:16 +0100 | [diff] [blame] | 58 | "Intended Audience :: Developers", |
| 59 | "License :: OSI Approved :: Apache Software License", |
| 60 | "Operating System :: POSIX :: Linux", |
Fredrik Svedberg | 1a184e4 | 2020-12-15 09:57:26 +0100 | [diff] [blame] | 61 | "Operating System :: Microsoft :: Windows", |
Tim Hall | 79d07d2 | 2020-04-27 18:20:16 +0100 | [diff] [blame] | 62 | "Programming Language :: C", |
| 63 | "Programming Language :: Python :: 3", |
| 64 | "Programming Language :: Python :: 3.6", |
| 65 | "Programming Language :: Python :: 3.7", |
| 66 | "Programming Language :: Python :: 3.8", |
| 67 | "Topic :: Scientific/Engineering :: Artificial Intelligence", |
| 68 | "Topic :: Software Development :: Compilers", |
| 69 | ], |
| 70 | keywords=["ethos-u", "vela compiler", "tflite", "npu"], |
| 71 | packages=find_namespace_packages(include=["ethosu.*"]), |
| 72 | python_requires="~=3.6", # We support only 3.6+ |
Fredrik Svedberg | 5b51388 | 2020-12-11 13:42:22 +0100 | [diff] [blame] | 73 | install_requires=[ |
Tim Hall | 42abec1 | 2021-02-04 21:31:57 +0000 | [diff] [blame] | 74 | "flatbuffers==1.12.0", |
Fredrik Svedberg | 5b51388 | 2020-12-11 13:42:22 +0100 | [diff] [blame] | 75 | "numpy>=1.16.6", |
| 76 | "numpy>=1.16.6,<1.19.4 ; platform_system=='Windows'", |
| 77 | "lxml>=4.5.1", |
| 78 | ], |
Tim Hall | 79d07d2 | 2020-04-27 18:20:16 +0100 | [diff] [blame] | 79 | entry_points={"console_scripts": ["vela = ethosu.vela.vela:main"]}, |
Louis Verhaard | d700252 | 2021-01-20 17:23:54 +0100 | [diff] [blame^] | 80 | ext_modules=[mlw_module], |
Tim Hall | 79d07d2 | 2020-04-27 18:20:16 +0100 | [diff] [blame] | 81 | setup_requires=["setuptools_scm"], |
| 82 | ) |