# NOTE: The following are managed by ./tools/dependencies.py # project.classifiers, project.dependencies, project.optional-dependencies, project.urls [build-system] build-backend = "hatchling.build" requires = ["hatchling", "hatch-vcs", "hatch-fancy-pypi-readme", "hatch-mypyc==0.16.0"] [project] authors = [{ name = "Aaron Pham", email = "aarnphm@bentoml.com" }] classifiers = [ "Development Status :: 5 - Production/Stable", "Environment :: GPU :: NVIDIA CUDA", "Environment :: GPU :: NVIDIA CUDA :: 12", "Environment :: GPU :: NVIDIA CUDA :: 11.8", "Environment :: GPU :: NVIDIA CUDA :: 11.7", "License :: OSI Approved :: Apache Software License", "Topic :: Scientific/Engineering :: Artificial Intelligence", "Topic :: Software Development :: Libraries", "Operating System :: OS Independent", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "Intended Audience :: System Administrators", "Typing :: Typed", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", ] dependencies = [ "bentoml[grpc,io]>=1.0.25", "transformers[torch,tokenizers,accelerate]>=4.29.0", "safetensors", "optimum", "attrs>=23.1.0", "cattrs>=23.1.0", "orjson", "inflection", "tabulate[widechars]>=0.9.0", "httpx", "click>=8.1.3", "typing_extensions", "ghapi", "cuda-python;platform_system!=\"Darwin\"", "bitsandbytes<0.42", ] description = 'OpenLLM: Operating LLMs in production' dynamic = ["version", "readme"] keywords = [ "MLOps", "AI", "BentoML", "Model Serving", "Model Deployment", "LLMOps", "Large Language Model", "Generative AI", "StableLM", "Alpaca", "PyTorch", "Transformers", ] license = "Apache-2.0" name = "openllm" requires-python = ">=3.8" [project.scripts] openllm = "openllm.cli.entrypoint:cli" openllm-build-base-container = "openllm.cli.extension.build_base_container:cli" openllm-dive-bentos = "openllm.cli.extension.dive_bentos:cli" openllm-get-containerfile = "openllm.cli.extension.get_containerfile:cli" openllm-get-prompt = "openllm.cli.extension.get_prompt:cli" openllm-list-bentos = "openllm.cli.extension.list_bentos:cli" openllm-list-models = "openllm.cli.extension.list_models:cli" openllm-playground = "openllm.cli.extension.playground:cli" [project.urls] Blog = "https://modelserving.com" Chat = "https://discord.gg/openllm" Documentation = "https://github.com/bentoml/openllm#readme" GitHub = "https://github.com/bentoml/openllm" History = "https://github.com/bentoml/openllm/blob/main/CHANGELOG.md" Homepage = "https://bentoml.com" Tracker = "https://github.com/bentoml/openllm/issues" Twitter = "https://twitter.com/bentomlai" [project.optional-dependencies] agents = ["transformers[agents]>=4.30", "diffusers", "soundfile"] all = [ "openllm[agents]", "openllm[baichuan]", "openllm[chatglm]", "openllm[falcon]", "openllm[fine-tune]", "openllm[flan-t5]", "openllm[ggml]", "openllm[gptq]", "openllm[llama]", "openllm[mpt]", "openllm[openai]", "openllm[opt]", "openllm[playground]", "openllm[starcoder]", "openllm[vllm]", ] baichuan = ["cpm-kernels", "sentencepiece"] chatglm = ["cpm-kernels", "sentencepiece"] falcon = ["einops", "xformers"] fine-tune = ["peft>=0.4.0", "bitsandbytes", "datasets", "accelerate", "trl"] flan-t5 = ["flax", "jax", "jaxlib", "tensorflow", "keras"] ggml = ["ctransformers"] gptq = ["auto-gptq[triton]"] llama = ["fairscale", "sentencepiece"] mpt = ["triton", "einops"] openai = ["openai", "tiktoken"] opt = ["flax", "jax", "jaxlib", "tensorflow", "keras"] playground = ["jupyter", "notebook", "ipython", "jupytext", "nbformat"] starcoder = ["bitsandbytes"] vllm = ["vllm", "ray"] [tool.cibuildwheel] build-verbosity = 1 # So the following enviuronment will be targeted for compiled wheels: # - Python: CPython 3.8+ only # - Architecture (64-bit only): amd64 / x86_64, universal2, and arm64 # - OS: Linux (no musl), and macOS build = "cp3*-*" skip = ["*-manylinux_i686", "*-musllinux_*", "*-win32", "pp-*"] [tool.cibuildwheel.environment] HATCH_BUILD_HOOKS_ENABLE = "1" MYPYC_DEBUG_LEVEL = "1" MYPYC_OPT_LEVEL = "3" [tool.cibuildwheel.linux] before-build = ["yum install -y clang gcc"] [tool.cibuildwheel.linux.environment] HATCH_BUILD_HOOKS_ENABLE = "1" MYPYC_DEBUG_LEVEL = "1" MYPYC_OPT_LEVEL = "3" # Use clang to compile successfully on Linux. CC = "clang" [tool.towncrier] directory = "changelog.d" filename = "CHANGELOG.md" issue_format = "[#{issue}](https://github.com/bentoml/openllm/issues/{issue})" name = "openllm" start_string = "\n" template = "changelog.d/template.md.jinja" title_format = "" underlines = ["", "", ""] [[tool.towncrier.section]] path = "" [[tool.towncrier.type]] directory = "breaking" name = "Backwards-incompatible Changes" showcontent = true [[tool.towncrier.type]] directory = "deprecation" name = "Deprecations" showcontent = true [[tool.towncrier.type]] directory = "change" name = "Changes" showcontent = true [[tool.towncrier.type]] directory = "feature" name = "Features" showcontent = true [[tool.towncrier.type]] directory = "fix" name = "Bug fix" showcontent = true [tool.interrogate] fail-under = 100 verbose = 2 whitelist-regex = ["test_.*"] [tool.pytest.ini_options] addopts = ["-rfEX", "-pno:warnings", "--snapshot-warn-unused"] python_files = ["test_*.py", "*_test.py"] testpaths = ["tests"] [tool.ruff] extend-exclude = [ "tools", "examples", "src/openllm/playground", "src/openllm/__init__.py", "src/openllm/_types.py", "src/openllm/_version.py", "src/openllm/utils/dummy_*.py", "src/openllm/models/__init__.py", ] extend-include = ["*.ipynb"] extend-select = [ "B", # flake8-bugbear "I", # isort "G", # flake8-logging-format "D", # pydocstyle "W", # pycodestyle "Q", # flake8-quotes "FA", # flake8-future-annotations "S", # flake8-bandit "TCH", # flake8-type-checking "PLW", # pylint-warning "PLR", # pylint-refactor "PT", # flake8-pytest-style "PYI", # flake8-pyi "PERF", # perflint "FLY", # flynt "RUF", # Ruff-specific rules "YTT", # flake8-2020 ] fix = true ignore = [ "B027", # Allow non-abstract empty methods in abstract base classes "FBT003", # Allow boolean positional values in function calls, like `dict.get(... True)` "S105", # Ignore checks for possible passwords "S106", "S107", "S603", # ignore subprocess.call "PLR0911", "PLR0912", "PLR0913", "PLR0915", "PLR2004", # magic value to use constant "E501", # ignore line length violation "E702", "PYI021", # ignore docstring in stubs, as pyright will include docstring in stubs. "D103", # Just missing docstring for magic methods. "D102", "D101", "D100", "TCH004", # don't move runtime import out, just warn about it "RUF012", # mutable attributes to be used with ClassVar "B905", # zip warning about strict, only applicable for 3.10+ "D105", # magic docstring "E701", # multiple statement on single line ] line-length = 119 target-version = "py312" unfixable = [ "F401", # Don't touch unused imports, just warn about it. "TCH004", # Don't touch import outside of TYPE_CHECKING block "RUF100", # unused noqa, just warn about it ] [tool.ruff.flake8-type-checking] exempt-modules = ["typing", "typing_extensions", "."] runtime-evaluated-base-classes = [ "pydantic.BaseModel", "openllm._configuration.LLMConfig", "openllm._configuration.GenerationConfig", "openllm._configuration.ModelSettings", ] runtime-evaluated-decorators = ["attrs.define", "attrs.frozen"] [tool.ruff.pydocstyle] convention = "google" [tool.ruff.pycodestyle] ignore-overlong-task-comments = true [tool.ruff.isort] combine-as-imports = true force-single-line = false force-wrap-aliases = true known-first-party = ["openllm", "bentoml"] known-third-party = ["transformers", "click", "huggingface_hub", "torch", "vllm", "auto_gptq"] lines-after-imports = 1 lines-between-types = 0 no-lines-before = ["future", "standard-library"] relative-imports-order = "closest-to-furthest" required-imports = ["from __future__ import annotations"] [tool.ruff.flake8-quotes] avoid-escape = false [tool.ruff.extend-per-file-ignores] "src/openllm/_service.py" = ["I001", "E401"] "src/openllm/cli/entrypoint.py" = ["D301"] "src/openllm/models/**" = ["I001", "E", "D", "F"] "src/openllm/utils/__init__.py" = ["I001"] "src/openllm/utils/import_utils.py" = ["PLW0603"] "src/openllm_client/runtimes/*" = ["D107"] "tests/**/*" = [ "S101", "TID252", "D", # No docstring in tests "PT011", # ignore too broad raises, as it can be use pytest.raises().match() "S307", # Ignore eval(compile) as it is a known script execution ] "typings/**" = ["D", "F", "E", "PYI002"] [tool.yapf] ALIGN_CLOSING_BRACKET_WITH_VISUAL_INDENT = true ALLOW_MULTILINE_DICTIONARY_KEYS = false ALLOW_MULTILINE_LAMBDAS = false ALLOW_SPLIT_BEFORE_DEFAULT_OR_NAMED_ASSIGNS = false ALLOW_SPLIT_BEFORE_DICT_VALUE = false ARITHMETIC_PRECEDENCE_INDICATION = true BLANK_LINES_AROUND_TOP_LEVEL_DEFINITION = 1 BLANK_LINES_BETWEEN_TOP_LEVEL_IMPORTS_AND_VARIABLES = 1 BLANK_LINE_BEFORE_CLASS_DOCSTRING = false BLANK_LINE_BEFORE_MODULE_DOCSTRING = false BLANK_LINE_BEFORE_NESTED_CLASS_OR_DEF = false COALESCE_BRACKETS = true COLUMN_LIMIT = 768 CONTINUATION_ALIGN_STYLE = "VALIGN-RIGHT" DEDENT_CLOSING_BRACKETS = true DISABLE_ENDING_COMMA_HEURISTIC = true EACH_DICT_ENTRY_ON_SEPARATE_LINE = false INDENT_BLANK_LINES = false INDENT_CLOSING_BRACKETS = false INDENT_WIDTH = 2 JOIN_MULTIPLE_LINES = true NO_SPACES_AROUND_SELECTED_BINARY_OPERATORS = true SPACES_AROUND_SUBSCRIPT_COLON = false SPACE_BETWEEN_ENDING_COMMA_AND_CLOSING_BRACKET = false SPACE_INSIDE_BRACKETS = false SPLIT_ALL_COMMA_SEPARATED_VALUES = false SPLIT_ALL_TOP_LEVEL_COMMA_SEPARATED_VALUES = false SPLIT_ARGUMENTS_WHEN_COMMA_TERMINATED = false SPLIT_BEFORE_BITWISE_OPERATOR = false SPLIT_BEFORE_CLOSING_BRACKET = false SPLIT_BEFORE_DICT_SET_GENERATOR = false SPLIT_BEFORE_DOT = false SPLIT_BEFORE_EXPRESSION_AFTER_OPENING_PAREN = false SPLIT_BEFORE_FIRST_ARGUMENT = false SPLIT_BEFORE_LOGICAL_OPERATOR = false SPLIT_BEFORE_NAMED_ASSIGNS = false SPLIT_COMPLEX_COMPREHENSION = false SPLIT_PENALTY_AFTER_OPENING_BRACKET = 10000 SPLIT_PENALTY_BEFORE_IF_EXPR = 10000 SPLIT_PENALTY_COMPREHENSION = 3000 SPLIT_PENALTY_FOR_ADDED_LINE_SPLIT = 8000 [tool.coverage.paths] openllm = ["src/openllm", "*/openllm/src/openllm"] [tool.coverage.run] branch = true omit = [ "__pypackages__/*", "src/openllm/_version.py", "src/openllm/playground/", "src/openllm/__init__.py", "src/openllm/__main__.py", "src/openllm/utils/dummy_*.py", ] source_pkgs = ["openllm"] [tool.coverage.report] exclude_lines = [ "no cov", "pragma: no cover", "if __name__ == .__main__.:", "if t.TYPE_CHECKING:", "if _t.TYPE_CHECKING:", 'if TYPE_CHECKING:', 'if typing.TYPE_CHECKING:', 'if t.TYPE_CHECKING and not MYPY:', 'if DEBUG:', 'if utils.DEBUG', 'if openllm.utils.DEBUG', '@_overload', '@overload', '@t.overload', '@typing.overload', 'raise NotImplementedError', 'raise NotImplemented', 'except MissingDependencyError:', ] omit = [ "__pypackages__/*", "src/openllm/_version.py", "src/openllm/playground/", "src/openllm/__init__.py", "src/openllm/__main__.py", "src/openllm/utils/dummy_*.py", ] precision = 2 show_missing = true [tool.pyright] analysis.useLibraryCodeForTypes = true exclude = [ "__pypackages__/*", "src/openllm/playground/", "src/openllm/__init__.py", "src/openllm/__main__.py", "src/openllm/utils/dummy_*.py", "src/openllm/models", "tools", "examples", "tests", ] include = ["src/openllm", "src/openllm_client"] pythonVersion = "3.12" reportMissingImports = "warning" reportMissingTypeStubs = false reportPrivateUsage = "warning" reportUnknownArgumentType = "warning" reportUnknownMemberType = "warning" reportUnknownVariableType = "warning" reportUnsupportedDunderAll = "warning" reportWildcardImportFromLibrary = "warning" typeCheckingMode = "strict" [tool.mypy] # TODO: Enable model for strict type checking exclude = ["src/openllm/playground/", "src/openllm/utils/dummy_*.py", "src/openllm/models"] local_partial_types = true modules = ["openllm", "openllm_client"] mypy_path = "typings" pretty = true python_version = "3.11" show_error_codes = true warn_no_return = false warn_return_any = false warn_unreachable = true warn_unused_ignores = false [[tool.mypy.overrides]] ignore_missing_imports = true module = [ "IPython.*", "numpy.*", "tensorflow.*", "torch.*", "optimum.*", "inflection.*", "huggingface_hub.*", "peft.*", "auto_gptq.*", "vllm.*", "orjson.*", "httpx.*", "cloudpickle.*", "circus.*", "grpc_health.*", "transformers.*", "ghapi.*", ] [[tool.mypy.overrides]] ignore_errors = true module = ["openllm.models.*", "openllm._types", "openllm.playground.*"] [tool.hatch.version] fallback-version = "0.0.0" source = "vcs" [tool.hatch.build.hooks.vcs] version-file = "src/openllm/_version.py" [tool.hatch.version.raw-options] git_describe_command = ["git", "describe", "--dirty", "--tags", "--long", "--first-parent"] local_scheme = "no-local-version" [tool.hatch.metadata] allow-direct-references = true [tool.hatch.build.targets.wheel] exclude = ["/src/openllm-node"] only-include = ["src"] sources = ["src"] [tool.hatch.build.targets.sdist] exclude = ["/.github", "/typings", "/examples", "/assets", "/changelog.d", "/tools", ".git"] [tool.hatch.build.targets.wheel.hooks.mypyc] dependencies = [ "hatch-mypyc==0.16.0", "mypy==1.4.1", # avoid https://github.com/pallets/click/issues/2558 "click==8.1.3", "bentoml==1.1.1", "transformers>=4.31.0", "pandas-stubs", "types-psutil", "types-tabulate", "types-PyYAML", "types-protobuf", ] enable-by-default = false exclude = [ # no reason to compile model since framework is already written in C++ "src/openllm/models/**", "src/openllm/bundle/**", "src/openllm/cli/**", "src/openllm/playground/**", "src/openllm/__main__.py", "src/openllm/_types.py", "src/openllm/_llm.py", "src/openllm/_service.py", "src/openllm/_configuration.py", # can't compile serialisation for transformers since it will raise segfault "src/openllm/serialisation/transformers", "src/openllm/utils/analytics.py", ] include = [ "src/openllm/serialisation", "src/openllm/utils/__init__.py", "src/openllm/__init__.py", "src/openllm/_prompt.py", "src/openllm/_schema.py", "src/openllm/_quantisation.py", "src/openllm/_generation.py", "src/openllm/_strategies.py", "src/openllm/client.py", "src/openllm/exceptions.py", "src/openllm/testing.py", ] # NOTE: This is consistent with pyproject.toml mypy-args = [ "--pretty", "--strict", # this is because all transient library doesn't have types "--allow-subclassing-any", "--check-untyped-defs", "--follow-imports=skip", "--python-version=3.11", "--ignore-missing-imports", "--no-warn-return-any", "--warn-unreachable", "--no-warn-no-return", "--no-warn-unused-ignores", "--exclude='/src\\/openllm\\/playground\\/**'", "--exclude='/src\\/openllm\\/_types\\.py$'", ] options = { verbose = true, debug_level = "2", opt_level = "3" } require-runtime-dependencies = true