Repository navigation
feat: refactor from_source handling - #1169
Merged
Merged
Conversation
Oisin-M
marked this pull request as ready for review
September 24, 2026 14:08
…' from from_source
Oisin-M
force-pushed
the
refactor/source_handling
branch
from
September 29, 2026 11:46
0c3efac to
73e23fd
Compare
Contributor
Author
|
Failing tests are unrelated to this PR and also failing on current develop. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Related to #1097 #162. Diff is quite large, so apologies for that...
PR aims to refactor and simplify the
from_sourcehandling, and to allow us to properly type things. Everything is backwards compatible for now, but in future we could easily drop**kwargsfrom_from_fileetc. and have things typed properly.Steps
from_source_from_fileetc.SourceMaker,SourceLoader,_from_sourceetc. since they will no longer be requiredfrom_source("dummy-source"etc.. Tests now use_from_dummy_source, but users/code agents etc. can no longer "discover" hidden sources(subsequent PR: #1170)
"earthkit.data.readers"where should just link to a matching functiondef reader(source, path, *, magic=None, deeper_check=False, content_type=None, **kwargs):Tradeoff:
This does mean that now adding new sources in earthkit-data is a little more work. You would need to add the source as before, but then also add a
_from_new_sourcemethod (so we know the valid kwargs!), and then do the (one-line) plumbing to the mainfrom_sourcemethod. I think this is worth the effort.Contributor Declaration
By opening this pull request, I affirm the following: