Refactor Producer to leverage Type directly and allow direct Artifact instantiation#263
Merged
JacobHayes merged 2 commits intogoldenfrom Aug 3, 2022
Merged
Conversation
… instantiation Resolves #260 Signed-off-by: Jacob Hayes <[email protected]>
Codecov Report
@@ Coverage Diff @@
## golden #263 +/- ##
===========================================
+ Coverage 99.84% 100.00% +0.15%
===========================================
Files 42 42
Lines 2573 2578 +5
Branches 528 525 -3
===========================================
+ Hits 2569 2578 +9
+ Misses 4 0 -4
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
Signed-off-by: Jacob Hayes <[email protected]>
9 tasks
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
This refactors
Producerto operate primarily against aTyperather than requiring a strictArtifactsubclass (with a nestedType). TheTypeis derived from the parameter type annotations, by one of the following mechanisms:python_type_system) (int)Typeinstance embedded in anAnnotatedtype hint (Annotated[int, Int64()])Artifactclass with atypedefault set embedded in anAnnotatedtype hint (Annotated[int, MyArtifact])Relaxing the requirement for
Artifactsubclass improves simple cases ofProducerandGraphcreation significantly and allows directArtifactinstantiation. As requested in #260, this simple example now works as expected:, yielding:
Resolves #260 and supersedes #259 (pickling now works fine w/o the dynamic classes).
Type of change
Artifact.for_literalandArtifact.from_typehave been removedArtifact.cast).Producer._*_class vars have been replacedHow Has This Been Tested?
Tests have been updated and added to maintain coverage.
Checklist: