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

refactor: pydantic lite rewrite #154

Merged
merged 33 commits into from
Feb 10, 2022
Merged

refactor: pydantic lite rewrite #154

merged 33 commits into from
Feb 10, 2022

Conversation

xgui3783
Copy link
Member

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Jan 25, 2022

Codecov Report

Merging #154 (fdc6e56) into main (c9085af) will increase coverage by 13.09%.
The diff coverage is 89.50%.

Impacted file tree graph

@@             Coverage Diff             @@
##             main     #154       +/-   ##
===========================================
+ Coverage   43.46%   56.55%   +13.09%     
===========================================
  Files          31       32        +1     
  Lines        3978     4238      +260     
===========================================
+ Hits         1729     2397      +668     
+ Misses       2249     1841      -408     
Impacted Files Coverage Δ
siibra/core/region.py 65.67% <56.06%> (+15.48%) ⬆️
siibra/commons.py 66.66% <93.75%> (+5.76%) ⬆️
siibra/core/space.py 39.23% <94.11%> (+11.44%) ⬆️
siibra/core/serializable_concept.py 96.96% <96.96%> (ø)
siibra/core/__init__.py 100.00% <100.00%> (ø)
siibra/core/atlas.py 69.90% <100.00%> (+3.59%) ⬆️
siibra/core/concept.py 85.08% <100.00%> (+2.05%) ⬆️
siibra/core/datasets.py 86.73% <100.00%> (+8.95%) ⬆️
siibra/core/parcellation.py 74.76% <100.00%> (+7.74%) ⬆️
siibra/features/connectivity.py 54.63% <100.00%> (+24.92%) ⬆️
... and 21 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c9085af...fdc6e56. Read the comment docs.

@xgui3783 xgui3783 mentioned this pull request Jan 25, 2022
remove unused imports
feat: added ieeg session to jsonable
feat: serialize connectivity feature
chore: add typing to features.query
without called super().__init_subclass__(), other super class's
__init_subclass would not be called. In principle, *arg, **kwarg
should also be added to __init_subclass__ method
chore: add id to connectivity matrix model
chore: update NpArray to allow for kwarg init
@xgui3783 xgui3783 marked this pull request as ready for review February 1, 2022 09:04
@xgui3783 xgui3783 requested review from marcenko and skoehnen February 2, 2022 08:49
@xgui3783
Copy link
Member Author

xgui3783 commented Feb 2, 2022

Dear @marcenko @skoehnen , I have finished the first step of pydantic lite rewrite of siibra-python.

All of the rewrite are additive (they are backwards compatible, and all new features are additive).

I would like to merge this into main ASAP, if you could spare a few minutes reviewing this PR?

@skoehnen
Copy link
Contributor

skoehnen commented Feb 2, 2022

@xgui3783 Changes in 176 files is a bit much, the GitHub diff viewer can't show them all without crashing (at least in Safari, need to check this in another browser).
Is there anything specific I should look out for?
Is there maybe a test I could run locally and check if the output jsons are openMINDS conform?

@xgui3783
Copy link
Member Author

xgui3783 commented Feb 2, 2022

@xgui3783 Changes in 176 files is a bit much, the GitHub diff viewer can't show them all without crashing (at least in Safari, need to check this in another browser)

Most are statically generated pydantic models (in siibra/openminds)

Is there anything specific I should look out for? Is there maybe a test I could run locally and check if the output jsons are openMINDS conform?

I have implemented some tests in test/core/* Unfortunately, mapping some entities to openminds 1-1 is non trivial. So we opted for using an intermediary model.

for example:

import siibra
jba29 = siibra.parcellations['2.9']
jba29_model = jba29.to_model()
list_jba29_vers = [jba29_ver.dict() for jba29_ver in jba29_model.brain_atlas_versions]

the list_jba29_vers should now be an array of dictionaries that conforms to brainAtlasVersion

I will see if I can hide changes to specific directory

@xgui3783
Copy link
Member Author

xgui3783 commented Feb 2, 2022

@skoehnen I added a .gitattribute file, which should hide all files & directories under siibra/openminds by default.

can you let me know if the PR still crashes the browser?

@skoehnen
Copy link
Contributor

skoehnen commented Feb 2, 2022

Weird, how come the tests suddenly fail.

@skoehnen
Copy link
Contributor

skoehnen commented Feb 2, 2022

Looks like a problem in test_receptor_to_model in test_receptors.py

Copy link
Contributor

@skoehnen skoehnen left a comment

Choose a reason for hiding this comment

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

FAILED test/features/test_receptors.py::test_receptor_to_model[receptor57]

Needs to be fixed.

siibra/features/connectivity.py Outdated Show resolved Hide resolved
siibra/features/connectivity.py Outdated Show resolved Hide resolved
fix: np.int and np.float deprecation
@xgui3783
Copy link
Member Author

xgui3783 commented Feb 2, 2022

FAILED test/features/test_receptors.py::test_receptor_to_model[receptor57]

Needs to be fixed.

seems to be sporadically caused by unable to fetch KG metadata. reran the test resolves the issue.

@skoehnen
Copy link
Contributor

skoehnen commented Feb 2, 2022

FAILED test/features/test_receptors.py::test_receptor_to_model[receptor57]
Needs to be fixed.

seems to be sporadically caused by unable to fetch KG metadata. reran the test resolves the issue.

Okay, that is good, at least in the sense that it is not an error on our side ;)
I was a bit worried because there were some changes in that file.

@skoehnen
Copy link
Contributor

skoehnen commented Feb 2, 2022

@skoehnen I added a .gitattribute file, which should hide all files & directories under siibra/openminds by default.

can you let me know if the PR still crashes the browser?

No, it didn't change anything here. But I guess new PRs will not show the generated files.

I fixed it for me by using "Jump To" and looking at specific files and then reloading ;)

@skoehnen
Copy link
Contributor

skoehnen commented Feb 2, 2022

Green across the board, looks good to me.

I will take a deeper look into the generated models and their "openMINDS conformity" when I am finished with the curation migration.

Copy link
Contributor

@marcenko marcenko left a comment

Choose a reason for hiding this comment

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

Seems fine to me

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.

4 participants