Skip to content

Commit

Permalink
Draft a shark-platform meta package to organize Python packages.
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottTodd committed Oct 2, 2024
1 parent b0c2399 commit c7d7592
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[build-system]
requires = [
"setuptools>=61.0",
"wheel",
]
build-backend = "setuptools.build_meta"
84 changes: 84 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Copyright 2024 Advanced Micro Devices, Inc.
#
# 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

import json
import os
import distutils.command.build
from pathlib import Path

from setuptools import setup # type: ignore

THIS_DIR = Path(__file__).resolve().parent
REPO_DIR = THIS_DIR
VERSION_INFO_FILE = REPO_DIR / "version_info.json"


def load_version_info():
with open(VERSION_INFO_FILE, "rt") as f:
return json.load(f)


version_info = load_version_info()
PACKAGE_VERSION = version_info["package-version"]

with open(os.path.join(THIS_DIR, "README.md"), "rt") as f:
README = f.read()


# Override build command so that we can build into _python_build
# instead of the default "build". This avoids collisions with
# typical CMake incantations, which can produce all kinds of
# hilarity (like including the contents of the build/lib directory).
class BuildCommand(distutils.command.build.build):
def initialize_options(self):
distutils.command.build.build.initialize_options(self)
self.build_base = "_python_build"


setup(
name=f"shark-platform",
version=f"{PACKAGE_VERSION}",
author="SHARK Authors",
description="SHARK Platform meta package",
long_description=README,
long_description_content_type="text/markdown",
url="https://github.com/nod-ai/SHARK-Platform",
license="Apache-2.0",
classifiers=[
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3",
],
packages=[],
install_requires=[
# "sharktank",
"shortfin",
],
extras_require={
"apps": [
# TODO: add others here, or just rely on what sharktank depends on?
# e.g. transformers, huggingface-hub
"dataclasses-json",
"tokenizers",
],
"onnx": [
"iree-runtime",
"iree-compiler[onnx]",
],
"torch": [
# TODO: plumb through [cpu,cuda,rocm] extras (if possible)
# PyTorch uses `--index-url https://download.pytorch.org/whl/cpu`,
# see https://pytorch.org/get-started/locally/.
# TODO: or just drop this? if sharktank always pulls it in
"iree-turbine",
],
"serving": [
"fastapi",
"uvicorn",
],
},
cmdclass={"build": BuildCommand},
)

0 comments on commit c7d7592

Please sign in to comment.