prefect-client 3.3.5.dev2__py3-none-any.whl → 3.3.5.dev3__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.
prefect/_build_info.py CHANGED
@@ -1,5 +1,5 @@
1
1
  # Generated by versioningit
2
- __version__ = "3.3.5.dev2"
3
- __build_date__ = "2025-04-15 08:08:47.936739+00:00"
4
- __git_commit__ = "85e42e857f676939821a9e31f687468b5c73a502"
2
+ __version__ = "3.3.5.dev3"
3
+ __build_date__ = "2025-04-16 08:08:24.630955+00:00"
4
+ __git_commit__ = "d01b30e8ec3cffd839c23ab42edc62983c3cb1a4"
5
5
  __dirty__ = False
prefect/events/clients.py CHANGED
@@ -39,6 +39,7 @@ import prefect.types._datetime
39
39
  from prefect.events import Event
40
40
  from prefect.logging import get_logger
41
41
  from prefect.settings import (
42
+ PREFECT_API_AUTH_STRING,
42
43
  PREFECT_API_KEY,
43
44
  PREFECT_API_SSL_CERT_FILE,
44
45
  PREFECT_API_TLS_INSECURE_SKIP_VERIFY,
@@ -367,7 +368,7 @@ class PrefectEventsClient(EventsClient):
367
368
  await self._connect.__aexit__(exc_type, exc_val, exc_tb)
368
369
  return await super().__aexit__(exc_type, exc_val, exc_tb)
369
370
 
370
- def _log_debug(self, message: str, *args, **kwargs) -> None:
371
+ def _log_debug(self, message: str, *args: Any, **kwargs: Any) -> None:
371
372
  message = f"EventsClient(id={id(self)}): " + message
372
373
  logger.debug(message, *args, **kwargs)
373
374
 
@@ -578,6 +579,7 @@ class PrefectEventSubscriber:
578
579
  _seen_events: MutableMapping[UUID, bool]
579
580
 
580
581
  _api_key: Optional[str]
582
+ _auth_token: Optional[str]
581
583
 
582
584
  def __init__(
583
585
  self,
@@ -593,6 +595,8 @@ class PrefectEventSubscriber:
593
595
  the client should attempt to reconnect
594
596
  """
595
597
  self._api_key = None
598
+ self._auth_token = PREFECT_API_AUTH_STRING.value()
599
+
596
600
  if not api_url:
597
601
  api_url = cast(str, PREFECT_API_URL.value())
598
602
 
@@ -641,8 +645,10 @@ class PrefectEventSubscriber:
641
645
  await pong
642
646
 
643
647
  logger.debug(" authenticating...")
648
+ # Use the API key (for Cloud) OR the auth token (for self-hosted with auth string)
649
+ token = self._api_key or self._auth_token
644
650
  await self._websocket.send(
645
- orjson.dumps({"type": "auth", "token": self._api_key}).decode()
651
+ orjson.dumps({"type": "auth", "token": token}).decode()
646
652
  )
647
653
 
648
654
  try:
@@ -652,13 +658,13 @@ class PrefectEventSubscriber:
652
658
  except AssertionError as e:
653
659
  raise Exception(
654
660
  "Unable to authenticate to the event stream. Please ensure the "
655
- "provided api_key you are using is valid for this environment. "
661
+ "provided api_key or auth_token you are using is valid for this environment. "
656
662
  f"Reason: {e.args[0]}"
657
663
  )
658
664
  except ConnectionClosedError as e:
659
665
  reason = getattr(e.rcvd, "reason", None)
660
666
  msg = "Unable to authenticate to the event stream. Please ensure the "
661
- msg += "provided api_key you are using is valid for this environment. "
667
+ msg += "provided api_key or auth_token you are using is valid for this environment. "
662
668
  msg += f"Reason: {reason}" if reason else ""
663
669
  raise Exception(msg) from e
664
670
 
prefect/flows.py CHANGED
@@ -1130,7 +1130,7 @@ class Flow(Generic[P, R]):
1130
1130
  @classmethod
1131
1131
  async def afrom_source(
1132
1132
  cls,
1133
- source: Union[str, "RunnerStorage", ReadableDeploymentStorage],
1133
+ source: Union[str, Path, "RunnerStorage", ReadableDeploymentStorage],
1134
1134
  entrypoint: str,
1135
1135
  ) -> "Flow[..., Any]":
1136
1136
  """
@@ -1244,7 +1244,7 @@ class Flow(Generic[P, R]):
1244
1244
  @async_dispatch(afrom_source)
1245
1245
  def from_source(
1246
1246
  cls,
1247
- source: Union[str, "RunnerStorage", ReadableDeploymentStorage],
1247
+ source: Union[str, Path, "RunnerStorage", ReadableDeploymentStorage],
1248
1248
  entrypoint: str,
1249
1249
  ) -> "Flow[..., Any]":
1250
1250
  """
@@ -1976,7 +1976,7 @@ class FlowDecorator:
1976
1976
  # manually here.
1977
1977
  @staticmethod
1978
1978
  def from_source(
1979
- source: Union[str, "RunnerStorage", ReadableDeploymentStorage],
1979
+ source: Union[str, Path, "RunnerStorage", ReadableDeploymentStorage],
1980
1980
  entrypoint: str,
1981
1981
  ) -> Union["Flow[..., Any]", Coroutine[Any, Any, "Flow[..., Any]"]]: ...
1982
1982
 
@@ -1,6 +1,6 @@
1
1
  import logging
2
- import os
3
2
  import re
3
+ import socket
4
4
  from typing import TYPE_CHECKING
5
5
  from urllib.parse import urljoin
6
6
  from uuid import UUID
@@ -74,7 +74,7 @@ def setup_exporters(
74
74
  resource = Resource.create(
75
75
  {
76
76
  "service.name": "prefect",
77
- "service.instance.id": os.uname().nodename,
77
+ "service.instance.id": socket.gethostname(),
78
78
  "prefect.account": str(account_id),
79
79
  "prefect.workspace": str(workspace_id),
80
80
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: prefect-client
3
- Version: 3.3.5.dev2
3
+ Version: 3.3.5.dev3
4
4
  Summary: Workflow orchestration and management.
5
5
  Project-URL: Changelog, https://github.com/PrefectHQ/prefect/releases
6
6
  Project-URL: Documentation, https://docs.prefect.io
@@ -1,7 +1,7 @@
1
1
  prefect/.prefectignore,sha256=awSprvKT0vI8a64mEOLrMxhxqcO-b0ERQeYpA2rNKVQ,390
2
2
  prefect/__init__.py,sha256=iCdcC5ZmeewikCdnPEP6YBAjPNV5dvfxpYCTpw30Hkw,3685
3
3
  prefect/__main__.py,sha256=WFjw3kaYJY6pOTA7WDOgqjsz8zUEUZHCcj3P5wyVa-g,66
4
- prefect/_build_info.py,sha256=9v_bp8SIJzHgTGSYs4s0GVRRGp5xvUW88ESTSXNP4Gs,185
4
+ prefect/_build_info.py,sha256=8rZCXd-Nz2-o4Nm_4yyvy6osOkdGCLiuhickzD7KvFM,185
5
5
  prefect/_result_records.py,sha256=S6QmsODkehGVSzbMm6ig022PYbI6gNKz671p_8kBYx4,7789
6
6
  prefect/_waiters.py,sha256=Ia2ITaXdHzevtyWIgJoOg95lrEXQqNEOquHvw3T33UQ,9026
7
7
  prefect/agent.py,sha256=dPvG1jDGD5HSH7aM2utwtk6RaJ9qg13XjkA0lAIgQmY,287
@@ -14,7 +14,7 @@ prefect/exceptions.py,sha256=wZLQQMRB_DyiYkeEdIC5OKwbba5A94Dlnics-lrWI7A,11581
14
14
  prefect/filesystems.py,sha256=v5YqGB4uXf9Ew2VuB9VCSkawvYMMVvEtZf7w1VmAmr8,18036
15
15
  prefect/flow_engine.py,sha256=hZpTYEtwTPMtwVoTCrfD93igN7rlKeG_0kyCvdU4aYE,58876
16
16
  prefect/flow_runs.py,sha256=dbHcXsOq1UsNM7vyJV9gboCTylmdUwQ_-W4NQt4R4ds,17267
17
- prefect/flows.py,sha256=0Es8TYUUEItxAz6G50eUmlIAXDaUTh4U0dQvgUyW2rk,109529
17
+ prefect/flows.py,sha256=kBLT6M903ZFD4TUvmvRN-zOdNcjSlIO9d2kHhPYq5Oo,109547
18
18
  prefect/futures.py,sha256=ZD5rdgUHA4sfxwHaPToumOUKlyn4d989JHR7eI97-Hs,23271
19
19
  prefect/main.py,sha256=8V-qLB4GjEVCkGRgGXeaIk-JIXY8Z9FozcNluj4Sm9E,2589
20
20
  prefect/plugins.py,sha256=FPRLR2mWVBMuOnlzeiTD9krlHONZH2rtYLD753JQDNQ,2516
@@ -146,7 +146,7 @@ prefect/docker/__init__.py,sha256=z6wdc6UFfiBG2jb9Jk64uCWVM04JKVWeVyDWwuuon8M,52
146
146
  prefect/docker/docker_image.py,sha256=bR_pEq5-FDxlwTj8CP_7nwZ_MiGK6KxIi8v7DRjy1Kg,3138
147
147
  prefect/events/__init__.py,sha256=GtKl2bE--pJduTxelH2xy7SadlLJmmis8WR1EYixhuA,2094
148
148
  prefect/events/actions.py,sha256=A7jS8bo4zWGnrt3QfSoQs0uYC1xfKXio3IfU0XtTb5s,9129
149
- prefect/events/clients.py,sha256=XA33NpeRdgVglt7J47uFdpASa1bCvcKWyxsxQt3vEPQ,27290
149
+ prefect/events/clients.py,sha256=g_LNcPtYd1Erbz1q4UI33e5dmPjQv_OeejoYGkASs5w,27581
150
150
  prefect/events/filters.py,sha256=2hVfzc3Rdgy0mBHDutWxT__LJY0zpVM8greWX3y6kjM,8233
151
151
  prefect/events/related.py,sha256=CTeexYUmmA93V4gsR33GIFmw-SS-X_ouOpRg-oeq-BU,6672
152
152
  prefect/events/utilities.py,sha256=ww34bTMENCNwcp6RhhgzG0KgXOvKGe0MKmBdSJ8NpZY,3043
@@ -269,7 +269,7 @@ prefect/settings/models/server/tasks.py,sha256=_CaOUfh3WDXvUhmHXmR-MkTRaQqocZck4
269
269
  prefect/settings/models/server/ui.py,sha256=hShsi4rPBtdJA2WnT1Er0tWqu-e5wUum8NkNgucShkk,1867
270
270
  prefect/telemetry/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
271
271
  prefect/telemetry/bootstrap.py,sha256=XaYlK4OTaloQX63AG7IfvGD7yH5LOsXfol4pPfaXSBI,1537
272
- prefect/telemetry/instrumentation.py,sha256=1wVdROX8Nz3P4Ja3we92UjRH1xF45Pm2sAA3rZ5rqtw,4727
272
+ prefect/telemetry/instrumentation.py,sha256=5b8b5183IrmBgH722c2TIQHpjBrE0vlRqcKpfwRG0a0,4732
273
273
  prefect/telemetry/logging.py,sha256=ktIVTXbdZ46v6fUhoHNidFrpvpNJR-Pj-hQ4V9b40W4,789
274
274
  prefect/telemetry/processors.py,sha256=jw6j6LviOVxw3IBJe7cSjsxFk0zzY43jUmy6C9pcfCE,2272
275
275
  prefect/telemetry/run_telemetry.py,sha256=_FbjiPqPemu4xvZuI2YBPwXeRJ2BcKRJ6qgO4UMzKKE,8571
@@ -316,7 +316,7 @@ prefect/workers/cloud.py,sha256=dPvG1jDGD5HSH7aM2utwtk6RaJ9qg13XjkA0lAIgQmY,287
316
316
  prefect/workers/process.py,sha256=uxOwcqA2Ps-V-W6WeSdKCQMINrCxBEVx1K1Un8pb7vs,8973
317
317
  prefect/workers/server.py,sha256=2pmVeJZiVbEK02SO6BEZaBIvHMsn6G8LzjW8BXyiTtk,1952
318
318
  prefect/workers/utilities.py,sha256=VfPfAlGtTuDj0-Kb8WlMgAuOfgXCdrGAnKMapPSBrwc,2483
319
- prefect_client-3.3.5.dev2.dist-info/METADATA,sha256=2b-83_Kqas9tWXn7tvjZrkWWe3B0pEtWxkswl69Yg2U,7456
320
- prefect_client-3.3.5.dev2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
321
- prefect_client-3.3.5.dev2.dist-info/licenses/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
322
- prefect_client-3.3.5.dev2.dist-info/RECORD,,
319
+ prefect_client-3.3.5.dev3.dist-info/METADATA,sha256=LcejbNc0zC2HoeBq6bkhgj5Pyne1GPZwmi9SLwEwCBc,7456
320
+ prefect_client-3.3.5.dev3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
321
+ prefect_client-3.3.5.dev3.dist-info/licenses/LICENSE,sha256=MCxsn8osAkzfxKC4CC_dLcUkU8DZLkyihZ8mGs3Ah3Q,11357
322
+ prefect_client-3.3.5.dev3.dist-info/RECORD,,