Skip to content

Feature/zip support new#28

Closed
coolnipunj wants to merge 7 commits intomainfrom
feature/zip-support-new
Closed

Feature/zip support new#28
coolnipunj wants to merge 7 commits intomainfrom
feature/zip-support-new

Conversation

@coolnipunj
Copy link
Copy Markdown
Collaborator

Add Zip File Support

Description

This PR adds support for processing zip files in sum-buddy, allowing users to generate checksums for both zip files and their contents. This feature enhances the package's functionality by enabling comprehensive checksum generation for archived files.

Implementation Details

  • Created a new ArchiveHandler class in archive.py to manage zip file processing
  • Modified Mapper class to detect and process zip files
  • Updated Hasher class to handle both file paths and file-like objects
  • Enhanced get_checksums function to process both zip files and their contents
  • Added comprehensive test coverage for zip file handling

Testing

The implementation has been tested with:

  • Regular files
  • Zip files containing multiple files
  • Nested directory structures within zip files
  • Various file types and sizes

Design Decisions

  1. Temporary Directory Approach: Using a temporary directory for zip extraction ensures clean handling of zip contents without leaving residual files
  2. Dual Processing: Processing both the zip file itself and its contents provides complete checksum coverage
  3. File-like Object Support: Enhanced Hasher class to handle both file paths and file-like objects for better flexibility
  4. Clean Integration: Maintained the existing API while adding zip support, ensuring backward compatibility

@coolnipunj coolnipunj requested a review from thompsonmj June 16, 2025 23:01
@hlapp hlapp requested a review from Copilot June 17, 2025 13:13
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds zip file support to sum-buddy by enabling checksum generation for both zip files and their individual contents.

  • Introduces an ArchiveHandler class to extract zip file contents.
  • Updates Mapper to detect zip files and append their internal file paths.
  • Modifies Hasher and the main checksum function to handle file-like objects and process files within zip archives.
  • Updates README documentation with usage examples for zip file support.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/sumbuddy/mapper.py Adds detection and processing of zip files and their contents.
src/sumbuddy/hasher.py Renames parameter and adjusts logic to support both file paths and objects.
src/sumbuddy/archive.py Implements ArchiveHandler for zip extraction with temporary directory usage.
src/sumbuddy/main.py Updates get_checksums to include zip file member handling using zipfile APIs.
README.md Documents new zip support and usage examples.
Comments suppressed due to low confidence (1)

src/sumbuddy/main.py:65

  • [nitpick] Consider using a logging mechanism for warnings instead of print statements to allow for configurable output levels and better production diagnostics.
                        print(f"Warning: {file_in_zip} not found in {zip_path}, skipping.")

coolnipunj and others added 4 commits June 17, 2025 15:04
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…cs/sum-buddy into feature/zip-support-new

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
@coolnipunj coolnipunj closed this Jun 18, 2025
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.

2 participants