-
Notifications
You must be signed in to change notification settings - Fork 216
Add pydantic curation model, improve merging rules, and add splitting model #3760
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
Open
alejoe91
wants to merge
14
commits into
SpikeInterface:main
Choose a base branch
from
alejoe91:curation-pydantic
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
96863de
Add pydantic curation model and improve curation format and merging r…
alejoe91 1ce611c
Update src/spikeinterface/curation/curation_model.py
alejoe91 567b2b7
Merge branch 'curation-pydantic' of github.com:alejoe91/spikeinterfac…
alejoe91 3464987
Move pydantic to core
alejoe91 69c4854
Merge branch 'main' into curation-pydantic
alejoe91 228722c
Merge branch 'main' into curation-pydantic
alejoe91 dbfa315
Refactor curation model to include merges and splits
alejoe91 82526b0
Add merge list to tests
alejoe91 482f0be
Simplify and centralize conversion and checks
alejoe91 f122db7
Fix sortingview tests
alejoe91 4f14e90
Fix sortingview conversion
alejoe91 d7633bf
Merge branch 'main' into curation-pydantic
alejoe91 317f87c
merge_new_unit_ids -> merge_new_unit_id
alejoe91 a9ed838
Merge branch 'curation-pydantic' of github.com:alejoe91/spikeinterfac…
alejoe91 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ dependencies = [ | |
"neo>=0.14.0", | ||
"probeinterface>=0.2.23", | ||
"packaging", | ||
"pydantic", | ||
] | ||
|
||
[build-system] | ||
|
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One general question that will matter for typing going forward. We have been moving toward doing:
"append" | "new"
for typing but type analysis programs don't like this so I assume pydantic won't either.str
however is not accurate either because it doesn't expect any string, but specific strings. So in this case should we move the library over toLiteral['append' | 'new']
I forget the actual argument so 'new' was me just making something up for example.
Or does pydantic only accept
str
and doesn't acceptLiteral
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think pydantic only accepts
Literal
.Why ""append" | "new" for typing but type analysis programs don't like this"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know. On vscode I only get a warning saying that the type "append" | "new" are not defined. And others (I think Heberto) have commented about why not use Literal['append' | 'new'] so maybe he is seeing the typing warning too. I just want to make sure we fit in the pydantic model but also be useful to the end user. Saying
str
is not useful to the end-user that uses type hints because it is actually a Literal. I think adding Literal clutters stuff, but if we are now relying on a tool that expects Literal then we have to use it and we should move the whole code base in that direction for consistency.I think the static type analysis programs think that "append" should be a type because we are not specifying it is a literal. So although python allows it, I think static type checkers don't know what to do with it. It is a little similar to the
Optional
,optional
debate in type hinting in python.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I think using
"append" | "new"
is not supported...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is exactly what I'm saying!
I prefer it, but it is not supported. So we need to switch! I don't want us to switch to
str
I want us to switch toLiteral
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it! That makes sense to me :)