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

Changes and updates for metadata search #29

Merged
merged 13 commits into from
Feb 27, 2024
Merged

Conversation

jgrethe
Copy link
Contributor

@jgrethe jgrethe commented Nov 30, 2023

This is done in via a fork of the main branch and with a run of formatters. Discarded formatting changes for files that were not originally changed for the metadata services.

This is done in a fork and with run of formatters
@jgrethe jgrethe requested a review from athril November 30, 2023 21:25
@jgrethe
Copy link
Contributor Author

jgrethe commented Nov 30, 2023

@athril I think this looks good - all checks passed.

@athril athril changed the title Changes and updates for metadata serach Changes and updates for metadata search Nov 30, 2023
athril
athril previously requested changes Nov 30, 2023
Copy link
Collaborator

@athril athril left a comment

Choose a reason for hiding this comment

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

  1. I am wondering if changing docs/examples_metadata.py into a jupyter notebook tutorial won't make more sense. That way we could have a module specific tutorial.
  2. A couple of remarks regarding the code.

config/config.ini Outdated Show resolved Hide resolved
docs/examples_metadata.py Outdated Show resolved Hide resolved
docs/examples_metadata.py Outdated Show resolved Hide resolved
docs/examples_metadata.py Outdated Show resolved Hide resolved
docs/examples_metadata.py Outdated Show resolved Hide resolved
docs/examples_metadata.py Outdated Show resolved Hide resolved
src/sparc/client/services/metadata.py Outdated Show resolved Hide resolved
src/sparc/client/services/metadata.py Outdated Show resolved Hide resolved
src/sparc/client/services/metadata.py Outdated Show resolved Hide resolved
src/sparc/client/services/metadata.py Outdated Show resolved Hide resolved
@jgrethe
Copy link
Contributor Author

jgrethe commented Dec 1, 2023

@athril Went through the comments. Some things can be included in future releases. We can setup tickets for those things (e.g. Jupyter notebook, etc). But that should not hold up this version.

@jgrethe jgrethe dismissed athril’s stale review December 1, 2023 00:43

New feature request (Jupyter notebook) added as new ticket. Can be included in future update.

@jgrethe
Copy link
Contributor Author

jgrethe commented Dec 1, 2023

@athril Went through your review. Replied to your comments and also added ticket for future features (e.g. Jupyter notebook). Most of comments were about the examples file and that should stay as is as per the comments. Also had some comments about setting URL (also answered in comments) and about the getURL function (works now - so any updates/improvements can be added in future updates).

@athril athril requested review from nickerso and hsorby December 1, 2023 17:51
Copy link
Contributor

@hsorby hsorby left a comment

Choose a reason for hiding this comment

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

The changes requested by @athril and myself should be made now. This PR is incomplete without them.

docs/examples_metadata.py Outdated Show resolved Hide resolved
src/sparc/client/services/metadata.py Outdated Show resolved Hide resolved
src/sparc/client/services/metadata.py Outdated Show resolved Hide resolved
src/sparc/client/services/metadata.py Outdated Show resolved Hide resolved
@jgrethe
Copy link
Contributor Author

jgrethe commented Dec 6, 2023

@athril @hsorby Python notebook added based on README.io tutorial so that they match. Also made suggested change to the metadata client and placed URIs into init. Removed the example python file as this is now in a notebook - so all comments on the file are not applicable anymore

@jgrethe jgrethe requested a review from hsorby December 6, 2023 19:55
src/sparc/client/services/metadata.py Outdated Show resolved Hide resolved
src/sparc/client/services/metadata.py Outdated Show resolved Hide resolved
src/sparc/client/services/metadata.py Outdated Show resolved Hide resolved
src/sparc/client/services/metadata.py Outdated Show resolved Hide resolved
@jgrethe jgrethe requested a review from hsorby December 12, 2023 19:33
@jgrethe
Copy link
Contributor Author

jgrethe commented Dec 12, 2023

@hsorby All changes suggested from last review have been committed

Copy link
Contributor

@hsorby hsorby left a comment

Choose a reason for hiding this comment

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

Some more minor edits. Plus there are a few formatting warnings reported by reviewdog that need to be addressed.

src/sparc/client/services/metadata.py Outdated Show resolved Hide resolved
src/sparc/client/services/metadata.py Outdated Show resolved Hide resolved
src/sparc/client/services/metadata.py Outdated Show resolved Hide resolved
src/sparc/client/services/metadata.py Outdated Show resolved Hide resolved
@jgrethe jgrethe requested a review from hsorby January 16, 2024 00:28
hsorby
hsorby previously approved these changes Jan 23, 2024
nickerso
nickerso previously approved these changes Jan 23, 2024
Copy link
Collaborator

@athril athril left a comment

Choose a reason for hiding this comment

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

Thank you for your updates @jgrethe !

Could you possibly verify if the code passes tests and has 100% code coverage?

You could check it by running from console:

PYTHONPATH=src                                                                                                                                                                                                    
pytest --cov=./src tests/      

I ran it on linux and it seems to me that merging this pull request would break our code base (fail a couple of test_zinc.py tests). The reason we haven't noticed it is because CI.yml was not run on subsequent commits to the pull request. This will hopefully be fixed in #37.

---------- coverage: platform linux, python 3.10.12-final-0 ----------
Name                                     Stmts   Miss  Cover                                                          
------------------------------------------------------------                                                          
src/sparc/__init__.py                        3      0   100%                                                          
src/sparc/client/__init__.py                 2      0   100%                                                          
src/sparc/client/client.py                  47      0   100%                                                          
src/sparc/client/services/__init__.py       13      0   100%                                                          
src/sparc/client/services/_default.py       15      0   100%                                                          
src/sparc/client/services/metadata.py      105     74    30%                                                          
src/sparc/client/services/o2sparc.py        97      0   100%                                                          
src/sparc/client/services/pennsieve.py      67      0   100%                                                          
src/sparc/client/zinchelper.py             112     28    75%                                                          
------------------------------------------------------------                                                          
TOTAL                                      461    102    78%       


=============================================== short test summary info ================================================
FAILED tests/test_zinc.py::test_export_scaffold_into_vtk_format - TypeError: 'NoneType' object is not subscriptable 
FAILED tests/test_zinc.py::test_export_scaffold_into_stl_format - TypeError: 'NoneType' object is not subscriptable   
FAILED tests/test_zinc.py::test_export_scaffold_into_vtk_format_with_default_output_location - TypeError: 'NoneType' object is not subscriptable 
FAILED tests/test_zinc.py::test_export_mbf_to_vtk - TypeError: 'NoneType' object is not subscriptable                 
FAILED tests/test_zinc.py::test_export_mbf_to_vtk_with_default_output_name - TypeError: 'NoneType' object is not subscriptable  
5 failed, 41 passed, 14 warnings in 6.77s  

docs/examples_metadata.py Outdated Show resolved Hide resolved
@athril
Copy link
Collaborator

athril commented Jan 24, 2024

It seems that tests/test_zinc.py issues may not be related to your pull request.
Still there seem to be no tests included in this pull request.

@jgrethe
Copy link
Contributor Author

jgrethe commented Jan 24, 2024

@athril We have local tests we run with an API key (not to be shared via Github). Where can such a private key for the configuration file be placed (where it is not made public)?

@athril
Copy link
Collaborator

athril commented Jan 25, 2024

@athril We have local tests we run with an API key (not to be shared via Github). Where can such a private key for the configuration file be placed (where it is not made public)?

Is there a chance to cover the code on Github, @jgrethe? I would rather avoid API calls if not absolutely necessary.

You could potentially mock some of the functions as @pytest.fixtures, e.g.:
https://github.com/nih-sparc/sparc.client/blob/87c7056e7bd5870ed9e758b3038804f1c6afae49/tests/conftest.py#L23C1-L37C31

Basically you define what should be returned by a mocked function and then call them directly from the test, e.g.:

def test_get_profile(mocker, mock_pennsieve, mock_user):
expected = "user"
mocker.patch("pennsieve2.Pennsieve.get_user", mock_user.get_user)
mock_user.set_user("user")
p = PennsieveService(connect=False)
actual = p.get_profile()
assert actual == expected

If there is no workaround, we could create an access token in the repository secrets, but this would be the last resort.

@jgrethe jgrethe dismissed stale reviews from nickerso and hsorby via 9acb333 February 15, 2024 21:27
@nih-sparc nih-sparc deleted a comment from codecov bot Feb 16, 2024
Copy link

codecov bot commented Feb 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (70c6b11) 99.71% compared to head (fe1dad9) 100.00%.
Report is 31 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main       #29      +/-   ##
===========================================
+ Coverage   99.71%   100.00%   +0.28%     
===========================================
  Files           8         9       +1     
  Lines         356       446      +90     
===========================================
+ Hits          355       446      +91     
+ Misses          1         0       -1     
Flag Coverage Δ
unittests 100.00% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jgrethe jgrethe requested a review from athril February 16, 2024 04:20
@jgrethe
Copy link
Contributor Author

jgrethe commented Feb 16, 2024

@athril I checked in the pytests for metadata. The URL handling was also streamlined a bit and an additional check was added to the list and search methods if the user changes the default URL

@jgrethe
Copy link
Contributor Author

jgrethe commented Feb 21, 2024

Hi @athril - any updates on the updates above?

Copy link
Collaborator

@athril athril left a comment

Choose a reason for hiding this comment

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

Looks good to me

@athril athril merged commit e39a579 into nih-sparc:main Feb 27, 2024
6 checks passed
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