Skip to content

Commit a8e54f5

Browse files
authored
Add comment why not to use ~= clause in deps definition (#169)
1 parent 8d5718d commit a8e54f5

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

pyproject.toml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,13 @@ classifiers = [
2121
]
2222

2323
requires-python = ">=3.8"
24+
25+
# We use inclusive ordered comparison clause for non-Apify packages intentionally in order to enhance the Apify client's
26+
# compatibility with a wide range of external packages. This decision was discussed in detail in the following PR:
27+
# https://github.com/apify/apify-sdk-python/pull/154
2428
dependencies = [
2529
"apify-shared ~= 1.1.0",
26-
"httpx ~= 0.25.1",
30+
"httpx >= 0.25.1",
2731
]
2832

2933
[project.optional-dependencies]
@@ -67,17 +71,27 @@ select = ["ALL"]
6771
ignore = [
6872
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in {filename}
6973
"BLE001", # Do not catch blind exception
74+
"C901", # `{name}` is too complex
7075
"COM812", # This rule may cause conflicts when used with the formatter
7176
"D100", # Missing docstring in public module
7277
"D104", # Missing docstring in public package
7378
"EM", # flake8-errmsg
79+
"G004", # Logging statement uses f-string
7480
"ISC001", # This rule may cause conflicts when used with the formatter
7581
"FIX", # flake8-fixme
7682
"PGH003", # Use specific rule codes when ignoring type issues
83+
"PLR0911", # Too many return statements
7784
"PLR0913", # Too many arguments in function definition
85+
"PLR0915", # Too many statements
7886
"PTH", # flake8-use-pathlib
87+
"PYI034", # `__aenter__` methods in classes like `{name}` usually return `self` at runtime
88+
"PYI036", # The second argument in `__aexit__` should be annotated with `object` or `BaseException | None`
7989
"S102", # Use of `exec` detected
8090
"S105", # Possible hardcoded password assigned to
91+
"S106", # Possible hardcoded password assigned to argument: "{name}"
92+
"S301", # `pickle` and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue
93+
"S303", # Use of insecure MD2, MD4, MD5, or SHA1 hash function
94+
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
8195
"TD002", # Missing author in TODO; try: `# TODO(<author_name>): ...` or `# TODO @<author_name>: ...
8296
"TID252", # Relative imports from parent modules are bannedRuff
8397
"TRY003", # Avoid specifying long messages outside the exception class
@@ -101,8 +115,9 @@ indent-style = "space"
101115
"D", # Everything from the pydocstyle
102116
"INP001", # File {filename} is part of an implicit namespace package, add an __init__.py
103117
"PLR2004", # Magic value used in comparison, consider replacing {value} with a constant variable
104-
"T20", # flake8-print
105118
"S101", # Use of assert detected
119+
"T20", # flake8-print
120+
"TRY301", # Abstract `raise` to an inner function
106121
]
107122

108123
[tool.ruff.lint.flake8-quotes]

src/apify_client/_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def stop_retrying() -> None:
6666
if not swallow:
6767
raise
6868

69-
random_sleep_factor = random.uniform(1, 1 + random_factor) # noqa: S311
69+
random_sleep_factor = random.uniform(1, 1 + random_factor)
7070
backoff_base_secs = backoff_base_millis / 1000
7171
backoff_exp_factor = backoff_factor ** (attempt - 1)
7272

@@ -99,7 +99,7 @@ def stop_retrying() -> None:
9999
if not swallow:
100100
raise
101101

102-
random_sleep_factor = random.uniform(1, 1 + random_factor) # noqa: S311
102+
random_sleep_factor = random.uniform(1, 1 + random_factor)
103103
backoff_base_secs = backoff_base_millis / 1000
104104
backoff_exp_factor = backoff_factor ** (attempt - 1)
105105

0 commit comments

Comments
 (0)