cycls 0.0.2.100__tar.gz → 0.0.2.102__tar.gz

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.
Files changed (22) hide show
  1. {cycls-0.0.2.100 → cycls-0.0.2.102}/PKG-INFO +1 -1
  2. {cycls-0.0.2.100 → cycls-0.0.2.102}/cycls/app.py +2 -9
  3. {cycls-0.0.2.100 → cycls-0.0.2.102}/cycls/function.py +1 -46
  4. cycls-0.0.2.102/cycls/themes/default/assets/FileSaver.min-BN40akLc.js +1 -0
  5. cycls-0.0.2.102/cycls/themes/default/assets/html2canvas.esm-QH1iLAAe.js +22 -0
  6. cycls-0.0.2.102/cycls/themes/default/assets/index-3AQCbjkB.js +29 -0
  7. cycls-0.0.2.100/cycls/themes/default/assets/index-oGkkm3Z8.css → cycls-0.0.2.102/cycls/themes/default/assets/index-CjN0qc53.css +1 -1
  8. cycls-0.0.2.102/cycls/themes/default/assets/index-qcHL6SRo.js +719 -0
  9. cycls-0.0.2.102/cycls/themes/default/assets/index.es-BmxgotDY.js +18 -0
  10. cycls-0.0.2.102/cycls/themes/default/assets/jspdf.es.min-CvOy4co6.js +146 -0
  11. cycls-0.0.2.102/cycls/themes/default/assets/purify.es-B9ZVCkUG.js +2 -0
  12. {cycls-0.0.2.100 → cycls-0.0.2.102}/cycls/themes/default/index.html +2 -2
  13. {cycls-0.0.2.100 → cycls-0.0.2.102}/pyproject.toml +1 -1
  14. cycls-0.0.2.100/cycls/themes/default/assets/index-D35zsiL3.js +0 -432
  15. {cycls-0.0.2.100 → cycls-0.0.2.102}/.gitignore +0 -0
  16. {cycls-0.0.2.100 → cycls-0.0.2.102}/README.md +0 -0
  17. {cycls-0.0.2.100 → cycls-0.0.2.102}/cycls/__init__.py +0 -0
  18. {cycls-0.0.2.100 → cycls-0.0.2.102}/cycls/auth.py +0 -0
  19. {cycls-0.0.2.100 → cycls-0.0.2.102}/cycls/cli.py +0 -0
  20. {cycls-0.0.2.100 → cycls-0.0.2.102}/cycls/state.py +0 -0
  21. {cycls-0.0.2.100 → cycls-0.0.2.102}/cycls/themes/dev/index.html +0 -0
  22. {cycls-0.0.2.100 → cycls-0.0.2.102}/cycls/web.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cycls
3
- Version: 0.0.2.100
3
+ Version: 0.0.2.102
4
4
  Summary: Distribute Intelligence
5
5
  Author-email: "Mohammed J. AlRujayi" <mj@cycls.com>
6
6
  Requires-Python: >=3.10
@@ -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):
@@ -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://service-core-280879789566.me-central1.run.app"
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')
@@ -0,0 +1 @@
1
+ import{c as p,g as _}from"./index-qcHL6SRo.js";function x(u,m){for(var l=0;l<m.length;l++){const r=m[l];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in u)){const c=Object.getOwnPropertyDescriptor(r,s);c&&Object.defineProperty(u,s,c.get?c:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}))}var v={exports:{}},F=v.exports,E;function O(){return E||(E=1,(function(u,m){(function(l,r){r()})(F,function(){function l(e,t){return typeof t>"u"?t={autoBom:!1}:typeof t!="object"&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e}function r(e,t,i){var n=new XMLHttpRequest;n.open("GET",e),n.responseType="blob",n.onload=function(){d(n.response,t,i)},n.onerror=function(){console.error("could not download file")},n.send()}function s(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return 200<=t.status&&299>=t.status}function c(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var a=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof p=="object"&&p.global===p?p:void 0,b=a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),d=a.saveAs||(typeof window!="object"||window!==a?function(){}:"download"in HTMLAnchorElement.prototype&&!b?function(e,t,i){var n=a.URL||a.webkitURL,o=document.createElement("a");t=t||e.name||"download",o.download=t,o.rel="noopener",typeof e=="string"?(o.href=e,o.origin===location.origin?c(o):s(o.href)?r(e,t,i):c(o,o.target="_blank")):(o.href=n.createObjectURL(e),setTimeout(function(){n.revokeObjectURL(o.href)},4e4),setTimeout(function(){c(o)},0))}:"msSaveOrOpenBlob"in navigator?function(e,t,i){if(t=t||e.name||"download",typeof e!="string")navigator.msSaveOrOpenBlob(l(e,i),t);else if(s(e))r(e,t,i);else{var n=document.createElement("a");n.href=e,n.target="_blank",setTimeout(function(){c(n)})}}:function(e,t,i,n){if(n=n||open("","_blank"),n&&(n.document.title=n.document.body.innerText="downloading..."),typeof e=="string")return r(e,t,i);var o=e.type==="application/octet-stream",S=/constructor/i.test(a.HTMLElement)||a.safari,h=/CriOS\/[\d]+/.test(navigator.userAgent);if((h||o&&S||b)&&typeof FileReader<"u"){var w=new FileReader;w.onloadend=function(){var f=w.result;f=h?f:f.replace(/^data:[^;]*;/,"data:attachment/file;"),n?n.location.href=f:location=f,n=null},w.readAsDataURL(e)}else{var j=a.URL||a.webkitURL,y=j.createObjectURL(e);n?n.location=y:location.href=y,n=null,setTimeout(function(){j.revokeObjectURL(y)},4e4)}});a.saveAs=d.saveAs=d,u.exports=d})})(v)),v.exports}var g=O();const R=_(g),L=x({__proto__:null,default:R},[g]);export{L as F};