Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TypeSystem.extends #250

Merged
merged 11 commits into from Jul 19, 2022

Conversation

JamesOswald
Copy link
Contributor

@JamesOswald JamesOswald commented Jul 18, 2022

Description

Fixes #243

Type of change

  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How Has This Been Tested?

Added test_TypeSystem_extends.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in upstream modules

Signed-off-by: James Oswald <james.oswald@dynotx.com>
@JacobHayes
Copy link
Member

JacobHayes commented Jul 18, 2022

I need to figure out how to handle unresolved ForwardRefs (extends here) in the runtime type checking logic. Pydantic resolves the field's type_ attribute, but not outer_type_.

@JacobHayes
Copy link
Member

JacobHayes commented Jul 18, 2022

FYI: I created pydantic/pydantic#4249 to fix the unresolved ForwardRefs on field.outer_type_, but will likely work around it in another arti PR 3a0d41e to unblock sooner.

Signed-off-by: Jacob Hayes <jacob.r.hayes@gmail.com>
@JacobHayes JacobHayes marked this pull request as ready for review July 18, 2022 19:44
@JacobHayes JacobHayes self-requested a review as a code owner July 18, 2022 19:44
James Oswald and others added 9 commits July 18, 2022 16:15
Signed-off-by: James Oswald <james.oswald@dynotx.com>
Signed-off-by: James Oswald <james.oswald@dynotx.com>
Signed-off-by: Jacob Hayes <jacob.r.hayes@gmail.com>
Signed-off-by: Jacob Hayes <jacob.r.hayes@gmail.com>
Signed-off-by: Jacob Hayes <jacob.r.hayes@gmail.com>
Signed-off-by: Jacob Hayes <jacob.r.hayes@gmail.com>
Signed-off-by: Jacob Hayes <jacob.r.hayes@gmail.com>
Signed-off-by: Jacob Hayes <jacob.r.hayes@gmail.com>
Signed-off-by: Jacob Hayes <jacob.r.hayes@gmail.com>
Copy link
Member

@JacobHayes JacobHayes left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for working on this! I'm excited to use this very soon for the numpy->pandas type systems!

Comment on lines +406 to +407
# Fix ForwardRefs in outer_type_, pending: https://github.com/samuelcolvin/pydantic/pull/4249
TypeSystem.__fields__["extends"].outer_type_ = tuple[TypeSystem, ...]
Copy link
Member

Choose a reason for hiding this comment

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

FYI: I added this to fix the "runtime type checking" done on inputs to our Models.

@codecov-commenter
Copy link

codecov-commenter commented Jul 19, 2022

Codecov Report

Merging #250 (3fd17b6) into golden (73a9107) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            golden      #250   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           39        39           
  Lines         2450      2448    -2     
  Branches       512       513    +1     
=========================================
- Hits          2450      2448    -2     
Impacted Files Coverage Δ
src/arti/types/__init__.py 100.00% <100.00%> (ø)
src/arti/types/pyarrow.py 100.00% <100.00%> (ø)
src/arti/types/pydantic.py 100.00% <100.00%> (ø)
src/arti/types/python.py 100.00% <100.00%> (ø)

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@JacobHayes JacobHayes merged commit 7bb4100 into artigraph:golden Jul 19, 2022
JacobHayes added a commit that referenced this pull request Jul 19, 2022
Signed-off-by: James Oswald <james.oswald@dynotx.com>

Co-authored-by: Jacob Hayes <jacob.r.hayes@gmail.com>
Signed-off-by: Jacob Hayes <jacob.r.hayes@gmail.com>
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.

Support Extending TypeSystems
3 participants