feat: 기사 제목 추출 및 DOM JSON Minify 도구 추가#376
Conversation
DOM JSON 데이터에서 기사 제목(headline)만 추출하여 텍스트 파일로 저장하는 `tools/extract_headlines.py` 도구와 띄어쓰기를 최소화하여 JSON 크기를 줄이는 `tools/minify_dom.py` 도구를 추가했습니다.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
1. `tests/test_tools_extract_headlines.py`와 `tests/test_tools_minify_dom.py`에서 `runpy.run_module("__main__")` 실행 시 발생하는 "found in sys.modules ... unpredictable behaviour" `RuntimeWarning`을 `warnings.catch_warnings`를 통해 무시하도록 테스트 코드를 수정했습니다.
2. 린터(`ruff`)가 지적한 'Module level import not at top of file' 에러(`E402`)를 해결하기 위해 `sys.path` 조작 이후의 `import` 구문에 `# noqa: E402`를 추가했습니다.
3. 관련 테스트 코드를 수정한 후 `uv run pytest` 명령어를 통해 100% 브랜치 커버리지를 재확인했습니다.
| warnings.filterwarnings("ignore", category=RuntimeWarning) | ||
| try: | ||
| runpy.run_module("tools.extract_headlines", run_name="__main__") | ||
| except SystemExit: |
| warnings.filterwarnings("ignore", category=RuntimeWarning) | ||
| try: | ||
| runpy.run_module("tools.minify_dom", run_name="__main__") | ||
| except SystemExit: |
What (구현 내용)
tools/extract_headlines.pyCLI 도구를 구현했습니다.tools/minify_dom.pyCLI 도구를 추가했습니다.tests/test_tools_extract_headlines.py,tests/test_tools_minify_dom.py)를 추가했습니다.CHANGELOG.md의## [Unreleased]하위### Added섹션에 신규 도구 2종에 대한 내용을 추가했습니다.Why (해결하는 문제)
indent)가 되어 있어 파일 크기가 큽니다. 시스템 연동 시 네트워크 전송 및 스토리지 효율을 높이기 위해 불필요한 공백을 제거하는 Minify 도구가 필요했습니다.Impact (성능/영향)
Measurement (측정/검증 방법)
uv run pytest --cov=tools --cov-branch --cov-report=term-missing --cov-fail-under=100명령어를 통해extract_headlines.py및minify_dom.py코드에 대해 100% 브랜치 커버리지를 달성함을 확인했습니다.uv run ruff format및uv run ruff check --fix를 통해 린터 오류가 없음을 검증했습니다.PR created automatically by Jules for task 1490677108389924306 started by @seonghobae