-
Notifications
You must be signed in to change notification settings - Fork 122
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
Add helper methods for RFC 3339 datetime handling #760
Add helper methods for RFC 3339 datetime handling #760
Conversation
Codecov ReportBase: 90.21% // Head: 90.21% // Increases project coverage by
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more Additional details and impacted files@@ Coverage Diff @@
## main #760 +/- ##
=======================================
Coverage 90.21% 90.21%
=======================================
Files 47 47
Lines 6090 6094 +4
Branches 915 915
=======================================
+ Hits 5494 5498 +4
Misses 414 414
Partials 182 182
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
It may be more appropriate to put str_to_interval in stac-fastapi, since the datetime interval format is only used by query parameters. |
looks like i need to write some stubs for ciso8601 |
@philvarner I think it would also be fine to just ignore these in the |
Okay, I'll do that. Weird thing is that it looks like ciso8601 has stubs defined. I haven't used mypy that much, so I don't really know how the stubs are supposed to be resolved, etc. |
Yeah, that is peculiar. I'll look into this a bit more and see if there is a better way to solve this besides ignoring the import. |
I needed to add it to the requirements-test.txt and setup.py validation requirements. |
I'd be happy with a change to pytest personally; however I wonder if that should be a larger PR that does a wholesale conversion rather than have multiple testing frameworks in the test. You could use a pystac/tests/validation/test_validate.py Lines 39 to 40 in 0426bd1
As it stands there's not a change to |
I made some changes, so I need someone else to review.
e7a4d0d
to
bab2f10
Compare
Includes some extensive tests. Co-authored-by: Pete Gadomski <[email protected]>
bab2f10
to
8382193
Compare
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.
Looks good to me.
Got this merged in just under a year! |
Related Issue(s): n/a
Description:
There are a number of places in the STAC ecosystem where datetimes are converted two and from RFC 3339 strings. Many of these places are doing this incorrectly. These changes aim to add a correct implementations to:
My primary motivation is to replace the numerous uses of the stac_pydantic constant
DATETIME_RFC339
(sic) with uses of these methods. Other libraries that depend on pystac will also use them, and there are likely several places even within pystac that these could be used instead of the current code.One downside to this is that the tests need the pytest parameterized decorator to run, and this doesn't work in the class-based test modules that unittest requires. I ran the existing tests with pytest and it seems to run them all fine, so we could change to using pytest to run the test without needing to convert all the tests from unittest to pytest.
PR Checklist:
pre-commit run --all-files
)scripts/test
)