Conversation
…o list Using Sou (aws#5518)
aviruthen
commented
Mar 20, 2026
Owner
Author
There was a problem hiding this comment.
Can you add a small comment explaining why you are adding a default value of [] if dependencies is None?
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.
Description
Fix TypeError when
SourceCode.requirementsis None in pipeline code hash computationProblem
When creating a
TrainingStepin a pipeline with aModelTrainerwhoseSourceCode.requirementsisNone(the default), the pipeline build could fail with:This occurred because
get_processing_code_hash()concatenates thedependenciesparameter directly with a list without first checking if it'sNone.Root Cause
In
get_processing_code_hash(), thedependenciesparameter is concatenated with lists (e.g.,[source_dir] + dependencies) without a guard againstNonevalues. Whileget_training_code_hash()already hasif dependencies:guards,get_processing_code_hash()did not.Fix
dependencies = dependencies or []at the top ofget_processing_code_hash()to defensively normalizeNoneto an empty list before any list concatenation occurs.Nonedependencies for bothget_processing_code_hash()andget_training_code_hash().Testing
test_get_processing_code_hash_with_none_dependencies- verifies no TypeError with source_dir and None dependenciestest_get_processing_code_hash_code_only_with_none_dependencies- verifies no TypeError with code only and None dependenciestest_get_training_code_hash_with_none_dependencies_source_dir- verifies None dependencies with source_dirtest_get_training_code_hash_with_none_dependencies_entry_point_only- verifies None dependencies with entry_point onlyRelated Issue
Fixes aws#5518
Changes Made
The bug occurs when
SourceCode.requirementsis None (not set by the user) and is passed as thedependenciesparameter toget_training_code_hash(). While the current code in the repository hasif dependencies:guards inget_training_code_hash(), the issue reporter's version (3.3.1) encounters aTypeError: can only concatenate list (not 'NoneType') to listat thehash_files_or_dirs([source_dir] + dependencies)call. The fix should be applied in two places: (1) inget_code_hash()to defensively passNonerequirements as empty/no-dependency, and (2) inget_processing_code_hash()which has the same latent bug wheredependenciescould theoretically be None but is concatenated without a guard.AI-Generated PR
This PR was automatically generated by the PySDK Issue Agent.
Merge Checklist
prefix: descriptionformat