-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates the Python package to use `build` to package instead of the legacy `bdist_wheel` style. `pyproject.toml` is the single source of truth for the package. Additionally, this change also move stub generation to `setup.py` so that it happens automatically when the wheels are generated. This way the stub files don't need to be maintained in the repo and manually updated.
- Loading branch information
1 parent
3423591
commit b3d03f0
Showing
7 changed files
with
66 additions
and
819 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,53 @@ | |
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
[project] | ||
name = "tritonserver" | ||
authors = [{ name = "NVIDIA Inc.", email = "[email protected]" }] | ||
description = "Triton Inference Server In-Process Python API" | ||
license = { file = "LICENSE.txt" } | ||
dynamic = ["version"] | ||
dependencies = ["numpy<2"] | ||
classifiers = [ | ||
"Development Status :: 5 - Production/Stable", | ||
"Intended Audience :: Developers", | ||
"Intended Audience :: Science/Research", | ||
"Intended Audience :: Information Technology", | ||
"Topic :: Scientific/Engineering", | ||
"Topic :: Scientific/Engineering :: Image Recognition", | ||
"Topic :: Scientific/Engineering :: Artificial Intelligence", | ||
"Topic :: Software Development :: Libraries", | ||
"Topic :: Utilities", | ||
"License :: OSI Approved :: BSD License", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.10", | ||
"Environment :: Console", | ||
"Natural Language :: English", | ||
"Operating System :: OS Independent", | ||
] | ||
|
||
[tool.setuptools] | ||
include-package-data = true | ||
|
||
[tool.setuptools.package-data] | ||
tritonserver = ["_c/triton_bindings.*.so"] | ||
|
||
[build-system] | ||
requires = [ | ||
"setuptools==75.3.0", | ||
"wheel==0.44.0", | ||
# For stubgen: | ||
"mypy==1.11.0", | ||
"numpy<2", | ||
] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project.optional-dependencies] | ||
GPU = ["cupy-cuda12x"] | ||
test = ["pytest"] | ||
all = ["tritonserver[GPU]", "tritonserver[test]"] | ||
|
||
|
||
[tool.codespell] | ||
# note: pre-commit passes explicit lists of files here, which this skip file list doesn't override - | ||
# this is only to allow you to run codespell interactively | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,89 +25,23 @@ | |
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
import os | ||
import sys | ||
from itertools import chain | ||
|
||
from setuptools import find_packages, setup | ||
import subprocess | ||
|
||
if "--plat-name" in sys.argv: | ||
PLATFORM_FLAG = sys.argv[sys.argv.index("--plat-name") + 1] | ||
else: | ||
PLATFORM_FLAG = "any" | ||
from setuptools import setup | ||
from setuptools.command.build_py import build_py | ||
|
||
if "VERSION" not in os.environ: | ||
raise Exception("envvar VERSION must be specified") | ||
|
||
VERSION = os.environ["VERSION"] | ||
class BuildPyCommand(build_py): | ||
def run(self): | ||
build_py.run(self) | ||
# Generate stub files: | ||
package_name = self.distribution.metadata.name | ||
subprocess.run( | ||
["stubgen", "-p", f"{package_name}._c", "-o", f"{self.build_lib}"], | ||
check=True, | ||
) | ||
|
||
try: | ||
from wheel.bdist_wheel import bdist_wheel as _bdist_wheel | ||
|
||
class bdist_wheel(_bdist_wheel): | ||
def finalize_options(self): | ||
_bdist_wheel.finalize_options(self) | ||
self.root_is_pure = False | ||
|
||
def get_tag(self): | ||
pyver, abi, plat = "py3", "none", PLATFORM_FLAG | ||
return pyver, abi, plat | ||
|
||
except ImportError: | ||
bdist_wheel = None | ||
|
||
this_directory = os.path.abspath(os.path.dirname(__file__)) | ||
|
||
data_files = [ | ||
("", ["LICENSE.txt"]), | ||
] | ||
|
||
# Type checking marker file indicating support for type checkers. | ||
# https://peps.python.org/pep-0561/ | ||
# Type hints for c extension generated by mypy | ||
platform_package_data = [ | ||
os.environ["TRITON_PYBIND"], | ||
"py.typed", | ||
"_c/__init__.pyi", | ||
"_c/triton_bindings.pyi", | ||
] | ||
|
||
gpu_extras = ["cupy-cuda12x"] | ||
test_extras = ["pytest"] | ||
all_extras = gpu_extras + test_extras | ||
|
||
setup( | ||
name="tritonserver", | ||
version=VERSION, | ||
author="NVIDIA Inc.", | ||
author_email="[email protected]", | ||
description="Triton Inference Server In-Process Python API", | ||
license="BSD", | ||
url="https://developer.nvidia.com/nvidia-triton-inference-server", | ||
classifiers=[ | ||
"Development Status :: 5 - Production/Stable", | ||
"Intended Audience :: Developers", | ||
"Intended Audience :: Science/Research", | ||
"Intended Audience :: Information Technology", | ||
"Topic :: Scientific/Engineering", | ||
"Topic :: Scientific/Engineering :: Image Recognition", | ||
"Topic :: Scientific/Engineering :: Artificial Intelligence", | ||
"Topic :: Software Development :: Libraries", | ||
"Topic :: Utilities", | ||
"License :: OSI Approved :: BSD License", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.10", | ||
"Environment :: Console", | ||
"Natural Language :: English", | ||
"Operating System :: OS Independent", | ||
], | ||
packages=find_packages(), | ||
package_data={ | ||
"": platform_package_data, | ||
}, | ||
zip_safe=False, | ||
cmdclass={"bdist_wheel": bdist_wheel}, | ||
data_files=data_files, | ||
install_requires=["numpy<2"], | ||
extras_require={"GPU": gpu_extras, "test": test_extras, "all": all_extras}, | ||
) | ||
if __name__ == "__main__": | ||
setup(cmdclass={"build_py": BuildPyCommand}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.