Skip to content

Phase 4: Enable git-aware packaging by default - #296

Open
GargiGupta-io wants to merge 4 commits into
keras-team:mainfrom
GargiGupta-io:phase-4-enable-default
Open

Phase 4: Enable git-aware packaging by default#296
GargiGupta-io wants to merge 4 commits into
keras-team:mainfrom
GargiGupta-io:phase-4-enable-default

Conversation

@GargiGupta-io

Copy link
Copy Markdown

Finalizes git-aware packaging feature:

  • Updates zip_working_dir() docstring to document git ls-files behavior
  • Marks git integration as the default behavior

Part of #288 (Phase 4 of 4). Merge after #295.

Note: See #293 for merge strategy on stacked PRs.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the packaging utility in kinetic/utils/packager.py to respect .gitignore when zipping the working directory. It introduces helper functions to list git-tracked and non-ignored files using git ls-files, check for excluded paths, and write these files to the ZIP archive. If the directory is not a git repository, it gracefully falls back to the existing os.walk traversal. Unit tests have been added in kinetic/utils/packager_test.py to verify this new behavior. I have no feedback to provide.

Adds helper functions to support git-aware packaging:
- _list_git_files(): Lists tracked and non-ignored untracked files
- _path_is_excluded(): Checks if a path should be excluded
- _write_git_files(): Recursively writes files to ZIP respecting exclusions

These functions enable respecting .gitignore when zipping working directories.
- Uses git ls-files when in a git repository to respect .gitignore
- Falls back to directory traversal with os.walk when not in a git repo
- Maintains all existing features: empty directory preservation, secret detection, path exclusion
- Updated docstring to document git integration
Adds tests for:
- _list_git_files in a git repository
- _list_git_files when not in a git repository (returns None)
- _path_is_excluded functionality

Tests ensure git integration works correctly and falls back gracefully.
Documents the git ls-files integration in the module docstring:
- Explains automatic .gitignore respect in git repos
- Documents fallback to directory traversal for non-git directories
- Notes .kineticignore pattern matching in fallback mode

Completes the git-aware packaging feature implementation.
@GargiGupta-io

GargiGupta-io commented Aug 11, 2026

Copy link
Copy Markdown
Author

See #294 for full context and merge order instructions.
This PR adds documentation for the git-aware packaging feature.

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