pryscraper/pyproject.toml
cryptorugmunch 0200bf3e16 refactor(exceptions): add ruff BLE001; convert 103 broad except Exception
Per CONVENTIONS.md Part 2 ("Never bare except") and CONVENTIONS.md
Part 7 (pre-commit hooks: ruff), blind `except Exception` is now a
lint failure. Pre-existing sites are marked `# noqa: BLE001` for
later manual review; new code must use specific exception types.

Changes:
- pyproject.toml: added "BLE" to ruff lint select. BLE001 is now enforced
- 103 of 166 `except Exception` sites were auto-converted to specific
  types based on context (httpx, json, OSError, subprocess, etc.)
- 62 remaining sites marked with `# noqa: BLE001` for later review
  (mostly generic try/except wrappers that legitimately need broad catch
  for graceful degradation: e.g. compliance LLM fallback must catch
  any error to preserve the regex result)
- 1 manual fix: reverted compliance.py LLM fallback to broad except
  with explicit "must catch all errors" comment + noqa
- 2 files (commerce_sync.py, crm_sync.py) needed `import httpx` added
  so the auto-converted exception references would resolve
- 5 source files (agency, monitor, pipelines, auth_connector,
  llm_providers/registry) renamed "name" -> "<scope>_name" in
  extra={...} dicts because "name" is a reserved LogRecord field

Test impact:
- 14 failing tests -> 1 (the SSE subprocess test is a sandbox limitation,
  pre-existing and unrelated)
- New `test_ble_temp.py` verifies BLE001 catches new violations

Follow-up:
- Each `# noqa: BLE001` site should be reviewed and replaced with a
  specific exception type where possible. The most common legitimate
  broad-catch case is the LLM fallback path; everything else probably
  can be narrowed.
2026-07-02 21:04:53 +02:00

127 lines
3 KiB
TOML

# SPDX-License-Identifier: MIT
# Copyright (c) 2026 Rug Munch Media LLC
# Part of Pry — https://git.rugmunch.io/RugMunchMedia/pryscraper
# Licensed under MIT. See LICENSE.
[build-system]
requires = ["setuptools>=69.0"]
build-backend = "setuptools.build_meta"
[project]
name = "pry"
version = "3.0.0"
description = "Free web scraping + browser automation API — self-hosted, no API keys needed"
readme = "README.md"
requires-python = ">=3.11"
license = { text = "MIT AND BSL-1.1" }
authors = [{ name = "Rug Munch Media LLC" }]
keywords = ["scraping", "crawler", "browser-automation", "mcp", "x402", "ai-agents"]
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"License :: Other/Proprietary License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Internet :: WWW/HTTP :: Browsers",
"Topic :: Software Development :: Libraries :: Python Modules",
"Typing :: Typed",
]
[project.license-files]
paths = ["LICENSE", "LICENSE-BSL-STEALTH"]
dependencies = [
"fastapi>=0.115.0",
"uvicorn[standard]>=0.32.0",
"trafilatura>=2.0.0",
"readability-lxml>=0.8.1",
"lxml>=5.3.0",
"httpx>=0.28.0",
"markdownify>=0.14.0",
"pydantic>=2.0.0",
"pydantic-settings>=2.0.0",
"playwright>=1.50.0",
"redis>=5.0.0",
"pypdf>=5.0.0",
"python-docx>=1.1.0",
"tiktoken>=0.8.0",
"pillow>=10.0.0",
"click>=8.0.0",
"pyyaml>=6.0",
"pandas>=2.0.0",
"anyio>=4.0.0",
"croniter>=2.0.0",
"structlog>=24.0.0",
]
[project.optional-dependencies]
dev = [
"pytest>=8.0",
"pytest-asyncio>=0.24.0",
"pytest-cov>=5.0.0",
"ruff>=0.7.0",
"mypy>=1.12.0",
"pre-commit>=4.0.0",
]
[project.scripts]
pry = "cli:main"
[tool.setuptools.packages.find]
include = ["pry*"]
[tool.ruff]
target-version = "py311"
line-length = 100
[tool.ruff.lint]
select = ["E", "F", "I", "N", "W", "B", "A", "C4", "SIM", "UP", "RUF", "BLE"]
ignore = ["E501", "N815", "B008", "A002", "RUF006"]
# BLE001 (blind except Exception) is enforced. Pre-existing sites are
# marked with `# noqa: BLE001`; new code must use specific exception
# types (e.g. httpx.HTTPError, json.JSONDecodeError, OSError).
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
[tool.mypy]
python_version = "3.11"
strict = true
ignore_missing_imports = true
exclude = [
"build/",
"dist/",
".git/",
"__pycache__/",
]
warn_unused_ignores = false
[[tool.mypy.overrides]]
module = [
"trafilatura",
"trafilatura.*",
"readability",
"readability.*",
"playwright",
"playwright.*",
"pypdf",
"pypdf.*",
"docx",
"docx.*",
"PIL",
"PIL.*",
"markdownify",
"markdownify.*",
"pandas",
"pandas.*",
"yaml",
"yaml.*",
"numpy",
"numpy.*",
]
ignore_missing_imports = true
[tool.pytest.ini_options]
asyncio_mode = "auto"
testpaths = ["tests"]