-
Notifications
You must be signed in to change notification settings - Fork 30
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
Start refactoring project #259
Conversation
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 have started work on the refactoring project. This PR creates the
core
subpackage and moves theurl_handling
andnetcdf_handling
modules to that. I was thinking of first consolidating the module/directory structure and then moving on to making the code changes.I was unsure of whether the
erddapy
module should go inside thecore
subpackage. From my understanding, we are eventually going to get rid of theERDDAP
class in favour of the new classes in the object layer (or maybe keep it for backwards-compatibility?). Should other functions in that module (e.g._search_url
,parse_dates
, etc.) be moved into a separate module of thecore
subpackage?
I think we should keep the existing ERDDAP
class and the erddapy
module at their current locations for backwards compatibility (eventually with some deprecation warnings). Most of the functions and methods in there should become wrappers around various things in core
.
The same goes for the server modules (
servers.py
,multiple_server_search.py
and theerddaps.json
file). Should those go intocore
or into a subpackage of their own?
Hmm, good question. I think we'll probably end up with new, more opinionated multiple server search for the object layer, but the result wrangling will probably be shared. Maybe core/search_result.py
when those guts get refactored out, with the existing multiple_server_search.py
left in place for compatibility. I'll have to ponder more on servers.py
and erddaps.json
since those are small but combine fetching and wrangling, but are still really helper functions, unless @ocefpaf has some ideas.
Lastly, should we create a
refactor
orlayer-refactoring
branch to merge this PR into?
A refactor
branch should do the trick.
Thank you for your comments @abkfenris. I noticed that checks passed now after failing on the multiple server search. I will work on #258 along with the refactoring and hopefully that will prevent randomly failed tests in the future. |
As we discussed in our meeting that is mostly to check the awesome erddap json server list and create the shortcuts to the servers. We will create a package based on the RAs, see #257, and having those into their own sub-module will be useful in the near future. |
After force-pushing to fix a line-break, the test failed again, so I'm thinking it's probably best to work on #258 before merging this one (I will mark it as a draft until then). |
I'm hoping that the failing check will pass after merging #260. |
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
I added more changes to this branch, but if it's too much, I can reset it and wait for it to be merged before submitting a separate PR. Summary of changes
|
There is a certain degree of repetition for an explicit import of the |
I just realised that users doing |
This is probably better. |
Would it be better to create the |
I'm not sure why the test for multiple server search fails (apparently) randomly. Should we replace it with a VCR response? |
I could not make VRCs work for that test. I don't remember why. Maybe it was the pytest parameters? They may work if we split them up.
I prefer main to avoid a huge merge from a refactor branch into main later. |
I'll look into it, but split what up, exactly? |
I'm guessing with multi-server search VCR was probably having a hard time matching request to response. It might need a custom request matcher |
- Create erddapy/core subpackage - Move module 'url_handling' to core subpackage - Refactor imports
- Move module to subpackage - Refactor imports
- Move helper functions from multiple_server_search.py to core/url_handling.py These functions may be reutilised in the future so they will be moved to the url module. The '_format_results' function was kept in place to avoid a pandas import in the url module.
- Move module 'servers.py' to new directory - Move file 'erddaps.json' to new directory - Add __init__ module - Refactor imports (in erddapy.__init__ and erddapy.erddapy)
This allows importing the servers dict with 'from erddapy.servers import servers'
Hi,
I have started work on the refactoring project. This PR creates the
core
subpackage and moves theurl_handling
andnetcdf_handling
modules to that. I was thinking of first consolidating the module/directory structure and then moving on to making the code changes.I was unsure of whether the
erddapy
module should go inside thecore
subpackage. From my understanding, we are eventually going to get rid of theERDDAP
class in favour of the new classes in the object layer (or maybe keep it for backwards-compatibility?). Should other functions in that module (e.g._search_url
,parse_dates
, etc.) be moved into a separate module of thecore
subpackage?The same goes for the server modules (
servers.py
,multiple_server_search.py
and theerddaps.json
file). Should those go intocore
or into a subpackage of their own?Lastly, should we create a
refactor
orlayer-refactoring
branch to merge this PR into?Please let me know what you think.
Thank you,
Vini
Summary of changes
core
subpackageurl_handling
andnetcdf_handling
to new subpackage