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

Use ZoneInfo instead of dateutil to handle time zones. #2027

Open
h-mayorquin opened this issue Jan 28, 2025 · 3 comments
Open

Use ZoneInfo instead of dateutil to handle time zones. #2027

h-mayorquin opened this issue Jan 28, 2025 · 3 comments
Labels
category: enhancement improvements of code or code behavior help wanted: good first issue request for community contributions that are good for new contributors
Milestone

Comments

@h-mayorquin
Copy link
Contributor

Now that python 3.9 is minimal have you considered using ZoneInfo from the standard library instead of dateutil?

https://docs.python.org/3/library/zoneinfo.html

Eventually, you can eliminate another dependency and also there might be undesirable inconsistencies between the standard library approach and other libraries that would be good to avoid.

@h-mayorquin h-mayorquin changed the title Use ZoneInfo instead of dateuti to handle time zones. Use ZoneInfo instead of dateutil to handle time zones. Jan 28, 2025
@rly
Copy link
Contributor

rly commented Jan 28, 2025

I support this.

@oruebel
Copy link
Contributor

oruebel commented Jan 28, 2025

According to the ZoneInfo docs, one issue we may need to consider is

"This module does not work or is not available on WebAssembly. See WebAssembly platforms for more information."

Not sure which packages use h5wasm, but we may need a fallback import for that case.

@rly
Copy link
Contributor

rly commented Jan 29, 2025

Also worth noting from the zoneinfo docs:

The zoneinfo module does not directly provide time zone data, and instead pulls time zone information from the system time zone database or the first-party PyPI package tzdata, if available. Some systems, including notably Windows systems, do not have an IANA database available, and so for projects targeting cross-platform compatibility that require time zone data, it is recommended to declare a dependency on tzdata. If neither system data nor tzdata are available, all calls to ZoneInfo will raise ZoneInfoNotFoundError.

PyNWB does not really use timezone data except in tests, docs, and a couple places in the core code that could be replaced with datetime methods nowadays, I believe.

@rly rly added category: enhancement improvements of code or code behavior help wanted: good first issue request for community contributions that are good for new contributors labels Jan 29, 2025
@rly rly added this to the Future milestone Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: enhancement improvements of code or code behavior help wanted: good first issue request for community contributions that are good for new contributors
Projects
None yet
Development

No branches or pull requests

3 participants