Skip to content

Comments

Add TypeAdapter.matches_* methods and expand tests#64

Merged
mikss merged 1 commit intotrivial_artifactfrom
type-system-v2
Jul 21, 2021
Merged

Add TypeAdapter.matches_* methods and expand tests#64
mikss merged 1 commit intotrivial_artifactfrom
type-system-v2

Conversation

@JacobHayes
Copy link
Member

@JacobHayes JacobHayes commented Jul 21, 2021

The TypeAdapter matching will need to be a bit more robust/dynamic to support different systems, eg:

  • google.cloud.bigquery: types are specified within the field_type instance attribute of a SchemaField class
  • pyarror: types each have a specific class, which users instantiate to configure
  • python: types are singletons, each an instance of type

To support these different approaches, I extended TypeAdapter to add extra matches_{artigraph,system} methods that can be overridden a bit more easily. For TypeSystem(key="python") specifically, I added a _SingletonTypeAdapter and a class generator to ease expanding the simple types (without required arguments, eg: Int32). I'm not sure how well those helpers will generalize, so put them into types/python.py specifically for now.

I also tried to fix some of the dissonance w/ the conversion method names between TypeAdapter and TypeSystem

Follow up from: #58 (review)

@JacobHayes JacobHayes self-assigned this Jul 21, 2021
@JacobHayes JacobHayes requested a review from mikss July 21, 2021 04:37
Copy link
Contributor

@mikss mikss left a comment

Choose a reason for hiding this comment

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

Thanks, this makes sense to me.

I like the renaming from internal/external/core to artigraph/system.

@mikss mikss merged commit cd7edd2 into trivial_artifact Jul 21, 2021
@mikss mikss deleted the type-system-v2 branch July 21, 2021 13:32
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.

2 participants