Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
411 lines (358 loc) · 11.1 KB
/
Copy pathpyproject.toml
File metadata and controls
411 lines (358 loc) · 11.1 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
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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
[build-system]
requires = ["setuptools>=77.0.0", "setuptools-scm"]
build-backend = "setuptools.build_meta"
[tool.setuptools_scm]
version_scheme = "no-guess-dev" # Don't try to guess next version
local_scheme = "no-local-version"
# Ignore uncommitted changes
git_describe_command = "git describe --tags --match 'v[0-9]*.[0-9]*.[0-9]*'"
write_to = "mailjet_rest/_version.py"
write_to_template = '__version__ = "{version}"'
#fallback_version = "X.Y.ZrcN.postN.devN" # Explicit fallback
[tool.setuptools]
py-modules = ["mailjet_rest._version"]
[tool.setuptools.packages.find]
include = ["mailjet_rest", "mailjet_rest.*"]
exclude = ["tests*"]
[tool.setuptools.package-data]
mailjet_rest = ["py.typed"]
[project]
name = "mailjet-rest"
dynamic = ["version"]
description = "Mailjet V3 API wrapper"
authors = [
{ name = "starenka", email = "starenka0@gmail.com" },
{ name = "Mailjet", email = "api@mailjet.com" },
]
maintainers = [
{name = "Serhii Kupriienko", email = "kupriienko.serhii@gmail.com"}
]
license = "MIT"
license-files = ["LICENSE"]
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
"requests>=2.33.0",
"typing-extensions>=4.7.1; python_version < '3.12'",
]
keywords = [
"Mailjet API v3 / v3.1 Python Wrapper",
"wrapper",
"email python-wrapper",
"transactional-emails",
"mailjet",
"mailjet-api",
]
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Console",
"Intended Audience :: Developers",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Communications :: Email",
"Topic :: Utilities",
]
[project.urls]
"Homepage" = "https://dev.mailjet.com"
"Documentation" = "https://dev.mailjet.com"
"Repository" = "https://github.com/mailjet/mailjet-apiv3-python"
"Issue Tracker" = "https://github.com/mailjet/mailjet-apiv3-python/issues"
[project.optional-dependencies]
linting = [
"bandit",
"mypy",
"pre-commit",
"pyright",
"python-dotenv>=1.2.2",
"ruff",
"slotscheck",
"types-requests",
"vulture",
]
tests = [
"coverage>=4.5.4",
"hypothesis",
"pyfakefs",
"pytest-cov",
"pytest-xdist",
"pytest>=9.0.3",
"responses",
]
# llvm is required
fuzzing = ["atheris"]
profilers = [
"scalene>=1.3.16",
"snakeviz",
]
build = [
"conda-build",
"python-build",
"twine",
]
spelling = ["typos"]
other = [
"jsonschema",
"types-jsonschema",
]
[tool.ruff]
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
]
extend-exclude = ["tests", "test"]
line-length = 120
# Assume Python 3.10.
target-version = "py310"
# Enumerate all fixed violations.
show-fixes = true
[tool.ruff.lint]
preview = true
# see https://docs.astral.sh/ruff/rules/#rules
select = ["ALL"]
external = ["DOC", "PLR"]
exclude = ["samples/*"]
# Never enforce `E501` (line length violations).
ignore = [
# Architectural & backwards compatibility constraints
"builtin-argument-shadowing", # A002
"any-type", # ANN401
"boolean-type-hint-positional-argument", # FBT001
"boolean-default-value-positional-argument", # FBT002
"unused-noqa", # RUF100
# Complexity & Magic Numbers constraints for legacy SDK design
"magic-value-comparison", # PLR2004
"too-many-arguments", # PLR0913
"too-many-positional-arguments", # PLR0917
# "too-many-statements-in-try-body", # PLW0717
# Missing Documentation constraints
"missing-copyright-notice", # CPY001
"docstring-missing-exception", # DOC501
"line-too-long", # E501
# "docstring-missing-public-module", # D100
# "docstring-missing-public-package", # D104
# Formatter incompatibilities (Mandatory ignores when using Ruff Formatter)
"missing-trailing-comma", # COM812
"single-line-implicit-string-concatenation", # ISC001
]
# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = ["B"]
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
# Ignore E402 (import violations) in all '__init__.py' files, and in `path/to/file.py`.
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["module-import-not-at-top-of-file"] # E402
#"path/to/file.py" = ["E402"]
[tool.ruff.lint.extend-per-file-ignores]
"tests/*" = [
"D", # Docstrings not required in tests
"E", # Formatting rules handled by formatter
"I", # Unsorted imports in test suites
"unused-import", # Unused imports (often kept for fixtures/testing setup)
"SIM", # Code simplification rules
"RET", # Return simplifications
"PTH", # Pathlib suggestions
"Q", # Quotes strictness
"RUF", # Ruff-specific style rules
"S", # Bandit security checks (allows asserts, dummy passwords, /tmp)
"SLF", # Private member access (tests need to inspect internal state)
"N", # Naming conventions (allows CamelCase like TestOneInput for fuzzers)
"TRY", # Tryceratops (exceptions with raw strings)
"EM", # Error messages with f-strings
"ARG", # Unused arguments in mocks and fixtures
"BLE", # Blind exception catches in fuzzers/harnesses
"PL", # Pylint rules (complexity, method structures)
"EXE", # Executable shebangs
"INP", # Implicit namespace packages
"DOC", # Pydoclint yield/return doc requirements
"PT", # Pytest style strictness
"ANN", # Type annotation strictness in tests
"A", # Builtin shadowing in test signatures
"B", # Bugbear checks
"C90", # McCabe complexity
"T20", # Print statements in tests
"TC", # Type checking block constraints
]
[tool.ruff.lint.pylint]
max-args = 9 # SDK endpoints need more (auth, data, headers, filters, etc.)
max-returns = 9
max-branches = 15
[tool.ruff.lint.flake8-annotations]
allow-star-arg-any = false
ignore-fully-untyped = false
[tool.ruff.lint.flake8-quotes]
docstring-quotes = "double"
[tool.ruff.format]
exclude = ["*.pyi"]
# Like Black, use double quotes for strings.
quote-style = "double"
# 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"
# Enables automatic formatting of Python code inside docstrings.
docstring-code-format = true
# Set the line length limit used when formatting code snippets in docstrings.
docstring-code-line-length = "dynamic"
[tool.ruff.lint.isort]
force-single-line = false
combine-as-imports = true
force-sort-within-sections = false
lines-after-imports = 2
[tool.ruff.lint.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10
[tool.ruff.lint.pycodestyle]
ignore-overlong-task-comments = true
[tool.ruff.lint.pydocstyle]
convention = "google"
[tool.mypy]
strict = true
# Adapted from this StackOverflow post:
# https://stackoverflow.com/questions/55944201/python-type-hinting-how-do-i-enforce-that-project-wide
python_version = "3.10"
mypy_path = "type_stubs"
namespace_packages = true
# This flag enhances the user feedback for error messages
pretty = true
# 3rd party import
ignore_missing_imports = true
# flag to suppress Name <var> already defined on a line
allow_redefinition = false
# Disallow dynamic typing
disallow_any_unimported = false
disallow_any_expr = false
disallow_any_decorated = false
disallow_any_explicit = false
disallow_any_generics = false
disallow_subclassing_any = true
# Disallow untyped definitions and calls
disallow_untyped_calls = true
disallow_untyped_defs = true
check_untyped_defs = true
disallow_incomplete_defs = true
disallow_untyped_decorators = true
# None and optional handling
no_implicit_optional = true
# Configuring warnings
warn_return_any = false
warn_no_return = true
warn_unreachable = true
warn_unused_configs = false
warn_redundant_casts = true
warn_unused_ignores = false
# Misc
follow_imports = "silent"
strict_optional = false
strict_equality = true
#exclude = '''(?x)(
# (^|/)test[^/]*\.py$ # files named "test*.py"
# )'''
exclude = [
"mailjet_rest/samples",
]
# Configuring error messages
show_error_context = false
show_column_numbers = false
show_error_codes = true
disable_error_code = 'misc'
[tool.pyright]
reportMissingModuleSource = false
include = ["mailjet_rest"]
exclude = ["samples/*", "**/__pycache__"]
reportAttributeAccessIssue = false
reportMissingImports = false
[[tool.mypy.overrides]]
module = ["tests.*"]
disable_error_code = ["untyped-decorator", "unreachable", "no-untyped-def", "no-untyped-call"]
[tool.bandit]
# usage: bandit -c pyproject.toml -r .
targets = ["mailjet_rest"]
exclude_dirs = ["tests", "tests.py"]
tests = ["B201", "B301"]
skips = ["B101", "B601"]
severity = "low"
[tool.bandit.any_other_function_with_shell_equals_true]
no_shell = [
"os.execl", "os.execle", "os.execlp", "os.execlpe", "os.execv", "os.execve",
"os.execvp", "os.execvpe", "os.spawnl", "os.spawnle", "os.spawnlp",
"os.spawnlpe", "os.spawnv", "os.spawnve", "os.spawnvp", "os.spawnvpe",
"os.startfile"
]
shell = [
"os.system", "os.popen", "os.popen2", "os.popen3", "os.popen4",
"popen2.popen2", "popen2.popen3", "popen2.popen4", "popen2.Popen3",
"popen2.Popen4", "commands.getoutput", "commands.getstatusoutput"
]
subprocess = [
"subprocess.Popen", "subprocess.call", "subprocess.check_call",
"subprocess.check_output"
]
[tool.slotscheck]
strict-imports = false
require-subclass = false
exclude-modules = '''
(
^mailjet_rest\.samples\..*
)
'''
[tool.coverage.run]
source_pkgs = ["mailjet_rest"]
branch = true
parallel = true
omit = [
"samples/*",
"tests/*",
]
[tool.coverage.paths]
tests = ["tests"]
[tool.coverage.report]
fail_under = 80
show_missing = true
exclude_lines = [
"no cov",
"pragma: no cover",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
]
[tool.pytest.ini_options]
# Register custom marks to avoid warnings
markers = [
"network: marks tests as integration tests that require live network access",
"property_heavy: Heavy Hypothesis property-based tests skipped on CI",
]