feat: Allow IDs or Models to be passed to all publishing APIs#564
Open
kdmccormick wants to merge 3 commits intomainfrom
Open
feat: Allow IDs or Models to be passed to all publishing APIs#564kdmccormick wants to merge 3 commits intomainfrom
kdmccormick wants to merge 3 commits intomainfrom
Conversation
kdmccormick
commented
Apr 27, 2026
Comment on lines
+82
to
+83
| if isinstance(learning_package_id, LearningPackage): | ||
| return learning_package_id |
Member
Author
There was a problem hiding this comment.
Yes, I know this is funny :P But it makes the rest of the code simpler.
497859c to
1a96f07
Compare
kdmccormick
commented
Apr 27, 2026
| created_by: int | None, | ||
| *, | ||
| dependencies: list[int] | None = None, # PublishableEntity IDs | ||
| dependencies: Sequence[PublishableEntity.ID] | None = None, |
Member
Author
There was a problem hiding this comment.
list is invariant (its items must be the exact type, not subclasses thereof), whereas Sequence is covariant, thus more likely to behave with mypy the way consumers expect.
Member
Author
|
@bradenmacdonald Could you review? If you like it, I'll do the other applets this way too. |
620780c to
f6cb1b7
Compare
1a96f07 to
2be18fa
Compare
Contributor
|
@kdmccormick I like it! Could you please add a test for the |
f6cb1b7 to
905f820
Compare
2be18fa to
62507c8
Compare
62507c8 to
eb725ab
Compare
These weren't passing mypy, reverting for now
50fff8e to
cb7742e
Compare
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.
Part of: #562
To reduce noise in the implementations, I'm proposing these general patterns:
model,model_id, ormodel_or_id.model_idand immediately invokemodel_id = get_model_id(model_id).modeland immediately invokemodel = get_<model>(model).If this looks good, I'll apply it to the other applets as well.
BREAKING CHANGE: Some API functions which previously accepted
intnow accept<Model>.ID. Runtime behavior has not changed, but callers may need to use additional annotations ortyping.cast(...)in order to get their typechecker to pass.