beamlit 0.0.31rc40__py3-none-any.whl → 0.0.31rc42__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
beamlit/deploy/deploy.py CHANGED
@@ -23,7 +23,7 @@ from .parser import Resource, get_description, get_parameters, get_resources
23
23
  sys.path.insert(0, os.getcwd())
24
24
  sys.path.insert(0, os.path.join(os.getcwd(), "src"))
25
25
 
26
-
26
+ random_id = str(uuid.uuid4())[:8]
27
27
  def slugify(name: str) -> str:
28
28
  return name.lower().replace(" ", "-").replace("_", "-")
29
29
 
@@ -32,7 +32,7 @@ def get_runtime_image(type: str, name: str) -> str:
32
32
  registry_url = settings.registry_url.replace("https://", "").replace("http://", "")
33
33
  image = f"{registry_url}/{settings.workspace}/{type}s/{name}"
34
34
  # Generate a random ID to ensure unique image tags
35
- image = f"{image}:{str(uuid.uuid4())[:8]}"
35
+ image = f"{image}:{random_id}"
36
36
  return image
37
37
 
38
38
 
@@ -68,10 +68,16 @@ def kit(bl_kit: FunctionKit = None, **kwargs: dict) -> Callable:
68
68
  return wrapper
69
69
 
70
70
 
71
- def function(*args, function: Function = None, kit=False, **kwargs: dict) -> Callable:
71
+ def function(*args, function: Function | dict = None, kit=False, **kwargs: dict) -> Callable:
72
72
  """Create function tools with Beamlit and LangChain integration."""
73
73
  settings = get_settings()
74
-
74
+ if function is not None and not isinstance(function, dict):
75
+ raise Exception(
76
+ 'function must be a dictionary, example: @function(function={"metadata": {"name": "my_function"}})'
77
+ )
78
+ if isinstance(function, dict):
79
+ function = Function(**function)
80
+
75
81
  def wrapper(func: Callable) -> Callable:
76
82
  if function and not func.__doc__ and function.spec and function.spec.description:
77
83
  func.__doc__ = function.spec.description
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: beamlit
3
- Version: 0.0.31rc40
3
+ Version: 0.0.31rc42
4
4
  Summary: Add your description here
5
5
  Author-email: cploujoux <ch.ploujoux@gmail.com>
6
6
  Requires-Python: >=3.12
@@ -137,11 +137,11 @@ beamlit/common/secrets.py,sha256=sid81bOe3LflkMKDHwBsBs9nIju8bp5-v9qU9gkyNMc,212
137
137
  beamlit/common/settings.py,sha256=_4oCVrJZOMaTZoK2Zzo2DWqtUyBsspuOH3iAJ_nU0tw,5923
138
138
  beamlit/common/utils.py,sha256=jouz5igBvT37Xn_e94-foCHyQczVim-UzVcoIF6RWJ4,657
139
139
  beamlit/deploy/__init__.py,sha256=GS7l7Jtm2yKs7iNLKcfjYO-rAhUzggQ3xiYSf3oxLBY,91
140
- beamlit/deploy/deploy.py,sha256=5rcPJhz0xtjG_9EUpZuoSwgIkqbE-LPqSF1FoXarMQM,9915
140
+ beamlit/deploy/deploy.py,sha256=xo2fAdF6jR1cG75sXMzpqsJlG_qGAKVnMwjuDa_8sk8,9936
141
141
  beamlit/deploy/format.py,sha256=PJ8kU7Y1pwiS3tqqyvFaag9LO3jju-4ua574163VPk4,1820
142
142
  beamlit/deploy/parser.py,sha256=Ga0poCZkoRnuTw082QnTcNGCBJncoRAnVsn8-1FsaJE,6907
143
143
  beamlit/functions/__init__.py,sha256=_RPG1Bfg54JGdIPnViAU6n9zD7E1cDNsdXi8oYGskzE,138
144
- beamlit/functions/decorator.py,sha256=G7bdJjHgqPkRs_FKR-lIp-T0-wjRcc8W6AgmRrxsQoc,3240
144
+ beamlit/functions/decorator.py,sha256=YNNU8MZXV2C6gIjxaYhp-FSWGLc9I_XLsIE24zQ3fr8,3541
145
145
  beamlit/functions/github/__init__.py,sha256=gYnUkeegukOfbymdabuuJkScvH-_ZJygX05BoqkPn0o,49
146
146
  beamlit/functions/github/github.py,sha256=FajzLCNkpXcwfgnC0l9rOGT2eSPLCz8-qrMzK9N_ZNc,598
147
147
  beamlit/functions/github/kit/__init__.py,sha256=jBwPqZv6C23_utukohxqXZwrlicNlI7PYPUj0Den7Cw,136
@@ -256,6 +256,6 @@ beamlit/serve/app.py,sha256=QzReZZjGFQWhNA1XBDq81rsn9zpEihtLZLrfZi9ThT0,3554
256
256
  beamlit/serve/middlewares/__init__.py,sha256=1dVmnOmhAQWvWktqHkKSIX-YoF6fmMU8xkUQuhg_rJU,148
257
257
  beamlit/serve/middlewares/accesslog.py,sha256=Mu4T4_9OvHybjA0ApzZFpgi2C8f3X1NbUk-76v634XM,631
258
258
  beamlit/serve/middlewares/processtime.py,sha256=lDAaIasZ4bwvN-HKHvZpaD9r-yrkVNZYx4abvbjbrCg,411
259
- beamlit-0.0.31rc40.dist-info/METADATA,sha256=aozXRVioMl7voT5SN7PxYABY_13VI_CEw913zgeo1lo,2405
260
- beamlit-0.0.31rc40.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
261
- beamlit-0.0.31rc40.dist-info/RECORD,,
259
+ beamlit-0.0.31rc42.dist-info/METADATA,sha256=9DQPwNYvv6Q3ailPx5xQTQCxOyzOKlD8xuLp6qcBhck,2405
260
+ beamlit-0.0.31rc42.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
261
+ beamlit-0.0.31rc42.dist-info/RECORD,,