feat: Add file output options to job_analyzer - #3
Open
frenzel-ai-dev wants to merge 3 commits into
Open
Conversation
This commit introduces new functionality to `job_analyzer.py` allowing you to save analysis results to a structured file.
Key changes:
- Added command-line options:
- `--output-file` (-o): Specifies the path for the output file.
- `--output-format` (-f): Specifies the format of the output (JSON or Markdown).
- If an output file is specified, results are written to the file in the chosen format (defaults to JSON).
- If no output file is specified, results are printed to the console as before.
- The results dictionary now consolidates top skills, resume matching, missing skills, and recommendations.
- Added a Markdown formatter for the results.
- Updated `README.md` to document the new options.
- Added extensive unit tests for the new functionality, including CLI parsing, file generation (JSON and MD), and console output.
Note: Existing test failures in `tests/test_job_analyzer.py` (related to PDF parsing and specific assertion details) and `tests/test_job_scraper.py` (related to Selenium mocks) are known and will be addressed separately.
There was a problem hiding this comment.
Pull Request Overview
This PR adds file output capabilities to the job_analyzer CLI, allowing users to save analysis results in JSON or Markdown format.
- Refactors NLTK data downloads into a dedicated
download_nltk_data()function and invokes it inmain(). - Extends
analyze_jobs_and_resume()to accept--output-fileand--output-format, handling both JSON and Markdown exports. - Updates
README.mdto document the new CLI options.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| job_recommender/job_analyzer.py | Refactored NLTK downloads, added Markdown formatter, and implemented output-file/format logic with file-writing branches. |
| README.md | Documented -o/--output-file and -f/--output-format options. |
| actual_format = output_format.lower() | ||
|
|
||
| try: | ||
| with open(output_file, 'w', encoding='utf-8') as f: |
There was a problem hiding this comment.
[nitpick] The JSON/Markdown file-writing logic is duplicated in both the error and main branches. Extract this into a helper function to reduce code repetition and ensure consistent behavior.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit introduces new functionality to
job_analyzer.pyallowing you to save analysis results to a structured file.Key changes:
--output-file(-o): Specifies the path for the output file.--output-format(-f): Specifies the format of the output (JSON or Markdown).README.mdto document the new options.Note: Existing test failures in
tests/test_job_analyzer.py(related to PDF parsing and specific assertion details) andtests/test_job_scraper.py(related to Selenium mocks) are known and will be addressed separately.