-
Notifications
You must be signed in to change notification settings - Fork 560
/
pyproject.toml
140 lines (125 loc) · 3.75 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
[build-system]
requires = ["setuptools", "setuptools_scm[toml]"]
build-backend = "setuptools.build_meta"
[project]
name = "cog"
description = "Containers for machine learning"
readme = "README.md"
authors = [{ name = "Replicate", email = "team@replicate.com" }]
license.file = "LICENSE"
urls."Source" = "https://github.com/replicate/cog"
classifiers = [
"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",
]
requires-python = ">=3.8"
dependencies = [
# intentionally loose. perhaps these should be vendored to not collide with user code?
"attrs>=20.1,<24",
"fastapi>=0.75.2,<0.111.0",
"pydantic>=1.9,<3",
"PyYAML",
"requests>=2,<3",
"structlog>=20,<25",
"typing_extensions>=4.4.0",
"uvicorn[standard]>=0.12,<1",
]
dynamic = ["version"]
[project.optional-dependencies]
dev = ["build", "setuptools_scm", "tox", "tox-uv"]
tests = [
"httpx",
"hypothesis",
"numpy",
"pillow",
"pytest",
"pytest-httpserver",
"pytest-timeout",
"pytest-xdist",
"pytest-cov",
"responses",
]
[tool.setuptools_scm]
write_to = "python/cog/_version.py"
[tool.pyright]
# TODO: remove this and bring the codebase inline with the current default
strictParameterNoneValue = false
# legacy behavior, fixed in PEP688
disableBytesTypePromotions = true
include = ["python"]
exclude = ["python/tests"]
reportMissingParameterType = "error"
reportUnknownLambdaType = "error"
reportUnnecessaryIsInstance = "warning"
reportUnnecessaryComparison = "warning"
reportUnneesssaryContains = "warning"
reportMissingTypeArgument = "error"
reportUnusedExpression = "warning"
[tool.pyright.defineConstant]
PYDANTIC_V2 = true
[tool.setuptools]
include-package-data = false
[tool.setuptools.packages.find]
where = ["python"]
include = ["cog*"]
exclude = ["tests*"]
[tool.pylint.main]
disable = [
"C0114", # Missing module docstring
"C0115", # Missing class docstring
"C0116", # Missing function or method docstring
"C0301", # Line too long
"C0413", # Import should be placed at the top of the module
"R0903", # Too few public methods
"W0622", # Redefining built-in
]
good-names = ["id", "input"]
ignore-paths = ["python/cog/_version.py", "python/tests"]
[tool.ruff]
format.exclude = ["python/cog/_version.py"]
lint.select = [
"E", # pycodestyle error
"F", # Pyflakes
"I", # isort
"W", # pycodestyle warning
"S", # flake8-bandit
"B", # flake8-bugbear
"ANN", # flake8-annotations
]
lint.ignore = [
"E501", # Line too long
"S101", # Use of `assert` detected"
"S113", # Probable use of requests call without timeout
"B008", # Do not perform function call in argument defaults
"ANN001", # Missing type annotation for function argument
"ANN002", # Missing type annotation for `*args`
"ANN003", # Missing type annotation for `**kwargs`
"ANN101", # Missing type annotation for self in method
"ANN102", # Missing type annotation for cls in classmethod
"ANN401", # Dynamically typed expressions are disallowed
]
extend-exclude = [
"python/tests/server/fixtures/*",
"test-integration/test_integration/fixtures/*",
]
src = ["python"]
[tool.ruff.lint.per-file-ignores]
"python/cog/server/http.py" = [
"S104", # Possible binding to all interfaces
]
"python/tests/*" = [
"S101", # Use of assert
"S104", # Possible binding to all interfaces
"S301", # pickle can be unsafe when used to deserialize untrusted data
"ANN",
]
"test-integration/*" = [
"S101", # Use of assert
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
"S603", # subprocess call - check for execution of untrusted input
"S607", # Starting a process with a partial executable path"
"ANN",
]