cycls 0.0.2.35__py3-none-any.whl → 0.0.2.36__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.
cycls/runtime.py CHANGED
@@ -118,6 +118,7 @@ class Runtime:
118
118
  sys.exit(1)
119
119
  return self._docker_client
120
120
 
121
+ # docker system prune -af
121
122
  def _perform_auto_cleanup(self):
122
123
  """Performs a simple, automatic cleanup of old Docker resources."""
123
124
  try:
@@ -125,7 +126,7 @@ class Runtime:
125
126
  container.remove(force=True)
126
127
 
127
128
  cleaned_images = 0
128
- for image in self.docker_client.images.list(name=self.image_prefix):
129
+ for image in self.docker_client.images.list(all=True, filters={"label": self.managed_label}):
129
130
  is_current = self.tag in image.tags
130
131
  is_deployable = any(t.startswith(f"{self.image_prefix}:deploy-") for t in image.tags)
131
132
 
@@ -168,11 +169,7 @@ class Runtime:
168
169
  if self.apt_packages else ""
169
170
  )
170
171
  run_shell_commands = "\n".join([f"RUN {cmd}" for cmd in self.run_commands]) if self.run_commands else ""
171
-
172
- # fixes absolute path copy, but causes collision
173
- copy_lines = "\n".join([f"COPY {Path(src).name} {dst}" for src, dst in self.copy.items()])
174
- # copy_lines = "\n".join([f"COPY {src} {dst}" for src, dst in self.copy.items()])
175
-
172
+ copy_lines = "\n".join([f"COPY context_files/{dst} {dst}" for dst in self.copy.values()])
176
173
  expose_line = f"EXPOSE {port}" if port else ""
177
174
 
178
175
  return f"""
@@ -198,6 +195,16 @@ COPY {self.payload_file} {self.io_dir}/
198
195
  """Prepares a complete build context in the given directory."""
199
196
  port = kwargs.get('port') if kwargs else None
200
197
 
198
+ # Create a dedicated subdirectory for all user-copied files
199
+ context_files_dir = workdir / "context_files"
200
+ context_files_dir.mkdir()
201
+
202
+ if self.copy:
203
+ for src, dst in self.copy.items():
204
+ src_path = Path(src).resolve() # Resolve to an absolute path
205
+ dest_in_context = context_files_dir / dst
206
+ _copy_path(src_path, dest_in_context)
207
+
201
208
  (workdir / "Dockerfile").write_text(self._generate_dockerfile(port=port))
202
209
  (workdir / self.runner_filename).write_text(self.runner_script)
203
210
 
@@ -205,16 +212,6 @@ COPY {self.payload_file} {self.io_dir}/
205
212
  payload_bytes = cloudpickle.dumps((self.func, args or [], kwargs or {}))
206
213
  (workdir / self.payload_file).write_bytes(payload_bytes)
207
214
 
208
- if self.copy:
209
- # for src in self.copy.keys():
210
- # _copy_path(Path(src), workdir / src)
211
-
212
- # fixes absolute path copy
213
- for src in self.copy.keys():
214
- src_path = Path(src)
215
- dest_path = workdir / src_path.name if src_path.is_absolute() else workdir / src
216
- _copy_path(src_path, dest_path)
217
-
218
215
  def _build_image_if_needed(self):
219
216
  """Checks if the base Docker image exists locally and builds it if not."""
220
217
  try:
@@ -235,7 +232,8 @@ COPY {self.payload_file} {self.io_dir}/
235
232
  tag=self.tag,
236
233
  forcerm=True,
237
234
  decode=True,
238
- target='base' # Only build the 'base' stage
235
+ target='base', # Only build the 'base' stage
236
+ labels={self.managed_label: "true"}, # image label
239
237
  )
240
238
  try:
241
239
  for chunk in response_generator:
@@ -269,7 +267,7 @@ COPY {self.payload_file} {self.io_dir}/
269
267
  image=self.tag,
270
268
  volumes={str(tmpdir): {'bind': self.io_dir, 'mode': 'rw'}},
271
269
  ports=ports_mapping,
272
- labels={self.managed_label: "true"}
270
+ labels={self.managed_label: "true"} # container label
273
271
  )
274
272
  container.start()
275
273
  yield container, result_path
cycls/sdk.py CHANGED
@@ -102,6 +102,7 @@ class Agent:
102
102
  with modal.enable_output(), run_app(app=self.app, client=self.client):
103
103
  while True: time.sleep(10)
104
104
 
105
+ # docker system prune -af
105
106
  # poetry config pypi-token.pypi <your-token>
106
- # poetry run python agent.py
107
+ # poetry run python agent-cycls.py
107
108
  # poetry publish --build
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cycls
3
- Version: 0.0.2.35
3
+ Version: 0.0.2.36
4
4
  Summary: Cycls SDK
5
5
  Author: Mohammed J. AlRujayi
6
6
  Author-email: mj@cycls.com
@@ -1,9 +1,9 @@
1
1
  cycls/__init__.py,sha256=ysfA4R_r_INokmpZGK2S8wf2ypLCqwyj0WdfX-hx0bs,51
2
- cycls/runtime.py,sha256=U0dMUs9dxgjMTbtv9dzK3MQ57g8kun0ICqA30Cx9cBA,18187
3
- cycls/sdk.py,sha256=gEdxYDtYE6FOWwLS33k0h5wuzwdcB9kvTMrkEBmz2iE,4573
2
+ cycls/runtime.py,sha256=trgRKoUjACeQ-htYp7ENI4CR23m5DmuHLI4ivHaZZ8Y,18209
3
+ cycls/sdk.py,sha256=IVdrcvR0Y7aGTFV7f5btiadA4qylHgA1sTMildRJZds,4605
4
4
  cycls/theme/assets/index-D0-uI8sw.js,sha256=aUsqm9HZtEJz38o-0MW12ZVeOlSeKigwc_fYJBntiyI,1068551
5
5
  cycls/theme/index.html,sha256=epB4cgSjC7xJOXpVuCwt9r7ivoGvLiXSrxsoOgINw58,895
6
6
  cycls/web.py,sha256=nSEJMUQoPaz8qjgVmsC1JiDRv9Y1UKVzTH4_pRHp_VE,4260
7
- cycls-0.0.2.35.dist-info/METADATA,sha256=DztQ_n4XO8rvuwGq-bN7Y028yINUNjcH3XYbjF-OKsI,5666
8
- cycls-0.0.2.35.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
9
- cycls-0.0.2.35.dist-info/RECORD,,
7
+ cycls-0.0.2.36.dist-info/METADATA,sha256=CtSUOvZuSeAMih2pJPT3YlCvj8vtty_mDKsJogMXW7I,5666
8
+ cycls-0.0.2.36.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
9
+ cycls-0.0.2.36.dist-info/RECORD,,