-
Notifications
You must be signed in to change notification settings - Fork 75
/
Copy pathpyproject.toml
224 lines (207 loc) · 8.24 KB
/
pyproject.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
[tool.poetry]
name = "truss"
version = "0.9.59.rc0"
description = "A seamless bridge from model development to model delivery"
license = "MIT"
readme = "README.md"
authors = ["Pankaj Gupta <[email protected]>", "Phil Howes <[email protected]>"]
include = ["*.txt", "*.Dockerfile", "*.md"]
repository = "https://github.com/basetenlabs/truss"
keywords = [
"MLOps",
"AI",
"Model Serving",
"Model Deployment",
"Machine Learning",
]
packages = [
{ include = "truss", from = "." },
{ include = "truss_chains", from = "./truss-chains" },
]
requires-poetry = ">=2.0"
[tool.poetry.scripts]
truss = "truss.cli.cli:truss_cli"
[tool.poetry.urls]
"Homepage" = "https://truss.baseten.co"
"Bug Reports" = "https://github.com/basetenlabs/truss/issues"
"Documentation" = "https://truss.baseten.co"
"Baseten" = "https://baseten.co"
# Note: *why* are dependencies and defined like this?
# The goal is to factorize the overall truss package into a light-weight `base` part that includes
# e.g. the Truss config and has no heavy dependencies. Other functionalities are organzied into
# components (or "extras") sub-packages, that can be selectively installed (and heavy dependencies
# are only installed as needed).
#
# These sub-packages should have clear separation of concerns, and it should be carefully designed
# how they depend on and import each other (e.g. `base` must not depend on anything else, the
# server does not need local CLI tools).
#
# We want components to be selectable via pip installs (e.g. `pip install truss[server]`).
# Unfortunately poetry dependency groups don't integrate natively with the "extras" concept:
# Specifically, dependencies listed in groups (other than the implicit main group) cannot be used
# for extras.
#
# This leaves us with the following process:
#
# * Use poetry groups only for dev dependencies. These are never included in pip. For dev envs
# use the following installation command `poetry install --with=dev,dev-server --extras=all`.
# * All other dependencies are in the main group `tool.poetry.dependencies`. Base dependencies are
# at the top and non-optional.
# * Dependencies from other compoents are listed after, and marked with `optional = false`. If a
# dependency is needed by mutlipe extras, only add it once, but see next step. This also ensures
# that poetry resolves *all* dependencies from all extras to be globally consistent.
# * Since poetry groups don't work with extras, we need to make the association between a dependency
# and the componnent(s) in which it is used in a different way. Because it's cumbersome to fill
# in `tool.poetry.extras` manually, we automate this process and only define
# `tool.dependency_metadata` where we map for each extra dependency to one or multiple components
# that need it.
# * As a pre-commit step `pyproject_toml_linter.py` populates `tool.poetry.extras` groups and also
# creates an "all"-extras.
#
# TODO: The full factorization is WIP, so far only `base` has been cleanly factored out.
# All other dependencies are lumped together in "other". Customers should install truss
# as `pip install truss[local]`, so we temporarily fill local with all deps, until it is properly
# isolated.
[tool.poetry.dependencies]
# "base" dependencies.
# "When using chains, 3.9 will be required at runtime, but other truss functionality works with 3.8.
python = ">=3.8,<3.13"
huggingface_hub = ">=0.25.0"
pydantic = ">=1.10.0" # We cannot upgrade to v2, due to customer constraints.
PyYAML = ">=6.0"
single-source = "^0.3.0"
# "non-base" dependencies.
# TODO: until we have resolved the question on how users can install the local tools frictionless
# (extras cannot be marked to be included by default), all below packages are non-optional.
# This also means that so far extras defined in `[tool.poetry.extras]` don't have any meaning,
# since everything is globally included anyway.
Jinja2 = { version = "^3.1.2", optional = false }
aiofiles = { version = "^24.1.0", optional = false }
aiohttp = { version = "^3.10.10", optional = false }
blake3 = { version = "^0.3.3", optional = false }
boto3 = { version = "^1.34.85", optional = false }
click = { version = "^8.0.3", optional = false }
fastapi = { version =">=0.109.1", optional = false }
google-cloud-storage = { version = "2.10.0", optional = false }
httpx = { version = ">=0.24.1", optional = false }
inquirerpy = { version = "^0.3.4", optional = false }
libcst = { version = "<1.2.0", optional = false }
loguru = { version = ">=0.7.2", optional = false }
packaging = { version = ">=20.9", optional = false }
pathspec = { version = ">=0.9.0", optional = false }
psutil = { version = ">=5.9.4", optional = false }
python-json-logger = { version = ">=2.0.2", optional = false }
python-on-whales = { version = "^0.68.0", optional = false }
requests = { version = ">=2.31", optional = false }
rich = { version = "^13.4.2", optional = false }
rich-click = { version = "^1.6.1", optional = false }
ruff = { version = ">=0.4.8", optional = false } # Not a dev dep, needed for chains code gen.
tenacity = { version = "^8.0.1", optional = false }
watchfiles = { version = "^0.19.0", optional = false }
[tool.dependency_metadata]
# `base` / `main` deps which are non-optional are always included and don't need to be added here.
Jinja2 = { components = "other" }
aiofiles = { components = "other" }
aiohttp = { components = "other" }
blake3 = { components = "other" }
boto3 = { components = "other" }
click = { components = "other" }
google-cloud-storage = { components = "other" }
httpx = { components = "other" }
inquirerpy = { components = "other" }
libcst = { components = "other" }
loguru = { components = "other" }
packaging = { components = "other" }
pathspec = { components = "other" }
psutil = { components = "other" }
python-json-logger = { components = "other" }
python-on-whales = { components = "other" }
requests = { components = "other" }
rich = { components = "other" }
rich-click = { components = "other" }
ruff = { components = "other" }
tenacity = { components = "other" }
watchfiles = { components = "other" }
[tool.poetry.group.dev.dependencies]
# These packages are needed as the dev/testing tooling
ruff = "^0.9.0" # pinning ruff to a higher version for development
coverage = "^6.4.1"
httpx = { extras = ["cli"], version = "*" }
ipdb = "^0.13.9"
ipykernel = "^6.16.0"
ipython = "^7.16"
mypy = "^1.0.0"
nbconvert = "^7.2.1"
pre-commit = "^2.18.1"
pytest = "7.2.0"
pytest-asyncio = "^0.23.6"
pytest-check = "^2.4.1"
pytest-cov = "^3.0.0"
pytest-split = "^0.8.1"
requests-mock = ">=1.11.0"
tomlkit = ">=0.12"
types-PyYAML = "^6.0.12.12"
types-aiofiles = ">=24.1.0"
types-requests = "==2.31.0.2"
types-setuptools = "^69.0.0.0"
[tool.poetry.group.dev-server.dependencies]
# These packages are needed to run local tests of server components. Note that the actual
# server deps for building the docker image are (so far) defined in `requirements.txt`-files.
dockerfile = "^3.2.0"
fastapi =">=0.109.1"
flask = "^2.3.3"
msgpack = ">=1.0.2"
msgpack-numpy = ">=0.4.8"
numpy = ">=1.23.5"
opentelemetry-api = ">=1.25.0"
opentelemetry-exporter-otlp = ">=1.25.0"
opentelemetry-sdk = ">=1.25.0"
uvicorn = ">=0.24.0"
uvloop = ">=0.17.0"
[build-system]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core>=1.2.1"]
[tool.mypy]
ignore_missing_imports = true
python_version = "3.8"
plugins = ["pydantic.mypy"]
[tool.pytest.ini_options]
markers = [
"integration: marks tests as integration (deselect with '-m \"not integration\"').",
"asyncio: marks tests as async.",
]
addopts = "--ignore=smoketests"
[tool.ruff]
src = ["truss", "truss-chains", "truss-utils"]
target-version = "py38"
line-length = 88
lint.extend-select = [
"I", # isort
]
lint.ignore = [
"E402", # module-import-not-at-top
]
[tool.ruff.lint.isort]
# Matches the Google Python Style Guide.
section-order = [
"future",
"standard-library",
"third-party",
"first-party",
"local-folder",
]
[tool.ruff.lint.extend-per-file-ignores]
"**tests/samples.py" = [
"I", # isort
"F", # flake8
]
"config.py" = [
"I", # isort
"F", # flake8
]
[tool.ruff.lint.pycodestyle]
# The formatter can go sometimes go over the 88-character limit, so we want to provide some buffer.
max-line-length = 120
# Note: `tool.poetry.extras` was autogenerated by `pyproject_toml_linter.py`, do not edit manually.
[tool.poetry.extras]
all = []