Conversation
…o list Using Sou (aws#5518)
aviruthen
commented
Mar 23, 2026
Owner
Author
There was a problem hiding this comment.
Right before the line dependencies = dependencies or [], can you add a comment explaining why you made this decision?
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 in Pipeline.upsert() when SourceCode.requirements is not set
Fixes aws#5518
Problem
When creating a
TrainingStepwith aSourceCodethat does not specifyrequirements, callingpipeline.upsert()could trigger aTypeError: can only concatenate list (not "NoneType") to listduring pipeline definition compilation.The root cause is that
SourceCode.requirementsdefaults toNone, which gets passed as thedependenciesparameter to code hash functions. Whileget_training_code_hashalready hasif dependencies:guards,get_processing_code_hashdirectly concatenates+ dependencieswithout checking forNone.Fix
dependencies = dependencies or []defaulting at the start ofget_processing_code_hash()to preventTypeErrorwhendependenciesisNoneget_code_hash()documenting thatsource_code.requirementscan beNoneand is handled downstreamTests
test_get_processing_code_hash_with_none_dependencies- verifies no TypeError with code-only pathtest_get_processing_code_hash_with_none_dependencies_and_source_dir- verifies no TypeError with source_dir pathtest_get_training_code_hash_with_none_dependencies_and_source_dir- verifies no TypeError with source_dirtest_get_training_code_hash_with_none_dependencies_and_entry_point- verifies no TypeError with entry_point onlyRelated Issue
Fixes aws#5518
Changes Made
The bug is in the pipeline code path where SourceCode.requirements defaults to None, which gets passed as the
dependenciesparameter toget_training_code_hash(). While the current code in the repo hasif dependencies:guards inget_training_code_hash, theget_processing_code_hashfunction does NOT have such guards and directly concatenates+ dependencies. Additionally, the defensive approach should be applied at both call sites and within the hash functions themselves to prevent future regressions. The fix addsdependencies = dependencies or []defaulting inget_processing_code_hash, and adds a None-safe fallback when readingsource_code.requirementsin theget_code_hashfunction's TrainingStep branch.AI-Generated PR
This PR was automatically generated by the PySDK Issue Agent.
Merge Checklist
prefix: descriptionformat