blob: bb2e8a09db6f129378afd1e953eb3ed267ec5aae [file] [log] [blame]
Tim Hall79d07d22020-04-27 18:20:16 +01001# 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 Hall79d07d22020-04-27 18:20:16 +010016# Description:
17# Packaging for the Vela compiler
Michael McGeagh1e05afa2020-12-03 13:08:32 +000018import os
Michael McGeagh3adc1e42020-11-25 14:23:08 +000019import re
Diego Russoe8a10452020-04-21 17:39:10 +010020
21from setuptools import Extension
22from setuptools import find_namespace_packages
23from setuptools import setup
Tim Hall79d07d22020-04-27 18:20:16 +010024
25# Read the contents of README.md file
Michael McGeagh1e05afa2020-12-03 13:08:32 +000026this_directory = os.path.abspath(os.path.dirname(__file__))
27with open(os.path.join(this_directory, "README.md"), encoding="utf-8") as f:
Tim Hall79d07d22020-04-27 18:20:16 +010028 long_description = f.read()
Michael McGeagh44c6fe92020-12-01 13:24:09 +000029 tag = "2.0.1"
Michael McGeagh3adc1e42020-11-25 14:23:08 +000030 url = f"https://review.mlplatform.org/plugins/gitiles/ml/ethos-u/ethos-u-vela/+/refs/tags/{tag}/"
Michael McGeagh1e05afa2020-12-03 13:08:32 +000031 # 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 Hall79d07d22020-04-27 18:20:16 +010041
42mlw_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
Louis Verhaard9bfe0f82020-12-03 12:26:25 +010047tensor_allocator_module = Extension(
48 "ethosu.tensor_allocator",
49 ["ethosu/tensor_allocator/tensor_allocatormodule.cpp", "ethosu/tensor_allocator/search_allocator.cpp"],
50 depends=["ethosu/tensor_allocator/search_allocator.h"],
51)
52
Tim Hall79d07d22020-04-27 18:20:16 +010053setup(
54 name="ethos-u-vela",
55 use_scm_version=True,
Tim Halld13bd062020-11-12 23:29:25 +000056 description="Neural network model compiler for Arm Ethos-U NPUs",
Tim Hall79d07d22020-04-27 18:20:16 +010057 long_description=long_description,
58 long_description_content_type="text/markdown",
59 url="https://git.mlplatform.org/ml/ethos-u/ethos-u-vela.git/",
60 author="Arm Ltd.",
61 license="Apache License 2.0",
62 classifiers=[
Tim Halle76a5332020-06-23 09:52:07 +010063 "Development Status :: 5 - Production/Stable",
Tim Hall79d07d22020-04-27 18:20:16 +010064 "Intended Audience :: Developers",
65 "License :: OSI Approved :: Apache Software License",
66 "Operating System :: POSIX :: Linux",
67 "Programming Language :: C",
Louis Verhaard9bfe0f82020-12-03 12:26:25 +010068 "Programming Language :: C++ :: C++11",
Tim Hall79d07d22020-04-27 18:20:16 +010069 "Programming Language :: Python :: 3",
70 "Programming Language :: Python :: 3.6",
71 "Programming Language :: Python :: 3.7",
72 "Programming Language :: Python :: 3.8",
73 "Topic :: Scientific/Engineering :: Artificial Intelligence",
74 "Topic :: Software Development :: Compilers",
75 ],
76 keywords=["ethos-u", "vela compiler", "tflite", "npu"],
77 packages=find_namespace_packages(include=["ethosu.*"]),
78 python_requires="~=3.6", # We support only 3.6+
Fredrik Svedberg5b513882020-12-11 13:42:22 +010079 install_requires=[
80 "flatbuffers==1.11.0",
81 "numpy>=1.16.6",
82 "numpy>=1.16.6,<1.19.4 ; platform_system=='Windows'",
83 "lxml>=4.5.1",
84 ],
Tim Hall79d07d22020-04-27 18:20:16 +010085 entry_points={"console_scripts": ["vela = ethosu.vela.vela:main"]},
Louis Verhaard9bfe0f82020-12-03 12:26:25 +010086 ext_modules=[mlw_module, tensor_allocator_module],
Tim Hall79d07d22020-04-27 18:20:16 +010087 setup_requires=["setuptools_scm"],
88)