-
Notifications
You must be signed in to change notification settings - Fork 0
fix: ci ruff #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: ci ruff #2
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
| __pycache__ | ||
| .pytest_cache | ||
| venv/ | ||
| .venv/ | ||
| *.pyc | ||
| *.pyo | ||
| *.egg-info/ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,6 @@ | |
|
|
||
| import asyncio | ||
| from pathlib import Path | ||
| from typing import Optional | ||
|
|
||
| import typer | ||
| from rich.console import Console | ||
|
|
@@ -34,7 +33,7 @@ def capture( | |
| ..., | ||
| help="URL of the webpage to capture resources from.", | ||
| ), | ||
| output: Optional[Path] = typer.Option( | ||
| output: Path | None = typer.Option( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- changed file ---'
cat -n src/webgrab/cli.py | sed -n '1,90p'
printf '%s\n' '--- dependency declarations ---'
for f in pyproject.toml poetry.lock requirements.txt requirements-dev.txt setup.py setup.cfg; do
if [ -f "$f" ]; then
printf '\n--- %s ---\n' "$f"
rg -n -C 3 'typer|Typer' "$f" || true
fi
done
printf '%s\n' '--- local Typer source, if present ---'
find . -path '*/typer/main.py' -o -path '*/typer/*' | head -20Repository: smeltery/webgrab Length of output: 3888 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- project metadata ---'
cat -n pyproject.toml | sed -n '1,75p'
printf '%s\n' '--- dependency lock files ---'
git ls-files | rg '(^|/)(poetry\.lock|uv\.lock|Pipfile\.lock|.*requirements.*\.txt)$' || true
printf '%s\n' '--- CLI entrypoint references ---'
rg -n -C 3 'webgrab\.cli|python -m webgrab|capture|typer' README.md tests src pyproject.toml 2>/dev/null | head -160Repository: smeltery/webgrab Length of output: 11765 🌐 Web query:
💡 Result: Support for Python's native UnionType (introduced in PEP 604, using the | syntax) was officially added to Typer in version 0.12.4 [1][2]. This support primarily enables the use of Optional-style unions, such as str | None, within Typer CLI parameter annotations [1][3]. Prior to this version, using the | syntax for type hints in Python 3.10 and later could cause errors (specifically RuntimeError) within Typer's internal get_click_type function because it did not correctly handle UnionType objects [4][5]. Key details regarding this support: 1. Implementation: The fix in version 0.12.4 involved updating Typer to use get_args and get_origin from the typing module instead of relying on older attributes, ensuring compatibility with Python 3.10+ UnionType [1]. 2. Scope: While version 0.12.4 resolved issues with Optional-style unions (e.g., type | None), Typer's built-in support for more complex Union types (e.g., int | str) remains limited [4][5]. As of 2026, discussions and pull requests have indicated that generic union support often still requires custom parsers or click_type definitions to avoid assertion errors [6]. You can reference pull request Citations:
Use Typer 0.9.0 passes 🤖 Prompt for AI Agents |
||
| None, | ||
| "--output", "-o", | ||
| help="Output directory for saved resources. Defaults to ./webgrab_output", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: smeltery/webgrab
Length of output: 1810
🏁 Script executed:
Repository: smeltery/webgrab
Length of output: 2364
Use a Python 3.10-compatible
Selfimport.The project supports Python
>=3.10and CI tests Python 3.10.typing.Selfis unavailable in Python 3.10, so this import preventsbrowser.pyfrom loading there. Addtyping-extensionsas a dependency and importSelffromtyping_extensions, or raise the minimum Python version and remove Python 3.10 from CI.🤖 Prompt for AI Agents