Is it possible to skip the resource load for every timezone? It can make import time super high and shouldn't be necessary on systems where you know what you're getting during install

Asked by Timothy Paine

In __init__.py, the line:

all_timezones = LazyList(tz for tz in all_timezones if resource_exists(tz))

causes all timezone files to be opened (in the resource_exists function). This is fine in many cases, but when we deploy pytz to network drives, it makes the import cost pretty high. And since we're not installing pytz on-the-fly, we already know that all the timezone files are present. Is it possible to either:

a. disable this check with an environment variable, or
b. use something like os.listdir to check if stuff is present?

I have implemented (a) on my branch, I'm going to send it in for a review. Happy to discuss further and do any work necessary to fix the underlying issue.

Question information

Language:
English Edit question
Status:
Expired
For:
pytz Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Launchpad Janitor (janitor) said :
#1

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Stuart Bishop (stub) said :
#2

Should be possible to optionally avoid it, and maybe optimize it. Will discuss on the submitted proposal.