Skip to content

feat: 기사 제목 추출 및 DOM JSON Minify 도구 추가#376

Open
seonghobae wants to merge 2 commits into
developfrom
feature/add-new-dom-tools-1490677108389924306
Open

feat: 기사 제목 추출 및 DOM JSON Minify 도구 추가#376
seonghobae wants to merge 2 commits into
developfrom
feature/add-new-dom-tools-1490677108389924306

Conversation

@seonghobae

Copy link
Copy Markdown
Collaborator

What (구현 내용)

  • DOM JSON 데이터에서 기사 제목(headline)을 추출하여 텍스트 파일로 저장하는 tools/extract_headlines.py CLI 도구를 구현했습니다.
  • DOM JSON 데이터의 구조를 유지한 채 띄어쓰기를 제거하여 JSON 파일 크기를 최적화(Minify)하는 tools/minify_dom.py CLI 도구를 추가했습니다.
  • 각 도구에 대해 유효한 JSON 검증, 빈 파일, 확장자 오류 등을 포괄하는 단위 테스트(tests/test_tools_extract_headlines.py, tests/test_tools_minify_dom.py)를 추가했습니다.
  • CHANGELOG.md## [Unreleased] 하위 ### Added 섹션에 신규 도구 2종에 대한 내용을 추가했습니다.

Why (해결하는 문제)

  • 파싱된 뉴스 JSON 데이터에서 텍스트 분석 또는 목록화 작업 시 제목(headline)만 빠르게 추출할 수 있는 독립적인 도구가 필요했습니다.
  • 파싱된 JSON 결과물은 사람이 읽기 쉽게 들여쓰기(indent)가 되어 있어 파일 크기가 큽니다. 시스템 연동 시 네트워크 전송 및 스토리지 효율을 높이기 위해 불필요한 공백을 제거하는 Minify 도구가 필요했습니다.

Impact (성능/영향)

  • 대용량 뉴스 문서 처리 파이프라인에서 텍스트(제목) 추출 및 파일 압축 단계를 쉘 스크립트 기반으로 손쉽게 통합할 수 있게 되었습니다.
  • 기존 API 서버 로직이나 패키지 의존성에 영향을 미치지 않는 독립적인 도구입니다.

Measurement (측정/검증 방법)

  • uv run pytest --cov=tools --cov-branch --cov-report=term-missing --cov-fail-under=100 명령어를 통해 extract_headlines.pyminify_dom.py 코드에 대해 100% 브랜치 커버리지를 달성함을 확인했습니다.
  • uv run ruff formatuv run ruff check --fix를 통해 린터 오류가 없음을 검증했습니다.

PR created automatically by Jules for task 1490677108389924306 started by @seonghobae

DOM JSON 데이터에서 기사 제목(headline)만 추출하여 텍스트 파일로 저장하는 `tools/extract_headlines.py` 도구와 띄어쓰기를 최소화하여 JSON 크기를 줄이는 `tools/minify_dom.py` 도구를 추가했습니다.
@google-labs-jules

Copy link
Copy Markdown

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Comment thread tests/test_tools_extract_headlines.py Fixed
Comment thread tests/test_tools_minify_dom.py Fixed
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:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant