forked from mongodb/mongo-python-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyproject.toml
247 lines (225 loc) · 8.29 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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
[build-system]
requires = ["hatchling>1.24","setuptools>=65.0","hatch-requirements-txt>=0.4.1"]
build-backend = "hatchling.build"
[project]
name = "pymongo"
dynamic = ["version", "dependencies", "optional-dependencies"]
description = "Python driver for MongoDB <http://www.mongodb.org>"
readme = "README.md"
license = {file="LICENSE"}
requires-python = ">=3.8"
authors = [
{ name = "The MongoDB Python Team" },
]
keywords = [
"bson",
"gridfs",
"mongo",
"mongodb",
"pymongo",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"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 :: 3.13",
"Topic :: Database",
"Typing :: Typed",
]
[project.urls]
Homepage = "https://www.mongodb.org"
Documentation = "https://www.mongodb.com/docs/languages/python/pymongo-driver/current/"
Source = "https://github.com/mongodb/mongo-python-driver"
Tracker = "https://jira.mongodb.org/projects/PYTHON/issues"
# Used to call hatch_build.py
[tool.hatch.build.hooks.custom]
[tool.hatch.version]
path = "pymongo/_version.py"
validate-bump = false
[tool.hatch.build.targets.wheel]
packages = ["bson","gridfs", "pymongo"]
[tool.hatch.metadata.hooks.requirements_txt]
files = ["requirements.txt"]
[tool.hatch.metadata.hooks.requirements_txt.optional-dependencies]
aws = ["requirements/aws.txt"]
docs = ["requirements/docs.txt"]
encryption = ["requirements/encryption.txt"]
gssapi = ["requirements/gssapi.txt"]
ocsp = ["requirements/ocsp.txt"]
snappy = ["requirements/snappy.txt"]
test = ["requirements/test.txt"]
zstd = ["requirements/zstd.txt"]
[tool.pytest.ini_options]
minversion = "7"
addopts = ["-ra", "--strict-config", "--strict-markers", "--junitxml=xunit-results/TEST-results.xml", "-m default or default_async"]
testpaths = ["test"]
log_cli_level = "INFO"
faulthandler_timeout = 1500
asyncio_default_fixture_loop_scope = "session"
xfail_strict = true
filterwarnings = [
"error",
# Internal warnings raised during tests.
"module:use an explicit session with no_cursor_timeout=True:UserWarning",
"module:serverselectiontimeoutms must be:UserWarning",
"module:Unsupported compressor:UserWarning",
"module:zlibcompressionlevel must be:UserWarning",
"module:Wire protocol compression with:UserWarning",
"module:GridIn property:DeprecationWarning",
"module:GridOut property:DeprecationWarning",
# TODO: Remove as part of PYTHON-3923.
"module:unclosed <eventlet.green.ssl.GreenSSLSocket:ResourceWarning",
"module:unclosed <socket.socket:ResourceWarning",
"module:unclosed <ssl.SSLSocket:ResourceWarning",
"module:unclosed <socket object:ResourceWarning",
# https://github.com/eventlet/eventlet/issues/818
"module:please use dns.resolver.Resolver.resolve:DeprecationWarning",
# https://github.com/dateutil/dateutil/issues/1314
"module:datetime.datetime.utc:DeprecationWarning:dateutil",
]
markers = [
"auth_aws: tests that rely on pymongo-auth-aws",
"auth_oidc: tests that rely on oidc auth",
"ocsp: tests that rely on ocsp",
"atlas: tests that rely on atlas",
"data_lake: tests that rely on atlas data lake",
"perf: benchmark tests",
"index_management: index management tests",
"csfle: client-side field-level encryption tests",
"encryption: encryption tests",
"load_balancer: load balancer tests",
"mockupdb: tests that rely on mockupdb",
"default: default test suite",
"default_async: default async test suite",
]
[tool.mypy]
strict = true
show_error_codes = true
pretty = true
disable_error_code = ["type-arg", "no-any-return"]
[[tool.mypy.overrides]]
module = ["test.*"]
disable_error_code = ["no-untyped-def", "no-untyped-call"]
[[tool.mypy.overrides]]
module = ["service_identity.*"]
ignore_missing_imports = true
[[tool.mypy.overrides]]
module = ["pymongo.synchronous.*"]
warn_unused_ignores = false
disable_error_code = ["unused-coroutine"]
[[tool.mypy.overrides]]
module = ["pymongo.asynchronous.*"]
warn_unused_ignores = false
[[tool.mypy.overrides]]
module = ["gridfs.synchronous.*"]
warn_unused_ignores = false
disable_error_code = ["unused-coroutine", "no-redef"]
[tool.ruff]
target-version = "py37"
line-length = 100
[tool.ruff.lint]
select = [
"E", "F", "W", # flake8
"B", # flake8-bugbear
"I", # isort
"ARG", # flake8-unused-arguments
"C4", # flake8-comprehensions
"EM", # flake8-errmsg
"ICN", # flake8-import-conventions
"G", # flake8-logging-format
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PL", # pylint
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
"RET", # flake8-return
"RUF", # Ruff-specific
"S", # flake8-bandit
"SIM", # flake8-simplify
"T20", # flake8-print
"UP", # pyupgrade
"YTT", # flake8-2020
"EXE", # flake8-executable
"ASYNC", # flake8-async
]
ignore = [
"PLR", # Design related pylint codes
"E501", # Line too long
"PT004", # Use underscore for non-returning fixture (use usefixture instead)
"UP007", # Use `X | Y` for type annotation
"EM101", # Exception must not use a string literal, assign to variable first
"EM102", # Exception must not use an f-string literal, assign to variable first
"G004", # Logging statement uses f-string"
"UP006", # Use `type` instead of `Type` for type annotation"
"RET505", # Unnecessary `elif` after `return` statement"
"RET506", # Unnecessary `elif` after `raise` statement
"SIM108", # Use ternary operator"
"PTH123", # `open()` should be replaced by `Path.open()`"
"SIM102", # Use a single `if` statement instead of nested `if` statements
"SIM105", # Use `contextlib.suppress(OSError)` instead of `try`-`except`-`pass`
"ARG002", # Unused method argument:
"S101", # Use of `assert` detected
"SIM114", # Combine `if` branches using logical `or` operator
"PGH003", # Use specific rule codes when ignoring type issues
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
"EM103", # Exception must not use a `.format()` string directly, assign to variable first
"C408", # Unnecessary `dict` call (rewrite as a literal)
"SIM117", # Use a single `with` statement with multiple contexts instead of nested `with` statements
]
unfixable = [
"RUF100", # Unused noqa
"T20", # Removes print statements
"F841", # Removes unused variables
]
exclude = []
flake8-unused-arguments.ignore-variadic-names = true
isort.required-imports = ["from __future__ import annotations"]
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?)|dummy.*)$"
[tool.ruff.lint.per-file-ignores]
"pymongo/__init__.py" = ["E402"]
"test/*.py" = ["PT", "E402", "PLW", "SIM", "E741", "PTH", "S", "B904", "E722", "T201",
"RET", "ARG", "F405", "B028", "PGH001", "B018", "F403", "RUF015", "E731", "B007",
"UP031", "F401", "B023", "F811"]
"tools/*.py" = ["T201"]
"green_framework_test.py" = ["T201"]
"hatch_build.py" = ["S"]
[tool.coverage.run]
branch = true
source = ["pymongo", "bson", "gridfs" ]
relative_files = true
[tool.coverage.report]
exclude_lines = [
"if (.*and +)*_use_c( and.*)*:",
"def has_c",
"def get_version_string",
"^except AttributeError:",
"except ImportError:",
"raise NotImplementedError",
"return NotImplemented",
"_use_c = true",
"if __name__ == '__main__':",
"if TYPE_CHECKING:"
]
partial_branches = ["if (.*and +)*not _use_c( and.*)*:"]
[tool.coverage.html]
directory = "htmlcov"
[tool.cibuildwheel]
skip = "pp* *-musllinux*"
build-frontend = "build"
test-command = "python {project}/tools/fail_if_no_c.py"
[tool.cibuildwheel.linux]
archs = "x86_64 aarch64 ppc64le s390x i686"
[tool.cibuildwheel.macos]
archs = "x86_64 arm64"