Add --ignore-errors to skip files with errors #10

Open
opened 2025-04-09 14:58:30 +00:00 by tcsenpai · 0 comments
Owner

Originally created by @shumbo on 3/14/2025

Overview

This PR introduces the --ignore-errors flag to pipreqs, allowing users to continue generating requirements.txt even if some files contain syntax errors. When this option is enabled, files with syntax errors will be skipped, and a warning will be logged instead of failing the entire process.

Key Improvements Over #287

I initially worked on this without being aware of PR #287, which proposed a similar change. After finishing my implementation, I became aware of #287 and reviewed it carefully. While I appreciate the original contribution, I believe this PR still provides additional value for the following reasons:

Includes a Test Case

This PR adds a test (test_ignore_errors) to ensure the new flag works correctly. The previous PR did not include a test, which could make it harder to verify correctness and prevent regressions in the future.

Preserves Notebook Parsing Functionality

Since #287 was opened, pipreqs has added support for reading Jupyter notebooks using read_file_content. However, it looks like there was an issue during conflict resolution in #287, causing the code to revert to reading files as plain text instead of using read_file_content.

I appreciate the work done in #287 and would be happy to collaborate to refine this feature. Let me know if any changes are needed! 😊

*Originally created by @shumbo on 3/14/2025* ## Overview This PR introduces the `--ignore-errors` flag to pipreqs, allowing users to continue generating requirements.txt even if some files contain syntax errors. When this option is enabled, files with syntax errors will be skipped, and a warning will be logged instead of failing the entire process. ## Key Improvements Over [#287](https://github.com/bndr/pipreqs/pull/287) I initially worked on this without being aware of PR #287, which proposed a similar change. After finishing my implementation, I became aware of #287 and reviewed it carefully. While I appreciate the original contribution, I believe this PR still provides additional value for the following reasons: **Includes a Test Case** This PR adds a test (`test_ignore_errors`) to ensure the new flag works correctly. The previous PR did not include a test, which could make it harder to verify correctness and prevent regressions in the future. **Preserves Notebook Parsing Functionality** Since #287 was opened, pipreqs has added support for reading Jupyter notebooks using read_file_content. However, it looks like there was an issue during conflict resolution in #287, causing the code to revert to reading files as plain text instead of using read_file_content. I appreciate the work done in #287 and would be happy to collaborate to refine this feature. Let me know if any changes are needed! 😊
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/pipreqs#10
No description provided.