cycls 0.0.2.100__py3-none-any.whl → 0.0.2.101__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/app.py +2 -9
- cycls/function.py +1 -46
- cycls/themes/default/assets/html-to-docx.esm-DbAOvYyE.js +554 -0
- cycls/themes/default/assets/html2canvas.esm-QH1iLAAe.js +22 -0
- cycls/themes/default/assets/{index-oGkkm3Z8.css → index-CjN0qc53.css} +1 -1
- cycls/themes/default/assets/index-CoyOzdkL.js +662 -0
- cycls/themes/default/assets/index.es-DMEUqx7I.js +18 -0
- cycls/themes/default/assets/jspdf.es.min-eVFWSv5x.js +146 -0
- cycls/themes/default/assets/purify.es-B9ZVCkUG.js +2 -0
- cycls/themes/default/index.html +2 -2
- {cycls-0.0.2.100.dist-info → cycls-0.0.2.101.dist-info}/METADATA +1 -1
- cycls-0.0.2.101.dist-info/RECORD +20 -0
- cycls/themes/default/assets/index-D35zsiL3.js +0 -432
- cycls-0.0.2.100.dist-info/RECORD +0 -15
- {cycls-0.0.2.100.dist-info → cycls-0.0.2.101.dist-info}/WHEEL +0 -0
- {cycls-0.0.2.100.dist-info → cycls-0.0.2.101.dist-info}/entry_points.txt +0 -0
cycls/app.py
CHANGED
|
@@ -73,19 +73,12 @@ class App(Function):
|
|
|
73
73
|
self._prepare_func(prod=False)
|
|
74
74
|
self.watch(port=port) if watch else self.run(port=port)
|
|
75
75
|
|
|
76
|
-
def deploy(self, port=8080):
|
|
76
|
+
def deploy(self, port=8080, memory=None):
|
|
77
77
|
"""Deploy to production."""
|
|
78
78
|
if self.api_key is None:
|
|
79
79
|
raise RuntimeError("Missing API key. Set cycls.api_key or CYCLS_API_KEY environment variable.")
|
|
80
80
|
self._prepare_func(prod=True)
|
|
81
|
-
return super().deploy(port=port)
|
|
82
|
-
|
|
83
|
-
def _deploy(self, port=8080, memory=None):
|
|
84
|
-
"""Deploy to testing infrastructure."""
|
|
85
|
-
if self.api_key is None:
|
|
86
|
-
raise RuntimeError("Missing API key. Set cycls.api_key or CYCLS_API_KEY environment variable.")
|
|
87
|
-
self._prepare_func(prod=True)
|
|
88
|
-
return super()._deploy(port=port, memory=memory or self.memory)
|
|
81
|
+
return super().deploy(port=port, memory=memory or self.memory)
|
|
89
82
|
|
|
90
83
|
|
|
91
84
|
def app(name=None, **kwargs):
|
cycls/function.py
CHANGED
|
@@ -110,7 +110,7 @@ class Function:
|
|
|
110
110
|
|
|
111
111
|
@property
|
|
112
112
|
def base_url(self):
|
|
113
|
-
return self._base_url or _get_base_url() or "https://
|
|
113
|
+
return self._base_url or _get_base_url() or "https://api.cycls.ai"
|
|
114
114
|
|
|
115
115
|
@property
|
|
116
116
|
def docker_client(self):
|
|
@@ -366,51 +366,6 @@ CMD ["python", "entrypoint.py"]
|
|
|
366
366
|
def deploy(self, *args, **kwargs):
|
|
367
367
|
import requests
|
|
368
368
|
|
|
369
|
-
port = kwargs.pop('port', 8080)
|
|
370
|
-
print(f"Deploying '{self.name}'...")
|
|
371
|
-
|
|
372
|
-
payload = cloudpickle.dumps((self.func, args, {**kwargs, 'port': port}))
|
|
373
|
-
archive_name = f"{self.name}-{hashlib.sha256(payload).hexdigest()[:16]}.tar.gz"
|
|
374
|
-
|
|
375
|
-
with tempfile.TemporaryDirectory() as tmpdir:
|
|
376
|
-
workdir = Path(tmpdir)
|
|
377
|
-
self._prepare_deploy_context(workdir, port, args, kwargs)
|
|
378
|
-
|
|
379
|
-
archive_path = workdir / archive_name
|
|
380
|
-
with tarfile.open(archive_path, "w:gz") as tar:
|
|
381
|
-
for f in workdir.glob("**/*"):
|
|
382
|
-
if f.is_file() and f != archive_path:
|
|
383
|
-
tar.add(f, arcname=f.relative_to(workdir))
|
|
384
|
-
|
|
385
|
-
print("Uploading build context...")
|
|
386
|
-
try:
|
|
387
|
-
with open(archive_path, 'rb') as f:
|
|
388
|
-
response = requests.post(
|
|
389
|
-
f"{self.base_url}/v1/deploy",
|
|
390
|
-
data={"function_name": self.name, "port": port},
|
|
391
|
-
files={'source_archive': (archive_name, f, 'application/gzip')},
|
|
392
|
-
headers={"X-API-Key": self.api_key},
|
|
393
|
-
timeout=9000
|
|
394
|
-
)
|
|
395
|
-
response.raise_for_status()
|
|
396
|
-
result = response.json()
|
|
397
|
-
print(f"Deployed: {result['url']}")
|
|
398
|
-
return result['url']
|
|
399
|
-
|
|
400
|
-
except requests.exceptions.HTTPError as e:
|
|
401
|
-
print(f"Deploy failed: {e.response.status_code}")
|
|
402
|
-
try:
|
|
403
|
-
print(f" {e.response.json()['detail']}")
|
|
404
|
-
except (json.JSONDecodeError, KeyError):
|
|
405
|
-
print(f" {e.response.text}")
|
|
406
|
-
return None
|
|
407
|
-
except requests.exceptions.RequestException as e:
|
|
408
|
-
print(f"Connection error: {e}")
|
|
409
|
-
return None
|
|
410
|
-
|
|
411
|
-
def _deploy(self, *args, **kwargs):
|
|
412
|
-
import requests
|
|
413
|
-
|
|
414
369
|
base_url = self.base_url
|
|
415
370
|
port = kwargs.pop('port', 8080)
|
|
416
371
|
memory = kwargs.pop('memory', '1Gi')
|