-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathpyproject.toml
More file actions
254 lines (225 loc) · 9.05 KB
/
pyproject.toml
File metadata and controls
254 lines (225 loc) · 9.05 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
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "apify"
version = "3.3.1"
description = "Apify SDK for Python"
authors = [{ name = "Apify Technologies s.r.o.", email = "support@apify.com" }]
license = { file = "LICENSE" }
readme = "README.md"
requires-python = ">=3.10"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"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",
"Topic :: Software Development :: Libraries",
]
keywords = [
"apify",
"sdk",
"automation",
"chrome",
"crawlee",
"crawler",
"headless",
"scraper",
"scraping",
]
dependencies = [
"apify-client>=2.3.0,<3.0.0",
"apify-shared>=2.0.0,<3.0.0",
"crawlee>=1.0.4,<2.0.0",
"cachetools>=5.5.0",
"cryptography>=42.0.0",
"impit>=0.8.0",
"lazy-object-proxy>=1.11.0",
"more_itertools>=10.2.0",
"pydantic>=2.11.0",
"typing-extensions>=4.1.0",
"websockets>=14.0",
"yarl>=1.18.0",
]
[project.optional-dependencies]
scrapy = ["scrapy>=2.14.0"]
[project.urls]
"Apify Homepage" = "https://apify.com"
"Changelog" = "https://docs.apify.com/sdk/python/docs/changelog"
"Discord" = "https://discord.com/invite/jyEM2PRvMU"
"Documentation" = "https://docs.apify.com/sdk/python/docs/overview"
"Homepage" = "https://docs.apify.com/sdk/python/"
"Issue Tracker" = "https://github.com/apify/apify-sdk-python/issues"
"Release Notes" = "https://docs.apify.com/sdk/python/docs/upgrading/upgrading-to-v2"
"Source Code" = "https://github.com/apify/apify-sdk-python"
[dependency-groups]
dev = [
# TODO: Remove this constraint once pydoc-markdown updates its dependencies.
# Package pydoc-markdown is unmaintained and pins old docspec-python with vulnerable black.
# See https://github.com/apify/apify-client-python/pull/582/ for more details.
# We explicitly constrain black>=24.3.0 to override the transitive dependency.
"black>=24.3.0",
"build<2.0.0",
"crawlee[parsel]",
"dycw-pytest-only<3.0.0",
"griffe",
"poethepoet<1.0.0",
"pre-commit<5.0.0",
"pydoc-markdown<5.0.0",
"pytest-asyncio<2.0.0",
"pytest-cov<8.0.0",
"pytest-httpserver<2.0.0",
"pytest-timeout<3.0.0",
"pytest-xdist<4.0.0",
"pytest<9.0.0",
"ruff~=0.15.0",
"setuptools", # setuptools are used by pytest but not explicitly required
"ty~=0.0.0",
"types-cachetools<7.0.0",
"uvicorn[standard]",
"werkzeug<4.0.0", # Werkzeug is used by httpserver
]
[tool.hatch.build.targets.wheel]
packages = ["src/apify"]
[tool.hatch.metadata]
allow-direct-references = true
[tool.ruff]
line-length = 120
include = ["src/**/*.py", "tests/**/*.py", "docs/**/*.py", "website/**/*.py"]
[tool.ruff.lint]
select = ["ALL"]
ignore = [
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in {filename}
"ASYNC109", # Async function definition with a `timeout` parameter
"BLE001", # Do not catch blind exception
"C901", # `{name}` is too complex
"COM812", # This rule may cause conflicts when used with the formatter
"D100", # Missing docstring in public module
"D104", # Missing docstring in public package
"D107", # Missing docstring in `__init__`
"D203", # One blank line required before class docstring
"D213", # Multi-line docstring summary should start at the second line
"D413", # Missing blank line after last section
"EM", # flake8-errmsg
"G004", # Logging statement uses f-string
"ISC001", # This rule may cause conflicts when used with the formatter
"FIX", # flake8-fixme
"PLR0911", # Too many return statements
"PLR0913", # Too many arguments in function definition
"PLR0915", # Too many statements
"PTH", # flake8-use-pathlib
"PYI034", # `__aenter__` methods in classes like `{name}` usually return `self` at runtime
"PYI036", # The second argument in `__aexit__` should be annotated with `object` or `BaseException | None`
"S102", # Use of `exec` detected
"S105", # Possible hardcoded password assigned to
"S106", # Possible hardcoded password assigned to argument: "{name}"
"S301", # `pickle` and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue
"S303", # Use of insecure MD2, MD4, MD5, or SHA1 hash function
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
"TD002", # Missing author in TODO; try: `# TODO(<author_name>): ...` or `# TODO @<author_name>: ...
"TRY003", # Avoid specifying long messages outside the exception class
]
[tool.ruff.format]
quote-style = "single"
indent-style = "space"
[tool.ruff.lint.per-file-ignores]
"**/__init__.py" = [
"F401", # Unused imports
]
"**/{tests}/*" = [
"D", # Everything from the pydocstyle
"INP001", # File {filename} is part of an implicit namespace package, add an __init__.py
"PLC0415", # `import` should be at the top-level of a file
"PLR2004", # Magic value used in comparison, consider replacing {value} with a constant variable
"S101", # Use of assert detected
"SLF001", # Private member accessed: `{name}`
"T20", # flake8-print
"TID252", # Prefer absolute imports over relative imports from parent modules
"TRY301", # Abstract `raise` to an inner function
]
"**/{docs,website}/**" = [
"D", # Everything from the pydocstyle
"INP001", # File {filename} is part of an implicit namespace package, add an __init__.py
"F841", # Local variable {variable} is assigned to but never used
"TRY301", # Abstract `raise` to an inner function
"PLR2004", # Magic value used in comparison, consider replacing `{value}` with a constant variable
"PLW0603", # Using the global statement to update `{name}` is discouraged
]
"**/docs/**/scrapy_project/**" = [
# Local imports are mixed up with the Apify SDK.
"I001", # Import block is un-sorted or un-formatted
# Class variables are common in Scrapy projects.
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
# Local imports in Scrapy project.
"TID252", # Prefer absolute imports over relative imports from parent modules
]
[tool.ruff.lint.flake8-quotes]
docstring-quotes = "double"
inline-quotes = "single"
[tool.ruff.lint.flake8-type-checking]
runtime-evaluated-base-classes = [
"pydantic.BaseModel",
"crawlee.configuration.Configuration",
]
[tool.ruff.lint.flake8-builtins]
builtins-ignorelist = ["id"]
[tool.ruff.lint.isort]
known-local-folder = ["apify"]
known-first-party = ["apify_client", "apify_shared", "crawlee"]
[tool.ruff.lint.pylint]
max-branches = 18
[tool.pytest.ini_options]
addopts = "-r a --verbose"
asyncio_default_fixture_loop_scope = "function"
asyncio_mode = "auto"
timeout = 1800
[tool.ty.environment]
python-version = "3.10"
[tool.ty.src]
include = ["src", "tests", "scripts", "docs", "website"]
[[tool.ty.overrides]]
include = [
"docs/**/*.py",
"website/**/*.py",
]
[tool.ty.overrides.rules]
unresolved-import = "ignore"
[tool.coverage.report]
exclude_lines = ["pragma: no cover", "if TYPE_CHECKING:", "assert_never()"]
[tool.ipdb]
context = 7
# Run tasks with: uv run poe <task>
[tool.poe.tasks]
clean = "rm -rf .coverage .pytest_cache .ruff_cache .ty_cache build dist htmlcov"
install-sync = "uv sync --all-extras"
build = "uv build"
publish-to-pypi = "uv publish --token ${APIFY_PYPI_TOKEN_CRAWLEE}"
type-check = "uv run ty check"
unit-tests = "uv run pytest --numprocesses=${TESTS_CONCURRENCY:-auto} tests/unit"
unit-tests-cov = "uv run pytest --numprocesses=${TESTS_CONCURRENCY:-auto} --cov=src/apify --cov-report=xml:coverage-unit.xml tests/unit"
integration-tests = "uv run pytest --numprocesses=${TESTS_CONCURRENCY:-auto} tests/integration"
integration-tests-cov = "uv run pytest --numprocesses=${TESTS_CONCURRENCY:-auto} --cov=src/apify --cov-report=xml:coverage-integration.xml tests/integration"
e2e-tests = "uv run pytest --numprocesses=${TESTS_CONCURRENCY:-auto} tests/e2e"
e2e-tests-cov = "uv run pytest --numprocesses=${TESTS_CONCURRENCY:-auto} --cov=src/apify --cov-report=xml:coverage-e2e.xml tests/e2e"
check-code = ["lint", "type-check", "unit-tests"]
[tool.poe.tasks.install-dev]
shell = "uv sync --all-extras && uv run pre-commit install"
[tool.poe.tasks.lint]
shell = "uv run ruff format --check && uv run ruff check"
[tool.poe.tasks.format]
shell = "uv run ruff check --fix && uv run ruff format"
[tool.poe.tasks.update-docs-theme]
shell = "corepack enable && yarn up @apify/docs-theme"
cwd = "website"
[tool.poe.tasks.build-docs]
shell = "./build_api_reference.sh && corepack enable && yarn && uv run yarn build"
cwd = "website"
[tool.poe.tasks.run-docs]
shell = "./build_api_reference.sh && corepack enable && yarn && uv run yarn start"
cwd = "website"