mirror of
https://github.com/luongnv89/claude-howto.git
synced 2026-04-21 21:45:58 +02:00
699fb39a46
* ci: shift-left quality gates — add mypy to pre-commit, fix CI failures - Add mypy pre-commit hook (mirrors-mypy v1.13.0) so type checks run locally - Add [tool.mypy] config to scripts/pyproject.toml with overrides for untyped libs (ebooklib, sync_translations) - Add mypy>=1.8.0 to requirements-dev.txt - Fix CI test.yml: remove continue-on-error: true from lint/security/type-check jobs (was silently swallowing failures) - Fix CI bandit -c path: pyproject.toml → scripts/pyproject.toml - Fix CI mypy command: use --config-file scripts/pyproject.toml - Fix CI build-epub: add type-check to needs, fix if: success() → !failure() && !cancelled() - Fix ruff errors in sync_translations.py (RUF013 implicit Optional, SIM102 nested if) - Fix mypy errors: add list[str] annotations to errors vars in check_cross_references.py and check_links.py * fix(ci): install mmdc in build-epub job and correct return type annotation - Add npm install step for @mermaid-js/mermaid-cli before Build EPUB to fix CI failure (mmdc not found error) - Fix check_translation_status() return type from list[dict] to tuple[list[dict], list[dict]] to match the actual return value * fix(ci): pass --no-sandbox to Puppeteer in build-epub CI job mmdc (Mermaid CLI) uses Puppeteer/Chromium which requires --no-sandbox in the GitHub Actions sandboxed environment. Add --puppeteer-config flag to build_epub.py that passes a Puppeteer JSON config file to mmdc via -p, and use it in the CI workflow to inject the no-sandbox args.
123 lines
3.2 KiB
TOML
123 lines
3.2 KiB
TOML
[project]
|
|
name = "claude-howto"
|
|
version = "1.0.0"
|
|
description = "Claude Code How-To Guide with EPUB builder"
|
|
readme = "README.md"
|
|
license = "MIT"
|
|
requires-python = ">=3.10"
|
|
dependencies = [
|
|
"ebooklib",
|
|
"markdown",
|
|
"beautifulsoup4",
|
|
"httpx",
|
|
"pillow",
|
|
"tenacity",
|
|
]
|
|
|
|
[project.optional-dependencies]
|
|
dev = [
|
|
"pytest>=7.0",
|
|
"pytest-asyncio>=0.21",
|
|
]
|
|
|
|
[tool.pytest.ini_options]
|
|
testpaths = ["scripts/tests"]
|
|
asyncio_mode = "auto"
|
|
asyncio_default_fixture_loop_scope = "function"
|
|
python_files = ["test_*.py"]
|
|
python_functions = ["test_*"]
|
|
addopts = "-v"
|
|
|
|
[build-system]
|
|
requires = ["setuptools>=61.0"]
|
|
build-backend = "setuptools.build_meta"
|
|
|
|
[tool.setuptools.packages.find]
|
|
where = ["scripts"]
|
|
include = ["build_epub"]
|
|
exclude = ["tests", "tests.*"]
|
|
|
|
# =============================================================================
|
|
# Ruff Configuration
|
|
# =============================================================================
|
|
[tool.ruff]
|
|
target-version = "py310"
|
|
line-length = 88
|
|
include = ["scripts/**/*.py"]
|
|
exclude = [
|
|
".git",
|
|
".venv",
|
|
"__pycache__",
|
|
".pytest_cache",
|
|
"*.egg-info",
|
|
]
|
|
|
|
[tool.ruff.lint]
|
|
select = [
|
|
"E", # pycodestyle errors
|
|
"W", # pycodestyle warnings
|
|
"F", # Pyflakes
|
|
"I", # isort (import sorting)
|
|
"B", # flake8-bugbear
|
|
"C4", # flake8-comprehensions
|
|
"UP", # pyupgrade
|
|
"SIM", # flake8-simplify
|
|
"TCH", # flake8-type-checking
|
|
"RUF", # Ruff-specific rules
|
|
"PTH", # flake8-use-pathlib
|
|
"PL", # Pylint
|
|
"PERF", # Perflint
|
|
]
|
|
ignore = [
|
|
"E501", # Line too long (handled by formatter)
|
|
"PLR0913", # Too many arguments
|
|
"PLR2004", # Magic value comparison
|
|
"PLR0915", # Too many statements
|
|
"PERF203", # try-except in loop (acceptable for error handling)
|
|
"PERF403", # dict comprehension (readability preference)
|
|
"TC003", # Type-checking imports (not critical)
|
|
"PLC0415", # Import not at top level (acceptable for lazy imports)
|
|
"RUF005", # Collection concatenation (readability preference)
|
|
]
|
|
fixable = ["ALL"]
|
|
unfixable = []
|
|
|
|
[tool.ruff.lint.isort]
|
|
known-first-party = ["build_epub"]
|
|
force-single-line = false
|
|
combine-as-imports = true
|
|
|
|
[tool.ruff.lint.per-file-ignores]
|
|
"scripts/tests/*.py" = ["S101", "PLR2004"]
|
|
|
|
[tool.ruff.format]
|
|
quote-style = "double"
|
|
indent-style = "space"
|
|
skip-magic-trailing-comma = false
|
|
docstring-code-format = true
|
|
|
|
# =============================================================================
|
|
# Bandit Configuration
|
|
# =============================================================================
|
|
# =============================================================================
|
|
# Mypy Configuration
|
|
# =============================================================================
|
|
[tool.mypy]
|
|
python_version = "3.11"
|
|
ignore_missing_imports = true
|
|
no_implicit_optional = true
|
|
warn_unused_ignores = true
|
|
|
|
[[tool.mypy.overrides]]
|
|
module = ["build_epub", "scripts.build_epub"]
|
|
ignore_errors = true
|
|
|
|
[[tool.mypy.overrides]]
|
|
module = ["sync_translations", "scripts.sync_translations"]
|
|
ignore_errors = true
|
|
|
|
[tool.bandit]
|
|
targets = ["scripts"]
|
|
exclude_dirs = ["scripts/tests", ".venv", "__pycache__"]
|
|
skips = ["B101", "B113"] # B113: httpx timeout false positive (timeout is set)
|