Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
138 lines (117 loc) · 3.68 KB
/
Copy pathpyproject.toml
File metadata and controls
138 lines (117 loc) · 3.68 KB
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
[project]
name = "experimental"
version = "0.1.0"
description = "Monorepo"
readme = "README.org"
requires-python = ">=3.11"
authors = [{ name = "Jaehyun Yeom", email = "jae.yeom@gmail.com" }]
dependencies = [
"grpcio",
"protobuf",
"protovalidate",
]
[dependency-groups]
dev = [
"mypy",
"pytest",
# Semgrep dropped macOS x86_64 wheels in 1.83.0.
"semgrep; sys_platform != 'darwin' or platform_machine != 'x86_64'",
]
[tool.uv]
package = false
exclude-newer = "7 days"
# Override semgrep's overly tight upper pins to resolve Dependabot alerts
# (mcp, opentelemetry-api, wcmatch) until semgrep updates its pins past the
# exclude-newer cooldown.
override-dependencies = [
"mcp>=1.30.0,<2",
"wcmatch>=11.2,<13",
"opentelemetry-api>=1.45.2,<2",
"opentelemetry-sdk>=1.45.2,<2",
"opentelemetry-exporter-otlp-proto-http>=1.45.2,<2",
"opentelemetry-instrumentation-requests>=0.66b2,<0.67",
"opentelemetry-instrumentation-threading>=0.66b2,<0.67",
]
[tool.ruff]
extend-exclude = [
"*_pb2.py", # Generated protobuf
"*_pb2_grpc.py", # Generated gRPC
"bazel-*", # Bazel
]
# PEP 8 recommends line-length 79
line-length = 79
indent-width = 4
fix = true
[tool.ruff.lint]
extend-select = ["UP", "D"]
ignore = []
# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[tool.ruff.lint.isort]
# gen/ holds buf-generated protobuf modules imported as a local package
# (e.g. codelab/proto/gen). It is not reachable from `src`, so isort would
# otherwise sort it into the third-party block.
known-first-party = ["gen"]
[tool.ruff.format]
# Like Black, use double quotes for strings.
quote-style = "preserve"
# Like Black, indent with spaces, rather than tabs.
indent-style = "space"
# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false
# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"
# Enable auto-formatting of code examples in docstrings. Markdown,
# reStructuredText code/literal blocks and doctests are all supported.
docstring-code-format = true
# Set the line length limit used when formatting code snippets in
# docstrings.
docstring-code-line-length = "dynamic"
[tool.ruff.lint.pydocstyle]
# My default choice is Google style because the docstring is concise yet
# visually easy to understand.
convention = "google"
[tool.mypy]
python_version = "3.11"
strict = true
mypy_path = "codelab/proto:devtools/linters/pylinters/src"
files = [
"codelab/proto/client.py",
"codelab/proto/server.py",
"codelab/proto/client_test.py",
"codelab/proto/server_test.py",
"scripts/strip_pr_html_comments.py",
"scripts/strip_pr_html_comments_test.py",
"devtools/linters/pylinters/src/pylinters",
"devtools/linters/pylinters/tests",
"tools/lint/bazel_go_files_test.py",
"tools/lint/gitleaks_test.py",
"tools/lint/mypy_test.py",
"tools/lint/semgrep_files_test.py",
"tools/lint/semgrep_test.py",
"tools/lint/uv_lock_test.py",
]
exclude = [
"(^|/)gen/",
".*_pb2\\.py$",
".*_pb2_grpc\\.py$",
"^bazel-",
]
# Generated pb2/gRPC base classes and grpcio lack full type stubs.
disallow_subclassing_any = false
[[tool.mypy.overrides]]
module = ["gen", "gen.*"]
follow_imports = "skip"
[[tool.mypy.overrides]]
module = ["grpc", "grpc.*"]
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = ["ruamel", "ruamel.*"]
ignore_missing_imports = true
[tool.pylinters.main-guard]
# Every py_test here runs as __main__ under Bazel, so its file must end
# with a runner that propagates the exit code.
require-test-runner = true