|
| 1 | +# Copyright 2025 Rebellions Inc. All rights reserved. |
| 2 | + |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at: |
| 6 | + |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | + |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | +import os |
| 15 | + |
| 16 | +from setuptools import find_packages, setup |
| 17 | +from setuptools_scm import get_version |
| 18 | + |
| 19 | +ROOT_DIR = os.path.dirname(__file__) |
| 20 | + |
| 21 | + |
| 22 | +def get_path(*filepath) -> str: |
| 23 | + return os.path.join(ROOT_DIR, *filepath) |
| 24 | + |
| 25 | + |
| 26 | +def read_readme() -> str: |
| 27 | + """Read the README file if present.""" |
| 28 | + p = get_path("README.md") |
| 29 | + if os.path.isfile(p): |
| 30 | + with open(get_path("README.md"), encoding="utf-8") as f: |
| 31 | + return f.read() |
| 32 | + else: |
| 33 | + return "" |
| 34 | + |
| 35 | + |
| 36 | +def get_vllm_version() -> str: |
| 37 | + version = get_version(write_to="vllm_rbln/_version.py") |
| 38 | + return version |
| 39 | + |
| 40 | + |
| 41 | +def get_requirements() -> list[str]: |
| 42 | + """Get Python package dependencies from requirements.txt.""" |
| 43 | + |
| 44 | + def _read_requirements(filename: str) -> list[str]: |
| 45 | + with open(get_path(filename)) as f: |
| 46 | + requirements = f.read().strip().split("\n") |
| 47 | + resolved_requirements = [] |
| 48 | + for line in requirements: |
| 49 | + if line.startswith("-r"): |
| 50 | + resolved_requirements += _read_requirements(line.split()[1]) |
| 51 | + elif line.startswith("--"): |
| 52 | + continue |
| 53 | + else: |
| 54 | + resolved_requirements.append(line) |
| 55 | + return resolved_requirements |
| 56 | + |
| 57 | + try: |
| 58 | + requirements = _read_requirements("requirements.txt") |
| 59 | + except ValueError: |
| 60 | + print("Failed to read requirements.txt in vllm_rbln.") |
| 61 | + return requirements |
| 62 | + |
| 63 | + |
| 64 | +setup(name="vllm-rbln", |
| 65 | + version=get_vllm_version(), |
| 66 | + author="Rebellions Inc.", |
| 67 | + author_email="support@rebellions.ai", |
| 68 | + description="vLLM plugin for RBLN NPU", |
| 69 | + long_description=read_readme(), |
| 70 | + long_description_content_type="text/markdown", |
| 71 | + url="https://github.com/rebellions-sw/vllm-rbln", |
| 72 | + project_urls={ |
| 73 | + "Homepage": "https://rebellions.ai", |
| 74 | + "Documentation": "https://docs.rbln.ai", |
| 75 | + "Repository": "https://github.com/rebellions-sw/vllm-rbln" |
| 76 | + }, |
| 77 | + classifiers=[ |
| 78 | + "Programming Language :: Python :: 3.9", |
| 79 | + "Programming Language :: Python :: 3.10", |
| 80 | + "Programming Language :: Python :: 3.11", |
| 81 | + "Programming Language :: Python :: 3.12", |
| 82 | + "Programming Language :: Python :: 3.13", |
| 83 | + "Operating System :: POSIX :: Linux", |
| 84 | + "License :: OSI Approved :: Apache Software License", |
| 85 | + "Intended Audience :: Developers", |
| 86 | + "Intended Audience :: Information Technology", |
| 87 | + "Intended Audience :: Science/Research", |
| 88 | + "Topic :: Scientific/Engineering :: Artificial Intelligence", |
| 89 | + "Topic :: Scientific/Engineering :: Information Analysis", |
| 90 | + ], |
| 91 | + packages=find_packages(), |
| 92 | + python_requires=">=3.9", |
| 93 | + install_requires=get_requirements(), |
| 94 | + entry_points={ |
| 95 | + "vllm.platform_plugins": ["rbln = vllm_rbln:register"], |
| 96 | + "vllm.general_plugins": [ |
| 97 | + "rbln_new_models = vllm_rbln:register_model", |
| 98 | + "rbln_custom_ops = vllm_rbln:register_ops" |
| 99 | + ] |
| 100 | + }) |
0 commit comments