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

update the dependency and temporal filter for python_cmr 0.10.0 #520

Closed
wants to merge 11 commits into from

Conversation

itcarroll
Copy link
Collaborator

@itcarroll itcarroll commented Apr 12, 2024

Version 0.10.0 of the python_cmr package correctly handles a broader range of date-like inputs for the temporal filters, due to our input via nasa/python_cmr#30. This PR increments our version dependency, strips our own preprocessing of date-like inputs, and modifies tests accordingly.

Fixes #190
Fixes #330


📚 Documentation preview 📚: https://earthaccess--520.org.readthedocs.build/en/520/

@itcarroll itcarroll marked this pull request as ready for review April 15, 2024 14:57
@itcarroll
Copy link
Collaborator Author

Hmm... make format lint is not catching whatever is breaking here.

Copy link
Collaborator

@mfisher87 mfisher87 left a comment

Choose a reason for hiding this comment

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

LGTM!

earthaccess/search.py Show resolved Hide resolved
jhkennedy
jhkennedy previously approved these changes Apr 19, 2024
Copy link
Collaborator

@jhkennedy jhkennedy left a comment

Choose a reason for hiding this comment

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

LGTM! Approving with some take-or-leave comments.

Comment on lines +312 to +313
date_from: Optional[Union[str, dt.date]] = None,
date_to: Optional[Union[str, dt.date]] = None,
Copy link
Collaborator

@jhkennedy jhkennedy Apr 19, 2024

Choose a reason for hiding this comment

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

Suggested change
date_from: Optional[Union[str, dt.date]] = None,
date_to: Optional[Union[str, dt.date]] = None,
date_from: Optional[Union[str, dt.date, dt.datetime]] = None,
date_to: Optional[Union[str, dt.date, dt.datetime]] = None,

I know it's not necessary or even correct since datetime is a subclass of date, but I think from a documentation standpoint this will be clearer to users.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Currently the type hint does not effect the documentation, because the docstring includes a "type". Do you want that part removed from the docstring?

If type hints are being included to help developers, then I would want them to be technically correct. If type hints are being included to help users ... well, I fell like that's a little lazy actually. Users don't benefit a whole lot from "dt.date" without knowing what "dt" is. And do they know what "Optional[Union[...]]" means? Relying on auto documentation is nice ... if it's good documentation.

You are welcome to modify however you think its best.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Personally, when type annotations are provided, I drop type information from the docstrings. Otherwise, it's all too easy for the docstrings to become out of sync with the type annotations, leading to confusion, misinformation, and frustration. Modern doc generators, including mkdocs, will make use of the type annotations to put such information in the docs. Doc generators should also use canonical names for things as well, meaning that even though the code may refer to the datetime module as dt, the docs will show the name datetime, so there's no need for the reader to know about any aliasing within the code.

Comment on lines +608 to +609
date_from: Optional[Union[str, dt.date]] = None,
date_to: Optional[Union[str, dt.date]] = None,
Copy link
Collaborator

@jhkennedy jhkennedy Apr 19, 2024

Choose a reason for hiding this comment

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

Suggested change
date_from: Optional[Union[str, dt.date]] = None,
date_to: Optional[Union[str, dt.date]] = None,
date_from: Optional[Union[str, dt.date, dt.datetime]] = None,
date_to: Optional[Union[str, dt.date, dt.datetime]] = None,

tests/unit/test_collection_queries.py Show resolved Hide resolved
mfisher87
mfisher87 previously approved these changes Apr 19, 2024
Copy link
Collaborator

@mfisher87 mfisher87 left a comment

Choose a reason for hiding this comment

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

Woops thought I approved before but looks like I accidentally selected "comment"!

@chuckwondo
Copy link
Collaborator

@itcarroll, in addition to addressing @jhkennedy's comments, you'll need to resolve conflicts coming from the main branch.

@itcarroll itcarroll dismissed stale reviews from mfisher87 and jhkennedy via 977231b April 19, 2024 23:36
@chuckwondo
Copy link
Collaborator

@itcarroll, let's schedule a pairing session so I can help you sort out the build failures you're encountering. Regarding the vcrpy failures, it might behoove us to wait for @doug-newman-nasa's PR (#528) to land beforehand, so you don't accidentally commit an access token like I did.

@chuckwondo
Copy link
Collaborator

@itcarroll, I just merged @doug-newman-nasa's PR for #528, so I'm going to pick up this PR now to iron out the kinks.

@chuckwondo
Copy link
Collaborator

@itcarroll, I see that you added lxml-html-clean as a dev dependency, but I don't see any reference to it in the code, nor in any docs, unless I'm missing something. What did you add it for?

@itcarroll
Copy link
Collaborator Author

Darn, I meant to leave a comment on that and now I can't find the relevant issue. Roughly ....

When I updated poetry.lock for python-cmr 0.10, an update to lxml caused document generation to fail. The nbconvert we are pinned to by mkdocs-jupyter seemed unlikely to be updated to express a new version constraint on lxml. Since it's only a dev dependency, I hoped a direct import would be an acceptable solution.

@chuckwondo
Copy link
Collaborator

No worries. That's sufficient explanation. Thanks!

@chuckwondo
Copy link
Collaborator

@itcarroll, please take a look at #546

That's the PR I just submitted based upon your original PR. I removed the lxml-html-clean dep because I simply reduced the changes to poetry.lock to avoid the issue.

Let me know if everything looks good. If so, then I'll have you close your PR.

@itcarroll
Copy link
Collaborator Author

Thank you very much @chuckwondo, looks great. Please proceed!

@itcarroll itcarroll closed this Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants