flyte 2.0.0b26__py3-none-any.whl → 2.0.0b28__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of flyte might be problematic. Click here for more details.

@@ -193,10 +193,10 @@ def list_all_files(source_path: pathlib.Path, deref_symlinks, ignore_group: Opti
193
193
  def _file_is_in_directory(file: str, directory: str) -> bool:
194
194
  """Return True if file is in directory and in its children."""
195
195
  try:
196
- return os.path.commonpath([file, directory]) == directory
197
- except ValueError as e:
198
- # ValueError is raised by windows if the paths are not from the same drive
199
- logger.debug(f"{file} and {directory} are not in the same drive: {e!s}")
196
+ return pathlib.Path(file).resolve().is_relative_to(pathlib.Path(directory).resolve())
197
+ except OSError as e:
198
+ # OSError can be raised if paths cannot be resolved (permissions, broken symlinks, etc.)
199
+ logger.debug(f"Failed to resolve paths for {file} and {directory}: {e!s}")
200
200
  return False
201
201
 
202
202
 
@@ -104,7 +104,7 @@ async def build_pkl_bundle(
104
104
  import shutil
105
105
 
106
106
  # Copy the bundle to the given path
107
- shutil.copy(dest, copy_bundle_to)
107
+ shutil.copy(dest, copy_bundle_to, follow_symlinks=True)
108
108
  local_path = copy_bundle_to / dest.name
109
109
  return CodeBundle(pkl=str(local_path), computed_version=str_digest)
110
110
  return CodeBundle(pkl=str(dest), computed_version=str_digest)
@@ -12,7 +12,7 @@ from flyte import Cron, FixedRate, Trigger, TriggerTime
12
12
  def _to_schedule(m: Union[Cron, FixedRate], kickoff_arg_name: str | None = None) -> common_pb2.Schedule:
13
13
  if isinstance(m, Cron):
14
14
  return common_pb2.Schedule(
15
- cron_expression=m.expression,
15
+ cron_expression=m.timezone_expression,
16
16
  kickoff_time_input_arg=kickoff_arg_name,
17
17
  )
18
18
  elif isinstance(m, FixedRate):
flyte/_trigger.py CHANGED
@@ -2,10 +2,611 @@ from __future__ import annotations
2
2
 
3
3
  from dataclasses import dataclass
4
4
  from datetime import datetime
5
- from typing import Any, Dict, Mapping, Union
5
+ from typing import Any, Dict, Literal, Mapping, Union
6
6
 
7
7
  import rich.repr
8
8
 
9
+ Timezone = Literal[
10
+ "Etc/GMT-5",
11
+ "Europe/London",
12
+ "America/Martinique",
13
+ "Asia/Sakhalin",
14
+ "Europe/Podgorica",
15
+ "America/Grand_Turk",
16
+ "America/Dawson_Creek",
17
+ "Africa/Asmera",
18
+ "Canada/Newfoundland",
19
+ "CST6CDT",
20
+ "ROC",
21
+ "Asia/Taipei",
22
+ "America/Danmarkshavn",
23
+ "Asia/Yakutsk",
24
+ "America/Catamarca",
25
+ "Asia/Gaza",
26
+ "America/Chihuahua",
27
+ "Africa/Lusaka",
28
+ "Atlantic/Azores",
29
+ "Canada/Atlantic",
30
+ "Africa/Abidjan",
31
+ "America/Port-au-Prince",
32
+ "Pacific/Noumea",
33
+ "Asia/Barnaul",
34
+ "Europe/Bucharest",
35
+ "Asia/Samarkand",
36
+ "Africa/Bangui",
37
+ "America/Yakutat",
38
+ "Africa/Porto-Novo",
39
+ "Etc/GMT+12",
40
+ "America/Fortaleza",
41
+ "Australia/Brisbane",
42
+ "America/Goose_Bay",
43
+ "America/Nassau",
44
+ "Arctic/Longyearbyen",
45
+ "Asia/Kolkata",
46
+ "Indian/Mayotte",
47
+ "Asia/Tel_Aviv",
48
+ "America/Cambridge_Bay",
49
+ "Africa/Nouakchott",
50
+ "Australia/North",
51
+ "Europe/Tirane",
52
+ "America/Ensenada",
53
+ "Asia/Rangoon",
54
+ "Pacific/Kanton",
55
+ "Africa/Tunis",
56
+ "Europe/Kyiv",
57
+ "America/Halifax",
58
+ "Europe/Guernsey",
59
+ "America/Cancun",
60
+ "Canada/Saskatchewan",
61
+ "Europe/Helsinki",
62
+ "Pacific/Norfolk",
63
+ "Chile/Continental",
64
+ "Eire",
65
+ "Africa/Mogadishu",
66
+ "Pacific/Midway",
67
+ "Etc/GMT-1",
68
+ "Etc/UTC",
69
+ "America/Argentina/San_Luis",
70
+ "Europe/Gibraltar",
71
+ "GMT+0",
72
+ "HST",
73
+ "America/Kentucky/Louisville",
74
+ "US/Alaska",
75
+ "Africa/Addis_Ababa",
76
+ "America/Costa_Rica",
77
+ "Pacific/Rarotonga",
78
+ "America/Matamoros",
79
+ "Europe/Vienna",
80
+ "America/Vancouver",
81
+ "Mexico/BajaNorte",
82
+ "America/Merida",
83
+ "Pacific/Efate",
84
+ "America/La_Paz",
85
+ "Pacific/Marquesas",
86
+ "America/Manaus",
87
+ "Antarctica/South_Pole",
88
+ "Pacific/Easter",
89
+ "Europe/Mariehamn",
90
+ "Atlantic/Madeira",
91
+ "Pacific/Bougainville",
92
+ "Antarctica/Syowa",
93
+ "America/Montevideo",
94
+ "Africa/Khartoum",
95
+ "America/St_Thomas",
96
+ "Africa/Mbabane",
97
+ "America/Campo_Grande",
98
+ "Australia/Queensland",
99
+ "Asia/Damascus",
100
+ "Etc/Universal",
101
+ "Asia/Amman",
102
+ "Europe/Samara",
103
+ "Australia/Tasmania",
104
+ "Africa/Douala",
105
+ "Indian/Antananarivo",
106
+ "Canada/Eastern",
107
+ "America/Argentina/Rio_Gallegos",
108
+ "Pacific/Samoa",
109
+ "Australia/Canberra",
110
+ "Australia/Sydney",
111
+ "Atlantic/Faeroe",
112
+ "Asia/Ust-Nera",
113
+ "Pacific/Palau",
114
+ "Africa/Kinshasa",
115
+ "Asia/Makassar",
116
+ "Asia/Hebron",
117
+ "ROK",
118
+ "America/St_Vincent",
119
+ "America/Argentina/Buenos_Aires",
120
+ "Africa/Asmara",
121
+ "Indian/Mahe",
122
+ "America/Dawson",
123
+ "Europe/Lisbon",
124
+ "Pacific/Pago_Pago",
125
+ "Brazil/West",
126
+ "America/Santarem",
127
+ "America/Virgin",
128
+ "America/Indianapolis",
129
+ "Asia/Bangkok",
130
+ "America/Indiana/Marengo",
131
+ "Atlantic/St_Helena",
132
+ "Europe/Moscow",
133
+ "Europe/Istanbul",
134
+ "Asia/Famagusta",
135
+ "Asia/Chongqing",
136
+ "America/Cuiaba",
137
+ "America/Detroit",
138
+ "America/Swift_Current",
139
+ "Greenwich",
140
+ "Antarctica/Davis",
141
+ "Africa/Conakry",
142
+ "America/Asuncion",
143
+ "Asia/Hovd",
144
+ "Africa/Freetown",
145
+ "America/Bahia_Banderas",
146
+ "Etc/GMT+6",
147
+ "Indian/Chagos",
148
+ "Pacific/Kiritimati",
149
+ "America/Toronto",
150
+ "EET",
151
+ "Indian/Cocos",
152
+ "America/Caracas",
153
+ "America/Indiana/Knox",
154
+ "America/Indiana/Winamac",
155
+ "Asia/Katmandu",
156
+ "America/Dominica",
157
+ "Asia/Hong_Kong",
158
+ "GMT0",
159
+ "Atlantic/Faroe",
160
+ "US/Michigan",
161
+ "UCT",
162
+ "Etc/GMT-9",
163
+ "America/Cordoba",
164
+ "Etc/GMT",
165
+ "Chile/EasterIsland",
166
+ "America/Resolute",
167
+ "America/Juneau",
168
+ "Europe/Chisinau",
169
+ "Africa/Djibouti",
170
+ "Antarctica/Vostok",
171
+ "Europe/Ulyanovsk",
172
+ "US/Hawaii",
173
+ "Africa/Juba",
174
+ "America/Chicago",
175
+ "America/Boa_Vista",
176
+ "Antarctica/DumontDUrville",
177
+ "Brazil/East",
178
+ "Mexico/BajaSur",
179
+ "Africa/Lubumbashi",
180
+ "America/Anguilla",
181
+ "Etc/GMT-13",
182
+ "Canada/Central",
183
+ "Europe/Busingen",
184
+ "America/Ciudad_Juarez",
185
+ "America/Edmonton",
186
+ "Atlantic/South_Georgia",
187
+ "America/Anchorage",
188
+ "America/Rosario",
189
+ "America/Araguaina",
190
+ "Asia/Shanghai",
191
+ "America/Tijuana",
192
+ "America/Cayenne",
193
+ "America/Regina",
194
+ "Australia/NSW",
195
+ "America/Santa_Isabel",
196
+ "Indian/Comoro",
197
+ "Europe/San_Marino",
198
+ "WET",
199
+ "Poland",
200
+ "US/Indiana-Starke",
201
+ "Asia/Saigon",
202
+ "Africa/Ceuta",
203
+ "Pacific/Niue",
204
+ "Australia/Darwin",
205
+ "Asia/Yekaterinburg",
206
+ "Pacific/Chuuk",
207
+ "Asia/Kathmandu",
208
+ "Asia/Almaty",
209
+ "America/Miquelon",
210
+ "Asia/Choibalsan",
211
+ "Australia/Melbourne",
212
+ "America/Managua",
213
+ "Portugal",
214
+ "Iceland",
215
+ "Africa/Malabo",
216
+ "America/North_Dakota/Center",
217
+ "Asia/Macau",
218
+ "EST5EDT",
219
+ "America/Louisville",
220
+ "America/Fort_Nelson",
221
+ "Europe/Amsterdam",
222
+ "America/Rio_Branco",
223
+ "Etc/GMT0",
224
+ "America/Thule",
225
+ "Pacific/Fakaofo",
226
+ "Africa/Bujumbura",
227
+ "Asia/Baku",
228
+ "Etc/GMT+8",
229
+ "Etc/GMT+10",
230
+ "America/Argentina/Tucuman",
231
+ "Africa/Lagos",
232
+ "Europe/Paris",
233
+ "Indian/Christmas",
234
+ "Asia/Qatar",
235
+ "Australia/ACT",
236
+ "Asia/Pyongyang",
237
+ "America/North_Dakota/Beulah",
238
+ "Factory",
239
+ "Europe/Copenhagen",
240
+ "Pacific/Fiji",
241
+ "America/Lower_Princes",
242
+ "Antarctica/Macquarie",
243
+ "America/Punta_Arenas",
244
+ "Antarctica/Rothera",
245
+ "America/Montserrat",
246
+ "Etc/GMT+0",
247
+ "NZ",
248
+ "America/Argentina/La_Rioja",
249
+ "America/Argentina/Catamarca",
250
+ "Antarctica/Troll",
251
+ "Europe/Vatican",
252
+ "Cuba",
253
+ "Africa/Windhoek",
254
+ "America/Havana",
255
+ "Asia/Atyrau",
256
+ "Australia/Eucla",
257
+ "America/Guatemala",
258
+ "US/Mountain",
259
+ "Europe/Saratov",
260
+ "Asia/Jakarta",
261
+ "US/Aleutian",
262
+ "Asia/Thimphu",
263
+ "Pacific/Enderbury",
264
+ "Africa/Luanda",
265
+ "Europe/Kirov",
266
+ "Pacific/Tongatapu",
267
+ "Africa/Sao_Tome",
268
+ "Africa/El_Aaiun",
269
+ "Iran",
270
+ "America/Godthab",
271
+ "MST7MDT",
272
+ "Europe/Sofia",
273
+ "America/Thunder_Bay",
274
+ "Australia/South",
275
+ "America/Tegucigalpa",
276
+ "Africa/Monrovia",
277
+ "Egypt",
278
+ "America/Scoresbysund",
279
+ "Singapore",
280
+ "Etc/GMT-7",
281
+ "Africa/Lome",
282
+ "America/Metlakatla",
283
+ "Asia/Singapore",
284
+ "Pacific/Chatham",
285
+ "America/Paramaribo",
286
+ "Asia/Ulaanbaatar",
287
+ "Antarctica/Mawson",
288
+ "Australia/Yancowinna",
289
+ "GMT-0",
290
+ "America/Belize",
291
+ "Asia/Magadan",
292
+ "America/Fort_Wayne",
293
+ "Pacific/Nauru",
294
+ "Europe/Warsaw",
295
+ "Asia/Muscat",
296
+ "Europe/Sarajevo",
297
+ "Etc/GMT-2",
298
+ "Africa/Gaborone",
299
+ "Africa/Bamako",
300
+ "Asia/Qyzylorda",
301
+ "GB",
302
+ "Etc/GMT+2",
303
+ "America/Lima",
304
+ "Asia/Omsk",
305
+ "Kwajalein",
306
+ "Asia/Tokyo",
307
+ "America/Inuvik",
308
+ "Asia/Tashkent",
309
+ "Jamaica",
310
+ "America/Argentina/ComodRivadavia",
311
+ "Africa/Algiers",
312
+ "Africa/Harare",
313
+ "America/Argentina/San_Juan",
314
+ "Pacific/Guam",
315
+ "Europe/Astrakhan",
316
+ "Africa/Nairobi",
317
+ "US/Arizona",
318
+ "EST",
319
+ "Australia/Hobart",
320
+ "America/Kentucky/Monticello",
321
+ "Asia/Urumqi",
322
+ "Etc/GMT-14",
323
+ "Pacific/Johnston",
324
+ "Etc/Zulu",
325
+ "Asia/Ashgabat",
326
+ "Atlantic/Jan_Mayen",
327
+ "America/Aruba",
328
+ "America/Argentina/Jujuy",
329
+ "Etc/Greenwich",
330
+ "America/St_Lucia",
331
+ "Australia/Currie",
332
+ "Asia/Jerusalem",
333
+ "America/Atka",
334
+ "America/St_Kitts",
335
+ "America/El_Salvador",
336
+ "Europe/Riga",
337
+ "US/Central",
338
+ "Etc/GMT+3",
339
+ "America/Montreal",
340
+ "Australia/Lord_Howe",
341
+ "W-SU",
342
+ "America/Noronha",
343
+ "Canada/Mountain",
344
+ "America/Indiana/Vincennes",
345
+ "Europe/Simferopol",
346
+ "Pacific/Gambier",
347
+ "Africa/Tripoli",
348
+ "Asia/Novosibirsk",
349
+ "Navajo",
350
+ "Asia/Harbin",
351
+ "America/Rankin_Inlet",
352
+ "Asia/Kuching",
353
+ "America/Argentina/Salta",
354
+ "Europe/Bratislava",
355
+ "America/Glace_Bay",
356
+ "America/Argentina/Mendoza",
357
+ "Asia/Tomsk",
358
+ "America/Nipigon",
359
+ "Asia/Pontianak",
360
+ "Australia/Perth",
361
+ "Indian/Reunion",
362
+ "Europe/Uzhgorod",
363
+ "Europe/Athens",
364
+ "Brazil/DeNoronha",
365
+ "Zulu",
366
+ "Asia/Qostanay",
367
+ "Europe/Malta",
368
+ "Indian/Maldives",
369
+ "Asia/Jayapura",
370
+ "America/Denver",
371
+ "Atlantic/Reykjavik",
372
+ "Australia/West",
373
+ "America/Phoenix",
374
+ "Europe/Volgograd",
375
+ "Asia/Kamchatka",
376
+ "America/Kralendijk",
377
+ "America/Creston",
378
+ "Africa/Dakar",
379
+ "Europe/Andorra",
380
+ "Europe/Madrid",
381
+ "Japan",
382
+ "Pacific/Kosrae",
383
+ "GMT",
384
+ "America/Maceio",
385
+ "America/Porto_Acre",
386
+ "Asia/Ho_Chi_Minh",
387
+ "Asia/Kashgar",
388
+ "US/Samoa",
389
+ "Africa/Banjul",
390
+ "Asia/Anadyr",
391
+ "Etc/GMT-6",
392
+ "Pacific/Truk",
393
+ "America/Winnipeg",
394
+ "Africa/Ndjamena",
395
+ "Africa/Bissau",
396
+ "Asia/Baghdad",
397
+ "Israel",
398
+ "America/Guadeloupe",
399
+ "America/Buenos_Aires",
400
+ "America/Adak",
401
+ "Asia/Vladivostok",
402
+ "Pacific/Tarawa",
403
+ "Antarctica/Casey",
404
+ "Antarctica/Palmer",
405
+ "Asia/Irkutsk",
406
+ "Asia/Colombo",
407
+ "America/Port_of_Spain",
408
+ "America/North_Dakota/New_Salem",
409
+ "Europe/Dublin",
410
+ "Pacific/Ponape",
411
+ "America/Boise",
412
+ "Pacific/Yap",
413
+ "America/Whitehorse",
414
+ "PRC",
415
+ "Australia/Adelaide",
416
+ "America/Indiana/Vevay",
417
+ "Europe/Berlin",
418
+ "America/Recife",
419
+ "Europe/Oslo",
420
+ "Turkey",
421
+ "Europe/Luxembourg",
422
+ "Europe/Zagreb",
423
+ "America/Grenada",
424
+ "Africa/Blantyre",
425
+ "Asia/Tbilisi",
426
+ "America/Coyhaique",
427
+ "Pacific/Apia",
428
+ "Africa/Niamey",
429
+ "America/Guyana",
430
+ "Asia/Yerevan",
431
+ "Pacific/Honolulu",
432
+ "America/Hermosillo",
433
+ "Asia/Macao",
434
+ "Europe/Belfast",
435
+ "America/Indiana/Tell_City",
436
+ "Asia/Dushanbe",
437
+ "Asia/Novokuznetsk",
438
+ "Africa/Maseru",
439
+ "Pacific/Funafuti",
440
+ "Antarctica/McMurdo",
441
+ "America/Menominee",
442
+ "NZ-CHAT",
443
+ "MET",
444
+ "Asia/Dhaka",
445
+ "America/Jujuy",
446
+ "Europe/Vaduz",
447
+ "Europe/Budapest",
448
+ "Asia/Kuwait",
449
+ "Africa/Maputo",
450
+ "Asia/Aqtau",
451
+ "Europe/Belgrade",
452
+ "Africa/Ouagadougou",
453
+ "America/Puerto_Rico",
454
+ "Europe/Vilnius",
455
+ "Asia/Chita",
456
+ "America/Yellowknife",
457
+ "America/Ojinaga",
458
+ "America/Shiprock",
459
+ "America/Bahia",
460
+ "America/Tortola",
461
+ "America/Antigua",
462
+ "Etc/GMT+11",
463
+ "Atlantic/Bermuda",
464
+ "Asia/Khandyga",
465
+ "US/Pacific",
466
+ "Asia/Nicosia",
467
+ "Etc/GMT-3",
468
+ "Asia/Kabul",
469
+ "America/St_Johns",
470
+ "Etc/GMT+5",
471
+ "Asia/Dubai",
472
+ "Pacific/Galapagos",
473
+ "Etc/GMT-0",
474
+ "America/Indiana/Petersburg",
475
+ "America/Blanc-Sablon",
476
+ "Etc/GMT-10",
477
+ "Pacific/Tahiti",
478
+ "America/Argentina/Cordoba",
479
+ "Europe/Tiraspol",
480
+ "America/Pangnirtung",
481
+ "Africa/Casablanca",
482
+ "Brazil/Acre",
483
+ "Pacific/Pitcairn",
484
+ "Europe/Ljubljana",
485
+ "Africa/Cairo",
486
+ "America/Nuuk",
487
+ "Asia/Chungking",
488
+ "Africa/Dar_es_Salaam",
489
+ "Asia/Bahrain",
490
+ "Etc/GMT-12",
491
+ "Asia/Krasnoyarsk",
492
+ "US/East-Indiana",
493
+ "Europe/Minsk",
494
+ "Asia/Dili",
495
+ "Etc/GMT+7",
496
+ "Asia/Seoul",
497
+ "Asia/Yangon",
498
+ "Europe/Zurich",
499
+ "America/Knox_IN",
500
+ "Atlantic/Cape_Verde",
501
+ "Asia/Ashkhabad",
502
+ "Pacific/Port_Moresby",
503
+ "Europe/Prague",
504
+ "Africa/Kampala",
505
+ "America/Belem",
506
+ "Asia/Vientiane",
507
+ "America/Moncton",
508
+ "Europe/Monaco",
509
+ "America/Mazatlan",
510
+ "Africa/Brazzaville",
511
+ "America/Marigot",
512
+ "Asia/Dacca",
513
+ "Etc/GMT-11",
514
+ "Atlantic/Stanley",
515
+ "Asia/Kuala_Lumpur",
516
+ "Hongkong",
517
+ "Asia/Manila",
518
+ "America/Santiago",
519
+ "Indian/Mauritius",
520
+ "Europe/Brussels",
521
+ "Europe/Isle_of_Man",
522
+ "Australia/Broken_Hill",
523
+ "Asia/Brunei",
524
+ "Europe/Zaporozhye",
525
+ "America/New_York",
526
+ "Asia/Tehran",
527
+ "America/Panama",
528
+ "Africa/Libreville",
529
+ "America/Santo_Domingo",
530
+ "Pacific/Wake",
531
+ "Pacific/Auckland",
532
+ "America/Argentina/Ushuaia",
533
+ "Asia/Aden",
534
+ "Africa/Timbuktu",
535
+ "Asia/Bishkek",
536
+ "Etc/GMT+1",
537
+ "Pacific/Pohnpei",
538
+ "America/Sao_Paulo",
539
+ "US/Eastern",
540
+ "Europe/Nicosia",
541
+ "Pacific/Kwajalein",
542
+ "America/Iqaluit",
543
+ "America/Cayman",
544
+ "America/Monterrey",
545
+ "America/Guayaquil",
546
+ "America/Nome",
547
+ "America/Barbados",
548
+ "Pacific/Majuro",
549
+ "Etc/GMT-8",
550
+ "Asia/Phnom_Penh",
551
+ "America/Rainy_River",
552
+ "America/Indiana/Indianapolis",
553
+ "America/Atikokan",
554
+ "America/St_Barthelemy",
555
+ "PST8PDT",
556
+ "Universal",
557
+ "Indian/Kerguelen",
558
+ "Etc/UCT",
559
+ "Australia/LHI",
560
+ "Europe/Stockholm",
561
+ "Asia/Ujung_Pandang",
562
+ "America/Los_Angeles",
563
+ "Asia/Riyadh",
564
+ "America/Curacao",
565
+ "Africa/Johannesburg",
566
+ "Etc/GMT+4",
567
+ "Canada/Yukon",
568
+ "GB-Eire",
569
+ "Asia/Karachi",
570
+ "America/Mendoza",
571
+ "Australia/Victoria",
572
+ "America/Jamaica",
573
+ "Australia/Lindeman",
574
+ "Asia/Srednekolymsk",
575
+ "America/Bogota",
576
+ "Asia/Beirut",
577
+ "Asia/Calcutta",
578
+ "MST",
579
+ "Europe/Jersey",
580
+ "Etc/GMT+9",
581
+ "Asia/Ulan_Bator",
582
+ "Europe/Rome",
583
+ "Pacific/Wallis",
584
+ "Etc/GMT-4",
585
+ "Libya",
586
+ "UTC",
587
+ "Asia/Thimbu",
588
+ "Canada/Pacific",
589
+ "Africa/Kigali",
590
+ "America/Eirunepe",
591
+ "Europe/Kaliningrad",
592
+ "Atlantic/Canary",
593
+ "America/Mexico_City",
594
+ "Europe/Kiev",
595
+ "CET",
596
+ "Europe/Skopje",
597
+ "Pacific/Saipan",
598
+ "America/Sitka",
599
+ "Africa/Accra",
600
+ "Asia/Aqtobe",
601
+ "Asia/Oral",
602
+ "Pacific/Guadalcanal",
603
+ "Asia/Istanbul",
604
+ "America/Porto_Velho",
605
+ "America/Coral_Harbour",
606
+ "Mexico/General",
607
+ "Europe/Tallinn",
608
+ ]
609
+
9
610
 
10
611
  class _trigger_time:
11
612
  """
@@ -33,9 +634,14 @@ class Cron:
33
634
  """
34
635
 
35
636
  expression: str
637
+ timezone: Timezone = "UTC"
638
+
639
+ @property
640
+ def timezone_expression(self) -> str:
641
+ return f"CRON_TZ={self.timezone} {self.expression}"
36
642
 
37
643
  def __str__(self):
38
- return f"Cron Trigger: {self.expression}"
644
+ return f"Cron Trigger: {self.timezone_expression}"
39
645
 
40
646
 
41
647
  @rich.repr.auto
@@ -90,8 +696,9 @@ class Trigger:
90
696
  values for inputs to these defaults.
91
697
  :param env_vars: (Dict[str, str]) Optional environment variables for the trigger, default is None. If provided, will
92
698
  replace the environment variables set in the config of the task.
93
- :param interruptible: (bool) Whether the trigger is interruptible, default is None. If provided,
94
- it overrides whatever is set in the config of the task.
699
+ :param interruptible: (bool) Whether the trigger run is interruptible,
700
+ default is None (maintains the configured behavior). If provided, it overrides whatever is set in the config
701
+ of the task.
95
702
  :param overwrite_cache: (bool) Whether to overwrite the cache, default is False.
96
703
  :param queue: (str) Optional queue to run the trigger in, default is None.
97
704
  :param labels: (Mapping[str, str]) Optional labels to attach to the trigger, default is None.
@@ -142,7 +749,7 @@ class Trigger:
142
749
  auto_activate (bool): Whether the trigger should be automatically activated.
143
750
  inputs (Dict[str, Any] | None): Optional inputs for the trigger.
144
751
  env_vars (Dict[str, str] | None): Optional environment variables.
145
- interruptible (bool | None): Whether the trigger is interruptible.
752
+ interruptible (bool | None): Whether the triggered run is interruptible.
146
753
  overwrite_cache (bool): Whether to overwrite the cache.
147
754
  queue (str | None): Optional queue to run the trigger in.
148
755
  labels (Mapping[str, str] | None): Optional labels to attach to the trigger.
@@ -380,3 +987,14 @@ class Trigger:
380
987
  labels=labels,
381
988
  annotations=annotations,
382
989
  )
990
+
991
+
992
+ if __name__ == "__main__":
993
+ from typing import get_args
994
+
995
+ vals = get_args(Timezone)
996
+ with open("/tmp/timezones.txt", "w") as f:
997
+ for v in vals:
998
+ c = Cron(expression="0 0 * * *", timezone=v)
999
+ f.write(f"{c.timezone_expression}\n")
1000
+ print(f"Wrote {len(vals)} timezones to /tmp/timezones.txt")
flyte/_version.py CHANGED
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '2.0.0b26'
32
- __version_tuple__ = version_tuple = (2, 0, 0, 'b26')
31
+ __version__ = version = '2.0.0b28'
32
+ __version_tuple__ = version_tuple = (2, 0, 0, 'b28')
33
33
 
34
- __commit_id__ = commit_id = 'g713072212'
34
+ __commit_id__ = commit_id = 'gb62a542c8'
flyte/cli/_plugins.py ADDED
@@ -0,0 +1,208 @@
1
+ """CLI Plugin System for Flyte.
2
+
3
+ This module provides a plugin system that allows external packages to:
4
+ 1. Register new top-level CLI commands (e.g., flyte my-command)
5
+ 2. Register new subcommands in existing groups (e.g., flyte get my-object)
6
+ 3. Modify behavior of existing commands via hooks
7
+
8
+ Plugins are discovered via Python entry points.
9
+
10
+ Entry Point Groups:
11
+ - flyte.plugins.cli.commands: Register new commands
12
+ - Entry point name "foo" -> flyte foo (top-level command)
13
+ - Entry point name "get.bar" -> flyte get bar (adds subcommand to get group)
14
+ - Note: At most one dot is supported. For nested groups, register the entire
15
+ group hierarchy as a top-level command (without dots).
16
+
17
+ - flyte.plugins.cli.hooks: Modify existing commands
18
+ - Entry point name "run" -> modifies flyte run
19
+ - Entry point name "get.project" -> modifies flyte get project
20
+ - Note: At most one dot is supported.
21
+
22
+ Example Plugin Package:
23
+ # In your-plugin/pyproject.toml
24
+ [project.entry-points."flyte.plugins.cli.commands"]
25
+ my-command = "your_plugin.cli:my_command"
26
+ get.my-object = "your_plugin.cli:get_my_object"
27
+
28
+ [project.entry-points."flyte.plugins.cli.hooks"]
29
+ run = "your_plugin.hooks:modify_run"
30
+
31
+ # In your-plugin/your_plugin/cli.py
32
+ import rich_click as click
33
+
34
+ @click.command()
35
+ def my_command():
36
+ '''My custom top-level command.'''
37
+ click.echo("Hello from plugin!")
38
+
39
+ @click.command()
40
+ def get_my_object():
41
+ '''Get my custom object.'''
42
+ click.echo("Getting my object...")
43
+
44
+ # In your-plugin/your_plugin/hooks.py
45
+ def modify_run(command):
46
+ '''Add behavior to flyte run command.'''
47
+ # Wrap invoke() instead of callback to ensure Click's full machinery runs
48
+ original_invoke = command.invoke
49
+
50
+ def wrapper(ctx):
51
+ # Do something before
52
+ click.echo("Plugin: Starting task...")
53
+
54
+ result = original_invoke(ctx)
55
+
56
+ # Do something after
57
+ click.echo("Plugin: Task completed!")
58
+ return result
59
+
60
+ command.invoke = wrapper
61
+ return command
62
+ """
63
+
64
+ from importlib.metadata import entry_points
65
+ from typing import Callable
66
+
67
+ import rich_click as click
68
+
69
+ from flyte._logging import logger
70
+
71
+ # Type alias for command hooks
72
+ CommandHook = Callable[[click.Command], click.Command]
73
+
74
+
75
+ def discover_and_register_plugins(root_group: click.Group):
76
+ """
77
+ Discover all CLI plugins from installed packages and register them.
78
+
79
+ This function:
80
+ 1. Discovers command plugins and adds them to the CLI
81
+ 2. Discovers hook plugins and applies them to existing commands
82
+
83
+ Args:
84
+ root_group: The root Click command group (main CLI group)
85
+ """
86
+ _load_command_plugins(root_group)
87
+ _load_hook_plugins(root_group)
88
+
89
+
90
+ def _load_command_plugins(root_group: click.Group):
91
+ """Load and register command plugins."""
92
+ for ep in entry_points(group="flyte.plugins.cli.commands"):
93
+ try:
94
+ command = ep.load()
95
+ if not isinstance(command, click.Command):
96
+ logger.warning(f"Plugin {ep.name} did not return a click.Command, got {type(command).__name__}")
97
+ continue
98
+
99
+ # Check if this is a subcommand (contains dot notation)
100
+ if "." in ep.name:
101
+ group_name, command_name = ep.name.split(".", 1)
102
+
103
+ # Validate: only support one level of nesting (group.command)
104
+ if "." in command_name:
105
+ logger.error(
106
+ f"Plugin {ep.name} uses multiple dots, which is not supported. "
107
+ f"Use at most one dot (e.g., 'group.command'). "
108
+ f"For nested groups, register the entire group hierarchy as a top-level command."
109
+ )
110
+ continue
111
+
112
+ _add_subcommand_to_group(root_group, group_name, command_name, command)
113
+ else:
114
+ # Top-level command
115
+ root_group.add_command(command, name=ep.name)
116
+ logger.info(f"Registered plugin command: flyte {ep.name}")
117
+
118
+ except Exception as e:
119
+ logger.error(f"Failed to load plugin command {ep.name}: {e}")
120
+
121
+
122
+ def _load_hook_plugins(root_group: click.Group):
123
+ """Load and apply hook plugins to existing commands."""
124
+ for ep in entry_points(group="flyte.plugins.cli.hooks"):
125
+ try:
126
+ hook = ep.load()
127
+ if not callable(hook):
128
+ logger.warning(f"Plugin hook {ep.name} is not callable")
129
+ continue
130
+
131
+ # Check if this is a subcommand hook (contains dot notation)
132
+ if "." in ep.name:
133
+ group_name, command_name = ep.name.split(".", 1)
134
+
135
+ # Validate: only support one level of nesting (group.command)
136
+ if "." in command_name:
137
+ logger.error(
138
+ f"Plugin hook {ep.name} uses multiple dots, which is not supported. "
139
+ f"Use at most one dot (e.g., 'group.command')."
140
+ )
141
+ continue
142
+
143
+ _apply_hook_to_subcommand(root_group, group_name, command_name, hook)
144
+ else:
145
+ # Top-level command hook
146
+ _apply_hook_to_command(root_group, ep.name, hook)
147
+
148
+ except Exception as e:
149
+ logger.error(f"Failed to apply hook {ep.name}: {e}")
150
+
151
+
152
+ def _add_subcommand_to_group(root_group: click.Group, group_name: str, command_name: str, command: click.Command):
153
+ """Add a subcommand to an existing command group."""
154
+ if group_name not in root_group.commands:
155
+ logger.warning(f"Cannot add plugin subcommand '{command_name}' - group '{group_name}' does not exist")
156
+ return
157
+
158
+ group = root_group.commands[group_name]
159
+ if not isinstance(group, click.Group):
160
+ logger.warning(f"Cannot add plugin subcommand '{command_name}' - '{group_name}' is not a command group")
161
+ return
162
+
163
+ group.add_command(command, name=command_name)
164
+ # lower to debug later
165
+ logger.info(f"Registered plugin subcommand: flyte {group_name} {command_name}")
166
+
167
+
168
+ def _apply_hook_to_command(root_group: click.Group, command_name: str, hook: CommandHook):
169
+ """Apply a hook to a top-level command."""
170
+ if command_name not in root_group.commands:
171
+ logger.warning(f"Cannot apply hook - command '{command_name}' does not exist")
172
+ return
173
+
174
+ original_command = root_group.commands[command_name]
175
+ try:
176
+ modified_command = hook(original_command)
177
+ root_group.commands[command_name] = modified_command
178
+ # lower to debug later
179
+ logger.info(f"Applied hook to command: flyte {command_name}")
180
+ except Exception as e:
181
+ logger.error(f"Hook failed for command {command_name}: {e}")
182
+ root_group.commands[command_name] = original_command
183
+
184
+
185
+ def _apply_hook_to_subcommand(root_group: click.Group, group_name: str, command_name: str, hook: CommandHook):
186
+ """Apply a hook to a subcommand within a group."""
187
+ if group_name not in root_group.commands:
188
+ logger.warning(f"Cannot apply hook - group '{group_name}' does not exist")
189
+ return
190
+
191
+ group = root_group.commands[group_name]
192
+ if not isinstance(group, click.Group):
193
+ logger.warning(f"Cannot apply hook - '{group_name}' is not a command group")
194
+ return
195
+
196
+ if command_name not in group.commands:
197
+ logger.warning(f"Cannot apply hook - subcommand '{command_name}' does not exist in group '{group_name}'")
198
+ return
199
+
200
+ original_command = group.commands[command_name]
201
+ original_command.callback
202
+ try:
203
+ modified_command = hook(original_command)
204
+ group.commands[command_name] = modified_command
205
+ logger.info(f"Applied hook to subcommand: flyte {group_name} {command_name}")
206
+ except Exception as e:
207
+ logger.error(f"Hook failed for subcommand {group_name}.{command_name}: {e}")
208
+ group.commands[command_name] = original_command
flyte/cli/_run.py CHANGED
@@ -155,7 +155,8 @@ class RunArguments:
155
155
 
156
156
  @classmethod
157
157
  def from_dict(cls, d: Dict[str, Any]) -> RunArguments:
158
- return cls(**d)
158
+ modified = {k: v for k, v in d.items() if k in {f.name for f in fields(cls)}}
159
+ return cls(**modified)
159
160
 
160
161
  @classmethod
161
162
  def options(cls) -> List[click.Option]:
flyte/cli/main.py CHANGED
@@ -12,6 +12,7 @@ from ._delete import delete
12
12
  from ._deploy import deploy
13
13
  from ._gen import gen
14
14
  from ._get import get
15
+ from ._plugins import discover_and_register_plugins
15
16
  from ._run import run
16
17
  from ._serve import serve
17
18
  from ._update import update
@@ -203,3 +204,6 @@ main.add_command(build)
203
204
  main.add_command(whoami) # type: ignore
204
205
  main.add_command(update) # type: ignore
205
206
  main.add_command(serve) # type: ignore
207
+
208
+ # Discover and register CLI plugins from installed packages
209
+ discover_and_register_plugins(main)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: flyte
3
- Version: 2.0.0b26
3
+ Version: 2.0.0b28
4
4
  Summary: Add your description here
5
5
  Author-email: Ketan Umare <kumare3@users.noreply.github.com>
6
6
  Requires-Python: >=3.10
@@ -28,8 +28,8 @@ flyte/_task_plugins.py,sha256=4KcdSERpQ0yR9q0CO3H2VC84egaj7r1fqHg8YO2xsFM,1093
28
28
  flyte/_timeout.py,sha256=zx5sFcbYmjJAJbZWSGzzX-BpC9HC7Jfs35T7vVhKwkk,1571
29
29
  flyte/_tools.py,sha256=lB3OiJSAhxzSMCYjLUF6nZjlFsmNpaRXtr3_Fefcxbg,747
30
30
  flyte/_trace.py,sha256=-BIprs2MbupWl3vsC_Pn33SV3fSVku1rUIsnwfmrIy0,5204
31
- flyte/_trigger.py,sha256=RprrBjpv1Zcim2WBrudZlvU_sh8EXaleT2edAZGbdkY,15110
32
- flyte/_version.py,sha256=_oC0KBsEUQxmnKUJK6kSReRRGGXJDqNMiK5M0eaBYG8,722
31
+ flyte/_trigger.py,sha256=fsDQv-_j7sw0UTdTjMNdtjRSXuSty8ihijYPi0VTf00,28973
32
+ flyte/_version.py,sha256=CNHpRTV1VYNFWs_n4VMyt7o9G2upJyh5TAKj7gVAB1g,722
33
33
  flyte/errors.py,sha256=L_05C2BAfDSWqmU6hHnJyzkBQDPcLeIiW6oGZl3sQLw,6965
34
34
  flyte/extend.py,sha256=fP6VD_OvBZims0LG3ODxzfugUQp6L04ATX3kZk27PMg,562
35
35
  flyte/models.py,sha256=dqpMq_BGi3_VR1zKK1pw8WckNmDT_4rLWCKu_uhY3Nw,18249
@@ -45,8 +45,8 @@ flyte/_cache/policy_function_body.py,sha256=_AcyN6XKRXq16yV5lWuRJYCIVUlmyPvvWuYR
45
45
  flyte/_code_bundle/__init__.py,sha256=G7DJTQ0UN_ETvdh55pYcWsTrZJKXEcyQl9iQQNQOBXQ,328
46
46
  flyte/_code_bundle/_ignore.py,sha256=INTPvv8ironCBIl_sJ_VaXnMd7gJcx0hL-OvrZNXdRo,4127
47
47
  flyte/_code_bundle/_packaging.py,sha256=H-_boKm4Wlri2D1zR-VzjvDxM-_R-_hKUBWVPUWYFKU,7094
48
- flyte/_code_bundle/_utils.py,sha256=SZd6t3ofqygrnpyxW9rPWOViXUrkNfICKKv6NmkAVhk,12209
49
- flyte/_code_bundle/bundle.py,sha256=Cr6BGdBlQOwJ31IPeNTnRrGpKEUAyfIq_9BHRgzKxCo,8965
48
+ flyte/_code_bundle/_utils.py,sha256=bXGNKGMTt7QMucuJtWpHxra3tOLsKfb6qWNVV4OaRfA,12250
49
+ flyte/_code_bundle/bundle.py,sha256=0BkBsd-suB9I70Fo8VuDol8k8P_ecSFb3AbRceSeOqI,8987
50
50
  flyte/_debug/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
51
51
  flyte/_debug/constants.py,sha256=tI4410tMsCGdgsrCCdk28RAWu6lyTQs7yRvzrRoR1HY,1516
52
52
  flyte/_debug/utils.py,sha256=Nc6n1Y_OdLMa4VtvigP6U738D4Fpbuog94g37tPwu6k,596
@@ -80,7 +80,7 @@ flyte/_internal/runtime/reuse.py,sha256=Z7TU-H4hdWUfD2rMl8iU1pljKLEEvB2YKZPEdQon
80
80
  flyte/_internal/runtime/rusty.py,sha256=cbEq2ISfYE93CJclDPGOgZOUKKjvPhdfZHuhmFHWzcI,7648
81
81
  flyte/_internal/runtime/task_serde.py,sha256=IiCK53YeO4ZZ53n5unQl1K9pz90WeaFUxQ8BTeh9ZHI,14748
82
82
  flyte/_internal/runtime/taskrunner.py,sha256=XXKWaCd1kGaaCXTKxEOVkPVq3hX62-qjV3eY4Ru_fkY,7894
83
- flyte/_internal/runtime/trigger_serde.py,sha256=pTAFFKySkE0MzlNIJnMmKHUhfxR0tsCn-bNd1bLx-YE,5000
83
+ flyte/_internal/runtime/trigger_serde.py,sha256=ionYTtv9Etx1DDQPtJPpuc7uwF772F1GF_dwYEFy1Gk,5009
84
84
  flyte/_internal/runtime/types_serde.py,sha256=gVUKagPBoQ3Yukce_0DSbiwtyXJGqbwa-0p2zTNDSPc,1814
85
85
  flyte/_keyring/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
86
86
  flyte/_keyring/file.py,sha256=P_61Jf3SnT5SEHX0JiROntTaaWEtFOgLb4P1in22HVA,2958
@@ -106,11 +106,12 @@ flyte/cli/_gen.py,sha256=7K2eYQLGVr26I2OC3Xe_bzAn4ANYA5mPlBW5m1476PM,6079
106
106
  flyte/cli/_get.py,sha256=g53ThkT7qWgWPaxyr-0-WBOKs7vcOtlAjO4INBuSuFc,12136
107
107
  flyte/cli/_option.py,sha256=oC1Gs0u0UrOC1SsrFo-iCuAkqQvI1wJWCdjYXA9rW4Q,1445
108
108
  flyte/cli/_params.py,sha256=ZCyd714-CKXAzIL3tb3zfheTYpV0aqZFT3YEL3voS4w,20051
109
- flyte/cli/_run.py,sha256=ALZRbr1NzZH0RrrN7Up2Bv3RP2cA8hxGmZ446ngKp-I,20553
109
+ flyte/cli/_plugins.py,sha256=azyORquPhBHMzGbkC38_QjAO_JvpEQvPQ-dc30auZQM,7969
110
+ flyte/cli/_run.py,sha256=EYF3qLJJjYgyQ_pLdWJvvHOfwsk-p57NnytahxqOnH4,20646
110
111
  flyte/cli/_serve.py,sha256=ZozcCrNa8syOUn_973YGI1wVGi_ok6PE32goWfz_ftg,4518
111
112
  flyte/cli/_update.py,sha256=oEG5hEe1xML6e8Q8k74ejdPjrMZd8b1trjqKNcFLLV0,1115
112
113
  flyte/cli/_user.py,sha256=x32vEXpJkV6ONoCCcq7DbCIltHcALcSvm3PalNI57kI,339
113
- flyte/cli/main.py,sha256=HHFYhD_pX_TtyEus08AMHJ05hIOAAYKQfT3fUnoAlnQ,5659
114
+ flyte/cli/main.py,sha256=_nRj8AmN36VwNn6zWvty1ii9IhpcIWJWugWUG3fYNpM,5808
114
115
  flyte/config/__init__.py,sha256=MiwEYK5Iv7MRR22z61nzbsbvZ9Q6MdmAU_g9If1Pmb8,144
115
116
  flyte/config/_config.py,sha256=IPfKboFar4CELhdJf583R10gG0PIhzUl1YAAP0ccObc,11109
116
117
  flyte/config/_internal.py,sha256=cmRtr6JeIkSfGgw9gloDkTuGpFNdwoUbnBJgbmAhPUE,3055
@@ -181,11 +182,11 @@ flyte/types/_renderer.py,sha256=ygcCo5l60lHufyQISFddZfWwLlQ8kJAKxUT_XnR_6dY,4818
181
182
  flyte/types/_string_literals.py,sha256=Tg14opnmkB7MvfNyUACbcPAeph6vg88aW5yC_G9kPIA,4167
182
183
  flyte/types/_type_engine.py,sha256=997leiWW55t8rWbYLnif9hGrgVP2tzpSMfOoF_MSPvg,96036
183
184
  flyte/types/_utils.py,sha256=-4M__ImscXMqsySaKDrCBJA-xX-c1-Vbc0_zPVoGRyc,2627
184
- flyte-2.0.0b26.data/scripts/debug.py,sha256=hnX2tlv9QbqckoT5CJ3c3apJj3tGDpsrdV7ZAsE7j34,911
185
- flyte-2.0.0b26.data/scripts/runtime.py,sha256=_FymfqibynxcmaGu5HT8XITk_5i2VsUbfpxKUbqenVc,8061
186
- flyte-2.0.0b26.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
187
- flyte-2.0.0b26.dist-info/METADATA,sha256=x1NKBu7yC-mTulUIiTXtCHAoPwlM0d5Y70SgOdFLFw8,10345
188
- flyte-2.0.0b26.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
189
- flyte-2.0.0b26.dist-info/entry_points.txt,sha256=rb43Gfxw40iPH5B6EUs6Ter0ekLkGXsj7R890_MOTyk,136
190
- flyte-2.0.0b26.dist-info/top_level.txt,sha256=7dkyFbikvA12LEZEqawx8oDG1CMod6hTliPj7iWzgYo,6
191
- flyte-2.0.0b26.dist-info/RECORD,,
185
+ flyte-2.0.0b28.data/scripts/debug.py,sha256=hnX2tlv9QbqckoT5CJ3c3apJj3tGDpsrdV7ZAsE7j34,911
186
+ flyte-2.0.0b28.data/scripts/runtime.py,sha256=_FymfqibynxcmaGu5HT8XITk_5i2VsUbfpxKUbqenVc,8061
187
+ flyte-2.0.0b28.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
188
+ flyte-2.0.0b28.dist-info/METADATA,sha256=VYe9eEW2pfQxSPMYC9zBCmvfcGeiJrpnwymOT5-t92Q,10345
189
+ flyte-2.0.0b28.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
190
+ flyte-2.0.0b28.dist-info/entry_points.txt,sha256=rb43Gfxw40iPH5B6EUs6Ter0ekLkGXsj7R890_MOTyk,136
191
+ flyte-2.0.0b28.dist-info/top_level.txt,sha256=7dkyFbikvA12LEZEqawx8oDG1CMod6hTliPj7iWzgYo,6
192
+ flyte-2.0.0b28.dist-info/RECORD,,