potiuk commented on code in PR #58888:
URL: https://github.com/apache/airflow/pull/58888#discussion_r2578947772


##########
shared/timezones/src/airflow_shared/timezones/timezone.py:
##########
@@ -305,3 +295,14 @@ def from_timestamp(timestamp: int | float, tz: str | 
FixedTimezone | Timezone =
             tz = local_timezone()
         result = result.in_timezone(tz)
     return result
+
+
+try:

Review Comment:
   I think thire is a better way. IMHO much simpler solution.
   
   You could define a method (say `initialize(default_timezone: str)`) where 
you should pass the default timezone. And fail if default_timezone is not 
initialized and you need it.
   
   This way `initialize(default_timezone)` will have to be called in order to 
use those methods in the user:
   
   Somewhere in `airflow-core`:
   
   ```python
   timezone.initialize(conf.get_mandatory_value("core", "default_timezone"))
   ```
   
   That has only benefits: 
   
   * timezone becomes fully independent from configuration
   * it's way simpler
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to