-
Notifications
You must be signed in to change notification settings - Fork 279
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
Remove dependency on the Pytz library #949
Conversation
…r Python version 3.10 or beyond (although not material to the issue solved in this branch)
(pulled latest upstream changes)
Thanks @spillner for updating the pull request. I'm +1 on merging once that is in place. |
Tested the branch locally - all working as expected: >>> import pytz
>>> from datetime import datetime, timedelta
>>> dt = datetime.utcnow()
>>> dt.replace(tzinfo=pytz.utc)
datetime.datetime(2024, 10, 8, 10, 7, 59, 167706, tzinfo=<UTC>)
>>> from owslib.util import TimeZone_UTC
>>> datetime.utcnow().replace(tzinfo=TimeZone_UTC())
datetime.datetime(2024, 10, 8, 10, 9, 31, 262084, tzinfo=<owslib.util.TimeZone_UTC object at 0x0000015D9D187CD0>) |
…e.utc. This drops support for Python 3.8 and earlier, but OWSLib now targets 3.10 and later.
Added two unit tests, one for datetime normalization as a standalone operation, and one for proper operation of extract_time() as a whole. I also took advantage of the shift to 3.10 and newer to drop the TimeZone_UTC class in favor of the standard datetime.timezone.utc. If anyone needs to restore support for 3.8 and earlier, you could just roll back the very last commit in this series. |
@spillner - thanks very much for this. Removing a dependency and being able to use the standard library is excellent. |
Pytz no longer supports the latest Python releases, and not much of it was actually used by OWSLib anyway.
Recreated the previous PR #921 to permit branching my source repository, to better manage the rebase and elide false-positive merge conflicts reported by GitHub.