### What this PR does / why we need it? fix packages for finding submodule. Before this pr, the wheel built by pip not contain submodule `ops` , thus will raise an `ImportError` when importing vllm ### How was this patch tested? 1. build vllm-ascend wheel by pip ```bash cd ./vllm-ascend pip wheel ./ --no-deps pip install vllm_ascend-0.1.dev11+g07f2a16.d20250211-py3-none-any.whl #change file name according to yours wheel. ``` 2. check vllm ```python import vllm ``` Signed-off-by: MengqingCao <cmq0113@163.com>
103 lines
3.5 KiB
Python
103 lines
3.5 KiB
Python
#
|
|
# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
|
|
# This file is a part of the vllm-ascend project.
|
|
# Adapted from https://github.com/vllm-project/vllm/blob/main/setup.py
|
|
# Copyright 2023 The vLLM team.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
#
|
|
|
|
import os
|
|
from typing import List
|
|
|
|
from setuptools import find_packages, setup
|
|
from setuptools_scm import get_version
|
|
|
|
ROOT_DIR = os.path.dirname(__file__)
|
|
try:
|
|
VERSION = get_version(write_to="vllm_ascend/_version.py")
|
|
except LookupError:
|
|
# The checkout action in github action CI does not checkout the tag. It
|
|
# only checks out the commit. In this case, we set a dummy version.
|
|
VERSION = "0.0.0"
|
|
|
|
|
|
def get_path(*filepath) -> str:
|
|
return os.path.join(ROOT_DIR, *filepath)
|
|
|
|
|
|
def read_readme() -> str:
|
|
"""Read the README file if present."""
|
|
p = get_path("README.md")
|
|
if os.path.isfile(p):
|
|
with open(get_path("README.md"), encoding="utf-8") as f:
|
|
return f.read()
|
|
else:
|
|
return ""
|
|
|
|
|
|
def get_requirements() -> List[str]:
|
|
"""Get Python package dependencies from requirements.txt."""
|
|
|
|
def _read_requirements(filename: str) -> List[str]:
|
|
with open(get_path(filename)) as f:
|
|
requirements = f.read().strip().split("\n")
|
|
resolved_requirements = []
|
|
for line in requirements:
|
|
if line.startswith("-r "):
|
|
resolved_requirements += _read_requirements(line.split()[1])
|
|
elif line.startswith("--"):
|
|
continue
|
|
else:
|
|
resolved_requirements.append(line)
|
|
return resolved_requirements
|
|
|
|
try:
|
|
requirements = _read_requirements("requirements.txt")
|
|
except ValueError:
|
|
print("Failed to read requirements.txt in vllm_ascend.")
|
|
return requirements
|
|
|
|
|
|
setup(
|
|
name='vllm_ascend',
|
|
# Follow:
|
|
# https://packaging.python.org/en/latest/specifications/version-specifiers
|
|
version=VERSION,
|
|
author="vLLM-Ascend team",
|
|
license="Apache 2.0",
|
|
description=("vLLM Ascend backend plugin"),
|
|
long_description=read_readme(),
|
|
long_description_content_type="text/markdown",
|
|
url="https://github.com/vllm-project/vllm-ascend",
|
|
project_urls={
|
|
"Homepage": "https://github.com/vllm-project/vllm-ascend",
|
|
},
|
|
classifiers=[
|
|
"Programming Language :: Python :: 3.9",
|
|
"Programming Language :: Python :: 3.10",
|
|
"Programming Language :: Python :: 3.11",
|
|
"Programming Language :: Python :: 3.12",
|
|
"License :: OSI Approved :: Apache Software License",
|
|
"Intended Audience :: Developers",
|
|
"Intended Audience :: Information Technology",
|
|
"Intended Audience :: Science/Research",
|
|
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
"Topic :: Scientific/Engineering :: Information Analysis",
|
|
],
|
|
packages=find_packages(exclude=("docs", "examples", "tests*", "patch")),
|
|
python_requires=">=3.9",
|
|
install_requires=get_requirements(),
|
|
extras_require={},
|
|
entry_points={'vllm.platform_plugins': ["ascend = vllm_ascend:register"]})
|