Mirrored from GitHub
github.com/roostorg/osprey
9.0 kB
325 lines
1[build-system]
2requires = ["uv_build>=0.8.12,<0.9.0"]
3build-backend = "uv_build"
4
5[dependency-groups]
6common = [
7 "blinker==1.9.0",
8 "click==7.1.2",
9 "datadog==0.51.0",
10 "ddtrace==2.21.11",
11 "deepmerge==0.3.0",
12 "dnspython==2.6.1",
13 "erlpack",
14 "faker==4.18.0",
15 "flask==1.1.4",
16 "gevent==24.2.1",
17 "google-api-core==2.19.2",
18 "google-api-python-client==2.105.0",
19 "google-auth==2.40.3",
20 "google-auth-httplib2==0.4.0",
21 "google-cloud-appengine-logging==1.6.2",
22 "google-cloud-audit-log==0.3.2",
23 "google-cloud-bigquery==3.27.0",
24 "google-cloud-bigtable==2.10.0",
25 "google-cloud-core==2.6.0",
26 "google-cloud-kms==3.5.1",
27 "google-cloud-logging==3.4.0",
28 "google-cloud-pubsub==2.15.2",
29 "google-cloud-secret-manager==2.24.0",
30 "google-cloud-storage==2.10.0",
31 "google-resumable-media==2.7.2",
32 "googleapis-common-protos==1.70.0",
33 "graphviz==0.20",
34 "greenlet",
35 "grpc-google-iam-v1==0.14.2",
36 "grpcio==1.49.1; platform_machine == 'x86_64'",
37 "grpcio==1.53.*; platform_machine != 'x86_64'",
38 "grpcio-health-checking==1.44.0",
39 "grpcio-reflection==1.44.0",
40 "grpcio-status==1.49.1; platform_machine == 'x86_64'",
41 "grpcio-status==1.53.*; platform_machine != 'x86_64'",
42 "grpcio-tools==1.49.1; platform_machine == 'x86_64'",
43 "grpcio-tools==1.53.*; platform_machine != 'x86_64'",
44 "gunicorn",
45 "intervals==0.9.2",
46 "jslog4kube==1.0.6",
47 "jsonpath-rw",
48 "kafka-python==1.4.7",
49 # Flask 1.1.4 / Jinja2 2.11 import `markupsafe.soft_unicode`, which was removed in
50 # markupsafe 2.1.0. Pin to <2.1 until the Flask 1.x stack is upgraded.
51 "markupsafe<2.1",
52 "minio>=7.2.16",
53 "mmh3==3.0.0",
54 "msgpack==1.0.8",
55 "nostril",
56 "phone-iso3166==0.3.8",
57 "pluggy==1.5.0",
58 "protobuf==4.25.8",
59 "psycogreen==1.0.2",
60 "psycopg2-binary==2.9.10",
61 "pycryptodome==3.21.0",
62 "pydantic==1.10.26",
63 "pydruid==0.6.9",
64 "pytest==9.0.3",
65 "pytest-mock==3.14.1",
66 "python-dateutil==2.8.0",
67 "python-json-logger==0.1.10",
68 "pytz==2022.1",
69 "pyyaml==6.0.1",
70 "rapidfuzz==3.14.5",
71 "requests==2.33.0",
72 "result==0.5.0",
73 "sentry-sdk==1.45.1",
74 "simplejson==3.20.2",
75 "six==1.16.0",
76 "sqlalchemy==1.4.54",
77 "sqlalchemy-utils==0.41.1",
78 "tenacity==8.1.0",
79 "tink==1.9.0",
80 "tld==0.12.7",
81 "traitlets==5.14.3",
82 "typing-extensions==4.6.3",
83 "typing-inspect==0.9.0",
84 "unidecode==1.3.8",
85 "werkzeug==1.0.1",
86 # --- Type stubs (used by mypy, not imported directly) ---
87 "types-cachetools==6.1.0.20250717",
88 "types-click==7.1.8",
89 "types-flask==1.1.6",
90 "types-ipaddress==1.0.8",
91 "types-jinja2==2.11.9",
92 "types-markupsafe==1.1.10",
93 "types-maxminddb==1.5.0",
94 "types-protobuf==4.24.0.1",
95 "types-psycopg2>=2.9.21.20250809",
96 "types-python-dateutil==2.9.0.20250708",
97 "types-pytz==2025.2.0.20250516",
98 "types-pyyaml==6.0.12.20250516",
99 "types-requests==2.27.7",
100 "types-simplejson==3.20.0.20250326",
101 "types-six==1.17.0.20250515",
102 "types-urllib3==1.26.25.14",
103 "types-werkzeug==1.0.9",
104]
105dev = [
106 "ipdb==0.13.13",
107 "ipython==9.4.0",
108 "memray==1.19.2",
109 "mypy>=1.13.0",
110 "mypy-extensions==1.0.0",
111 "mypy-protobuf==3.6.0",
112 "pre-commit>=4.3.0",
113 "pytest-flask==1.3.0",
114 "pytest-order==1.3.0",
115 "requests-mock==1.12.1",
116 "ruff>=0.12.9",
117 "setuptools==80.9.0",
118 "sqlalchemy[mypy]>=1.4.31",
119 "sqlalchemy2-stubs==0.0.2a38",
120 "types-flask-cors>=3.0.10",
121]
122
123
124[tool.uv]
125override-dependencies = ["ddtrace>=2.17.2,<3.0.0"]
126default-groups = ["common", "dev"]
127
128[tool.uv.sources]
129erlpack = { git = "https://github.com/discord/erlpack.git", rev = "b25ebd51ae4c097bd7f756fd4e1c841b61bfe50b" }
130greenlet = { git = "https://github.com/discord/greenlet.git", rev = "a75d78f1547c74a81134644a179467525a255466" }
131gunicorn = { git = "https://github.com/discord/gunicorn.git", rev = "979efdcb918daa536d8923668241c6e6bf1edb58" }
132jsonpath-rw = { url = "https://github.com/kennknowles/python-jsonpath-rw/archive/6f5647bb3ad2395c20f0191fef07a1df51c9fed8.tar.gz" }
133nostril = { url = "https://github.com/casics/nostril/archive/v1.2.0.tar.gz" }
134osprey_rpc = { workspace = true }
135osprey_worker = { workspace = true }
136example_plugins = { workspace = true }
137
138[tool.uv.workspace]
139members = [
140 "osprey_rpc",
141 "osprey_worker",
142 "example_plugins",
143]
144
145
146[tool.ruff]
147target-version = "py311"
148line-length = 120
149fix = true
150force-exclude = true # Needed for pre-commit to work on staged files
151extend-exclude = [
152 # Exclude protobuf generated files
153 "**/*_pb2*.py",
154 "**/*_pb2*.pyi",
155]
156
157[tool.ruff.format]
158quote-style = "single"
159indent-style = "space"
160skip-magic-trailing-comma = false
161line-ending = "auto"
162
163[tool.ruff.lint]
164select = [
165 "E", # pycodestyle errors
166 "F", # pyflakes (includes F401 unused imports)
167 "I", # isort
168 "B006", # flake8-bugbear, B006 catches mutable defaults
169]
170ignore = [
171 "E501", # Formatter already does a best effort of handling line-length, but some lines just can't be shortened anymore
172]
173
174[tool.ruff.lint.isort]
175known-first-party = ["osprey_worker", "osprey_rpc", "example_plugins"]
176
177[tool.fawltydeps]
178code = ["osprey_worker/src", "osprey_rpc/src", "example_plugins/src"]
179deps = ["pyproject.toml"]
180ignore_unused = [
181 # Type stubs: used by mypy, never imported directly
182 "types-cachetools",
183 "types-click",
184 "types-flask",
185 "types-flask-cors",
186 "types-ipaddress",
187 "types-jinja2",
188 "types-markupsafe",
189 "types-maxminddb",
190 "types-protobuf",
191 "types-psycopg2",
192 "types-python-dateutil",
193 "types-pytz",
194 "types-pyyaml",
195 "types-requests",
196 "types-simplejson",
197 "types-six",
198 "types-urllib3",
199 "types-werkzeug",
200 "sqlalchemy2-stubs",
201 # Dev CLI tools: run as commands, not imported
202 "grpcio-tools",
203 "ipdb",
204 "ipython",
205 "memray",
206 "mypy",
207 "mypy-extensions",
208 "mypy-protobuf",
209 "pre-commit",
210 "pytest-flask",
211 "pytest-order",
212 "requests-mock",
213 "ruff",
214 "setuptools",
215 # Runtime CLI: started via command line, not imported in source
216 "gunicorn",
217 # Gunicorn logger class: loaded via --logger-class flag, not imported in source
218 "jslog4kube",
219 # Optional runtime dep of sentry-sdk for FlaskIntegration
220 "blinker",
221 # Transitive of Flask 1.x / Jinja2 2.11; pinned <2.1 here so soft_unicode
222 # is still exported. Not imported by our source directly.
223 "markupsafe",
224 # gRPC server extensions: registered at startup, not imported directly
225 "grpcio-health-checking",
226 "grpcio-reflection",
227 "grpcio-status",
228 # Needs investigation: may be unused, verify before removing
229 "erlpack",
230 "google-api-python-client",
231 "google-auth-httplib2",
232 "nostril",
233]
234
235[tool.pytest.ini_options]
236testpaths = ["osprey_worker"]
237
238[tool.mypy]
239plugins = ["pydantic.mypy", "sqlalchemy.ext.mypy.plugin"]
240python_version = "3.11"
241namespace_packages = true
242explicit_package_bases = true
243disable_error_code = ["annotation-unchecked"]
244
245mypy_path = [
246 "osprey_rpc/src",
247 "osprey_worker/src",
248 "example_plugins/src",
249]
250
251# Strict mode includes the following flags. When these are all True, they can be replaced with strict mode.
252# Mostly disabled to match old config
253warn_unused_configs = true
254disallow_any_generics = true
255disallow_subclassing_any = true
256disallow_untyped_calls = false
257disallow_untyped_defs = false
258disallow_incomplete_defs = false
259check_untyped_defs = false
260disallow_untyped_decorators = false
261warn_redundant_casts = true
262warn_return_any = false
263no_implicit_reexport = false
264strict_equality = false
265
266# Additional checks we want to turn on eventually (disabled for now)
267disallow_any_unimported = false
268disallow_any_expr = false
269disallow_any_decorated = false
270disallow_any_explicit = false
271warn_unreachable = false
272
273exclude = [
274 "^.*/venv/.*$",
275 ".*/setup\\.py$",
276 ".*_pb2\\.py$",
277 ".*_pb2\\.pyi$",
278 ".*_pb2_grpc\\.py$",
279 ".*/tests/.*",
280 ".*/test_.*\\.py$",
281]
282
283# required until pydantic explicitly exports Extra
284[[tool.mypy.overrides]]
285module = "pydantic.main"
286implicit_reexport = true
287
288[[tool.mypy.overrides]]
289module = ["jsonpath_rw", "minio.*"]
290ignore_missing_imports = true
291
292# third party packages we don't care about
293[[tool.mypy.overrides]]
294module = [
295 "stubs.*",
296 "google.*",
297 "perf_tools.*",
298 "gevent.*",
299 "grpc.*",
300 "pydruid.*",
301 "phone_iso3166.*",
302 "typing_inspect.*",
303 "tink.*",
304 "sqlalchemy_utils.*",
305 "graphviz.*",
306 "psycogreen.*",
307 "deepmerge.*",
308 "greenlet.*",
309 "kafka.*",
310 "pythonjsonlogger.*",
311 "msgpack.*",
312 "jose.*",
313]
314ignore_errors = true
315disable_error_code = ["annotation-unchecked", "import-untyped"]
316ignore_missing_imports = true
317# At least for now, ignore tests.
318# TODO: Remove these exclusions once they're fixed
319[[tool.mypy.overrides]]
320module = "osprey.worker.*.tests.*"
321ignore_errors = true
322
323[[tool.mypy.overrides]]
324module = ["osprey.rpc.*"]
325ignore_errors = true