jaseci 1.3.1.3__tar.gz → 2.2.7__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.
- jaseci-2.2.7/PKG-INFO +54 -0
- jaseci-2.2.7/README.md +35 -0
- jaseci-2.2.7/jaseci/__init__.py +3 -0
- jaseci-2.2.7/jaseci.egg-info/PKG-INFO +54 -0
- jaseci-2.2.7/jaseci.egg-info/SOURCES.txt +8 -0
- jaseci-2.2.7/jaseci.egg-info/requires.txt +5 -0
- jaseci-2.2.7/pyproject.toml +42 -0
- jaseci-1.3.1.3/LICENSE +0 -21
- jaseci-1.3.1.3/PKG-INFO +0 -10
- jaseci-1.3.1.3/README.md +0 -1
- jaseci-1.3.1.3/jaseci/__init__.py +0 -0
- jaseci-1.3.1.3/jaseci/actions/__init__.py +0 -0
- jaseci-1.3.1.3/jaseci/actions/live_actions.py +0 -130
- jaseci-1.3.1.3/jaseci/actions/remote_actions.py +0 -82
- jaseci-1.3.1.3/jaseci/actions/standard/__init__.py +0 -0
- jaseci-1.3.1.3/jaseci/actions/standard/date.py +0 -51
- jaseci-1.3.1.3/jaseci/actions/standard/file.py +0 -42
- jaseci-1.3.1.3/jaseci/actions/standard/net.py +0 -18
- jaseci-1.3.1.3/jaseci/actions/standard/rand.py +0 -39
- jaseci-1.3.1.3/jaseci/actions/standard/request.py +0 -117
- jaseci-1.3.1.3/jaseci/actions/standard/std.py +0 -153
- jaseci-1.3.1.3/jaseci/actions/standard/vector.py +0 -74
- jaseci-1.3.1.3/jaseci/actions/tests/__init__.py +0 -0
- jaseci-1.3.1.3/jaseci/actions/tests/test_actions.py +0 -49
- jaseci-1.3.1.3/jaseci/actor/__init__.py +0 -0
- jaseci-1.3.1.3/jaseci/actor/architype.py +0 -32
- jaseci-1.3.1.3/jaseci/actor/sentinel.py +0 -242
- jaseci-1.3.1.3/jaseci/actor/walker.py +0 -183
- jaseci-1.3.1.3/jaseci/api/__init__.py +0 -0
- jaseci-1.3.1.3/jaseci/api/actions_api.py +0 -68
- jaseci-1.3.1.3/jaseci/api/alias_api.py +0 -150
- jaseci-1.3.1.3/jaseci/api/architype_api.py +0 -153
- jaseci-1.3.1.3/jaseci/api/config_api.py +0 -77
- jaseci-1.3.1.3/jaseci/api/global_api.py +0 -63
- jaseci-1.3.1.3/jaseci/api/graph_api.py +0 -131
- jaseci-1.3.1.3/jaseci/api/interface.py +0 -221
- jaseci-1.3.1.3/jaseci/api/jac_api.py +0 -90
- jaseci-1.3.1.3/jaseci/api/logger_api.py +0 -65
- jaseci-1.3.1.3/jaseci/api/master_api.py +0 -117
- jaseci-1.3.1.3/jaseci/api/object_api.py +0 -77
- jaseci-1.3.1.3/jaseci/api/sentinel_api.py +0 -212
- jaseci-1.3.1.3/jaseci/api/stripe_api.py +0 -207
- jaseci-1.3.1.3/jaseci/api/super_api.py +0 -23
- jaseci-1.3.1.3/jaseci/api/walker_api.py +0 -186
- jaseci-1.3.1.3/jaseci/attr/__init__.py +0 -0
- jaseci-1.3.1.3/jaseci/attr/action.py +0 -45
- jaseci-1.3.1.3/jaseci/attr/item.py +0 -29
- jaseci-1.3.1.3/jaseci/element/__init__.py +0 -0
- jaseci-1.3.1.3/jaseci/element/element.py +0 -219
- jaseci-1.3.1.3/jaseci/element/master.py +0 -44
- jaseci-1.3.1.3/jaseci/element/obj_mixins.py +0 -150
- jaseci-1.3.1.3/jaseci/element/super_master.py +0 -21
- jaseci-1.3.1.3/jaseci/graph/__init__.py +0 -0
- jaseci-1.3.1.3/jaseci/graph/edge.py +0 -186
- jaseci-1.3.1.3/jaseci/graph/graph.py +0 -75
- jaseci-1.3.1.3/jaseci/graph/node.py +0 -375
- jaseci-1.3.1.3/jaseci/jac/__init__.py +0 -0
- jaseci-1.3.1.3/jaseci/jac/code_gen/__init__.py +0 -0
- jaseci-1.3.1.3/jaseci/jac/code_gen/architype_code_gen.py +0 -0
- jaseci-1.3.1.3/jaseci/jac/code_gen/code_gen.py +0 -1011
- jaseci-1.3.1.3/jaseci/jac/code_gen/walker_code_gen.py +0 -154
- jaseci-1.3.1.3/jaseci/jac/interpreter/__init__.py +0 -0
- jaseci-1.3.1.3/jaseci/jac/interpreter/architype_interp.py +0 -387
- jaseci-1.3.1.3/jaseci/jac/interpreter/interp.py +0 -1384
- jaseci-1.3.1.3/jaseci/jac/interpreter/sentinel_interp.py +0 -120
- jaseci-1.3.1.3/jaseci/jac/interpreter/walker_interp.py +0 -213
- jaseci-1.3.1.3/jaseci/jac/ir/__init__.py +0 -0
- jaseci-1.3.1.3/jaseci/jac/ir/ast.py +0 -253
- jaseci-1.3.1.3/jaseci/jac/ir/jac_code.py +0 -114
- jaseci-1.3.1.3/jaseci/jac/jac_parse/__init__.py +0 -0
- jaseci-1.3.1.3/jaseci/jac/jac_parse/jacLexer.py +0 -487
- jaseci-1.3.1.3/jaseci/jac/jac_parse/jacListener.py +0 -948
- jaseci-1.3.1.3/jaseci/jac/jac_parse/jacParser.py +0 -8548
- jaseci-1.3.1.3/jaseci/jac/jac_set.py +0 -118
- jaseci-1.3.1.3/jaseci/jac/machine/__init__.py +0 -0
- jaseci-1.3.1.3/jaseci/jac/machine/builtin_refs.py +0 -23
- jaseci-1.3.1.3/jaseci/jac/machine/jac_scope.py +0 -81
- jaseci-1.3.1.3/jaseci/jac/machine/jac_value.py +0 -206
- jaseci-1.3.1.3/jaseci/jac/machine/jsx_machine.py +0 -110
- jaseci-1.3.1.3/jaseci/jac/machine/machine_state.py +0 -141
- jaseci-1.3.1.3/jaseci/jac/machine/op_codes.py +0 -21
- jaseci-1.3.1.3/jaseci/jac/tests/__init__.py +0 -0
- jaseci-1.3.1.3/jaseci/jac/tests/book_code.py +0 -625
- jaseci-1.3.1.3/jaseci/jac/tests/dot_code.py +0 -259
- jaseci-1.3.1.3/jaseci/jac/tests/test_book.py +0 -357
- jaseci-1.3.1.3/jaseci/jac/tests/test_dot.py +0 -119
- jaseci-1.3.1.3/jaseci/jsctl/__init__.py +0 -0
- jaseci-1.3.1.3/jaseci/jsctl/book_tools.py +0 -49
- jaseci-1.3.1.3/jaseci/jsctl/jsctl.py +0 -275
- jaseci-1.3.1.3/jaseci/jsctl/tests/__init__.py +0 -0
- jaseci-1.3.1.3/jaseci/jsctl/tests/test_jsctl.py +0 -308
- jaseci-1.3.1.3/jaseci/tests/__init__.py +0 -0
- jaseci-1.3.1.3/jaseci/tests/jac_test_code.py +0 -1230
- jaseci-1.3.1.3/jaseci/tests/test_core.py +0 -87
- jaseci-1.3.1.3/jaseci/tests/test_core_api.py +0 -132
- jaseci-1.3.1.3/jaseci/tests/test_jac.py +0 -744
- jaseci-1.3.1.3/jaseci/tests/test_ll_proto.py +0 -87
- jaseci-1.3.1.3/jaseci/tests/test_node.py +0 -108
- jaseci-1.3.1.3/jaseci/utils/__init__.py +0 -0
- jaseci-1.3.1.3/jaseci/utils/file_hook.py +0 -19
- jaseci-1.3.1.3/jaseci/utils/id_list.py +0 -153
- jaseci-1.3.1.3/jaseci/utils/mem_hook.py +0 -186
- jaseci-1.3.1.3/jaseci/utils/redis_hook.py +0 -128
- jaseci-1.3.1.3/jaseci/utils/utils.py +0 -249
- jaseci-1.3.1.3/jaseci.egg-info/PKG-INFO +0 -10
- jaseci-1.3.1.3/jaseci.egg-info/SOURCES.txt +0 -104
- jaseci-1.3.1.3/jaseci.egg-info/entry_points.txt +0 -2
- jaseci-1.3.1.3/jaseci.egg-info/requires.txt +0 -10
- jaseci-1.3.1.3/pyproject.toml +0 -6
- jaseci-1.3.1.3/setup.py +0 -19
- {jaseci-1.3.1.3 → jaseci-2.2.7}/jaseci.egg-info/dependency_links.txt +0 -0
- {jaseci-1.3.1.3 → jaseci-2.2.7}/jaseci.egg-info/top_level.txt +0 -0
- {jaseci-1.3.1.3 → jaseci-2.2.7}/setup.cfg +0 -0
jaseci-2.2.7/PKG-INFO
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: jaseci
|
|
3
|
+
Version: 2.2.7
|
|
4
|
+
Summary: Jaseci - A complete AI-native programming ecosystem with Jac language, LLM integration, and full-stack web apps
|
|
5
|
+
Author-email: Jason Mars <jason@mars.ninja>
|
|
6
|
+
Maintainer-email: Jason Mars <jason@mars.ninja>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: Repository, https://github.com/Jaseci-Labs/jaseci
|
|
9
|
+
Project-URL: Homepage, https://jaseci.org
|
|
10
|
+
Project-URL: Documentation, https://jac-lang.org
|
|
11
|
+
Keywords: jac,jaclang,jaseci,ai,llm,full-stack,web-apps,jac-client,jac-scale,programming-language,machine-learning,artificial-intelligence
|
|
12
|
+
Requires-Python: >=3.11
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
Requires-Dist: jaclang>=0.9.9
|
|
15
|
+
Requires-Dist: byllm>=0.4.14
|
|
16
|
+
Requires-Dist: jac-client>=0.2.9
|
|
17
|
+
Requires-Dist: jac-scale>=0.1.0
|
|
18
|
+
Requires-Dist: jac-super>=0.1.0
|
|
19
|
+
|
|
20
|
+
# Jaseci
|
|
21
|
+
|
|
22
|
+
### Complete AI-Native Programming Ecosystem
|
|
23
|
+
|
|
24
|
+
Jaseci is a **meta-package** that provides a unified installation for the complete Jaseci ecosystem.
|
|
25
|
+
|
|
26
|
+
## What's Included
|
|
27
|
+
|
|
28
|
+
When you install `jaseci`, you automatically get:
|
|
29
|
+
|
|
30
|
+
- **jaclang** - The Jac programming language
|
|
31
|
+
- **byllm** - LLM integration for AI-native programming
|
|
32
|
+
- **jac-client** - Full-stack web applications with React-like components in Jac
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install jaseci
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Quick Start
|
|
41
|
+
|
|
42
|
+
After installation, you can start using Jac:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
jac --help
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Documentation
|
|
49
|
+
|
|
50
|
+
- **Jac Language**: [https://www.jac-lang.org](https://www.jac-lang.org)
|
|
51
|
+
- **byLLM (AI Integration)**: [https://www.byllm.ai](https://www.byllm.ai)
|
|
52
|
+
- **Jac Client**: [https://docs.jaseci.org/jac-client/](https://docs.jaseci.org/jac-client/)
|
|
53
|
+
- **Jaseci Homepage**: [https://jaseci.org](https://jaseci.org)
|
|
54
|
+
- **GitHub Repository**: [https://github.com/Jaseci-Labs/jaseci](https://github.com/Jaseci-Labs/jaseci)
|
jaseci-2.2.7/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Jaseci
|
|
2
|
+
|
|
3
|
+
### Complete AI-Native Programming Ecosystem
|
|
4
|
+
|
|
5
|
+
Jaseci is a **meta-package** that provides a unified installation for the complete Jaseci ecosystem.
|
|
6
|
+
|
|
7
|
+
## What's Included
|
|
8
|
+
|
|
9
|
+
When you install `jaseci`, you automatically get:
|
|
10
|
+
|
|
11
|
+
- **jaclang** - The Jac programming language
|
|
12
|
+
- **byllm** - LLM integration for AI-native programming
|
|
13
|
+
- **jac-client** - Full-stack web applications with React-like components in Jac
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install jaseci
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Quick Start
|
|
22
|
+
|
|
23
|
+
After installation, you can start using Jac:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
jac --help
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Documentation
|
|
30
|
+
|
|
31
|
+
- **Jac Language**: [https://www.jac-lang.org](https://www.jac-lang.org)
|
|
32
|
+
- **byLLM (AI Integration)**: [https://www.byllm.ai](https://www.byllm.ai)
|
|
33
|
+
- **Jac Client**: [https://docs.jaseci.org/jac-client/](https://docs.jaseci.org/jac-client/)
|
|
34
|
+
- **Jaseci Homepage**: [https://jaseci.org](https://jaseci.org)
|
|
35
|
+
- **GitHub Repository**: [https://github.com/Jaseci-Labs/jaseci](https://github.com/Jaseci-Labs/jaseci)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: jaseci
|
|
3
|
+
Version: 2.2.7
|
|
4
|
+
Summary: Jaseci - A complete AI-native programming ecosystem with Jac language, LLM integration, and full-stack web apps
|
|
5
|
+
Author-email: Jason Mars <jason@mars.ninja>
|
|
6
|
+
Maintainer-email: Jason Mars <jason@mars.ninja>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: Repository, https://github.com/Jaseci-Labs/jaseci
|
|
9
|
+
Project-URL: Homepage, https://jaseci.org
|
|
10
|
+
Project-URL: Documentation, https://jac-lang.org
|
|
11
|
+
Keywords: jac,jaclang,jaseci,ai,llm,full-stack,web-apps,jac-client,jac-scale,programming-language,machine-learning,artificial-intelligence
|
|
12
|
+
Requires-Python: >=3.11
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
Requires-Dist: jaclang>=0.9.9
|
|
15
|
+
Requires-Dist: byllm>=0.4.14
|
|
16
|
+
Requires-Dist: jac-client>=0.2.9
|
|
17
|
+
Requires-Dist: jac-scale>=0.1.0
|
|
18
|
+
Requires-Dist: jac-super>=0.1.0
|
|
19
|
+
|
|
20
|
+
# Jaseci
|
|
21
|
+
|
|
22
|
+
### Complete AI-Native Programming Ecosystem
|
|
23
|
+
|
|
24
|
+
Jaseci is a **meta-package** that provides a unified installation for the complete Jaseci ecosystem.
|
|
25
|
+
|
|
26
|
+
## What's Included
|
|
27
|
+
|
|
28
|
+
When you install `jaseci`, you automatically get:
|
|
29
|
+
|
|
30
|
+
- **jaclang** - The Jac programming language
|
|
31
|
+
- **byllm** - LLM integration for AI-native programming
|
|
32
|
+
- **jac-client** - Full-stack web applications with React-like components in Jac
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install jaseci
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Quick Start
|
|
41
|
+
|
|
42
|
+
After installation, you can start using Jac:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
jac --help
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Documentation
|
|
49
|
+
|
|
50
|
+
- **Jac Language**: [https://www.jac-lang.org](https://www.jac-lang.org)
|
|
51
|
+
- **byLLM (AI Integration)**: [https://www.byllm.ai](https://www.byllm.ai)
|
|
52
|
+
- **Jac Client**: [https://docs.jaseci.org/jac-client/](https://docs.jaseci.org/jac-client/)
|
|
53
|
+
- **Jaseci Homepage**: [https://jaseci.org](https://jaseci.org)
|
|
54
|
+
- **GitHub Repository**: [https://github.com/Jaseci-Labs/jaseci](https://github.com/Jaseci-Labs/jaseci)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "jaseci"
|
|
3
|
+
version = "2.2.7"
|
|
4
|
+
description = "Jaseci - A complete AI-native programming ecosystem with Jac language, LLM integration, and full-stack web apps"
|
|
5
|
+
authors = [{name = "Jason Mars", email = "jason@mars.ninja"}]
|
|
6
|
+
maintainers = [{name = "Jason Mars", email = "jason@mars.ninja"}]
|
|
7
|
+
license = "MIT"
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
keywords = [
|
|
10
|
+
"jac",
|
|
11
|
+
"jaclang",
|
|
12
|
+
"jaseci",
|
|
13
|
+
"ai",
|
|
14
|
+
"llm",
|
|
15
|
+
"full-stack",
|
|
16
|
+
"web-apps",
|
|
17
|
+
"jac-client",
|
|
18
|
+
"jac-scale",
|
|
19
|
+
"programming-language",
|
|
20
|
+
"machine-learning",
|
|
21
|
+
"artificial-intelligence",
|
|
22
|
+
]
|
|
23
|
+
requires-python = ">=3.11"
|
|
24
|
+
dependencies = [
|
|
25
|
+
"jaclang>=0.9.9",
|
|
26
|
+
"byllm>=0.4.14",
|
|
27
|
+
"jac-client>=0.2.9",
|
|
28
|
+
"jac-scale>=0.1.0",
|
|
29
|
+
"jac-super>=0.1.0",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[project.urls]
|
|
33
|
+
Repository = "https://github.com/Jaseci-Labs/jaseci"
|
|
34
|
+
Homepage = "https://jaseci.org"
|
|
35
|
+
Documentation = "https://jac-lang.org"
|
|
36
|
+
|
|
37
|
+
[tool.setuptools.packages.find]
|
|
38
|
+
include = ["jaseci*"]
|
|
39
|
+
|
|
40
|
+
[build-system]
|
|
41
|
+
requires = ["setuptools>=61.0"]
|
|
42
|
+
build-backend = "setuptools.build_meta"
|
jaseci-1.3.1.3/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2021 Jaseci Labs LLC
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
jaseci-1.3.1.3/PKG-INFO
DELETED
jaseci-1.3.1.3/README.md
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Visit jaseci.org for more info!
|
|
File without changes
|
|
File without changes
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
General action base class with automation for hot loading
|
|
3
|
-
"""
|
|
4
|
-
from importlib.util import spec_from_file_location, module_from_spec
|
|
5
|
-
from jaseci.utils.utils import logger
|
|
6
|
-
from jaseci.actions.remote_actions import ACTIONS_SPEC_LOC
|
|
7
|
-
from jaseci.actions.remote_actions import serv_actions, mark_as_remote
|
|
8
|
-
import requests
|
|
9
|
-
import os
|
|
10
|
-
import sys
|
|
11
|
-
import inspect
|
|
12
|
-
|
|
13
|
-
live_actions = {}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def jaseci_action(act_group=None, aliases=list(), allow_remote=False):
|
|
17
|
-
"""Decorator for Jaseci Action interface"""
|
|
18
|
-
caller_globals = dict(inspect.getmembers(
|
|
19
|
-
inspect.stack()[1][0]))["f_globals"]
|
|
20
|
-
if allow_remote and 'serv_actions' not in caller_globals:
|
|
21
|
-
caller_globals['serv_actions'] = serv_actions
|
|
22
|
-
|
|
23
|
-
def decorator_func(func):
|
|
24
|
-
if(allow_remote):
|
|
25
|
-
mark_as_remote([func, act_group, aliases, caller_globals])
|
|
26
|
-
return assimilate_action(func, act_group)
|
|
27
|
-
return decorator_func
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def assimilate_action(func, act_group=None):
|
|
31
|
-
"""Helper for jaseci_action decorator"""
|
|
32
|
-
act_group = [func.__module__.split(
|
|
33
|
-
'.')[-1]] if act_group is None else act_group
|
|
34
|
-
live_actions[f"{'.'.join(act_group+[func.__name__])}"] = func
|
|
35
|
-
return func
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
def load_local_actions(file):
|
|
39
|
-
"""Load all jaseci actions from python file"""
|
|
40
|
-
spec = spec_from_file_location(str(file).split("/")[-1][:-3], str(file))
|
|
41
|
-
if(spec is None):
|
|
42
|
-
logger.error(f"Cannot hot load from action file {file}")
|
|
43
|
-
return False
|
|
44
|
-
else:
|
|
45
|
-
module_dir = os.path.dirname(os.path.realpath(str(file)))
|
|
46
|
-
if module_dir not in sys.path:
|
|
47
|
-
sys.path.append(module_dir)
|
|
48
|
-
spec.loader.exec_module(module_from_spec(spec))
|
|
49
|
-
return True
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
def load_standard():
|
|
53
|
-
import jaseci.actions.standard.net # noqa
|
|
54
|
-
import jaseci.actions.standard.rand # noqa
|
|
55
|
-
import jaseci.actions.standard.request # noqa
|
|
56
|
-
import jaseci.actions.standard.std # noqa
|
|
57
|
-
import jaseci.actions.standard.file # noqa
|
|
58
|
-
import jaseci.actions.standard.vector # noqa
|
|
59
|
-
import jaseci.actions.standard.date # noqa
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
load_standard()
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
def load_preconfig_actions(hook):
|
|
66
|
-
import json
|
|
67
|
-
action_preload = hook.resolve_glob('ACTION_SETS', None)
|
|
68
|
-
if (action_preload):
|
|
69
|
-
action_preload = json.loads(action_preload)
|
|
70
|
-
for i in action_preload['local']:
|
|
71
|
-
load_local_actions(i)
|
|
72
|
-
for i in action_preload['remote']:
|
|
73
|
-
load_remote_actions(i)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
def get_global_actions(hook):
|
|
77
|
-
"""
|
|
78
|
-
Loads all global action hooks for use by Jac programs
|
|
79
|
-
Attaches globals to mem_hook
|
|
80
|
-
"""
|
|
81
|
-
from jaseci.attr.action import action
|
|
82
|
-
import uuid
|
|
83
|
-
global_action_list = []
|
|
84
|
-
for i in live_actions.keys():
|
|
85
|
-
if(i.startswith('std.') or i.startswith('file.') or
|
|
86
|
-
i.startswith('net.') or i.startswith('rand.') or
|
|
87
|
-
i.startswith('vector.') or i.startswith('request.')):
|
|
88
|
-
global_action_list.append(
|
|
89
|
-
action(
|
|
90
|
-
m_id=uuid.UUID(int=0).urn,
|
|
91
|
-
h=hook,
|
|
92
|
-
mode='public',
|
|
93
|
-
name=i,
|
|
94
|
-
value=i,
|
|
95
|
-
persist=False
|
|
96
|
-
).jid
|
|
97
|
-
)
|
|
98
|
-
return global_action_list
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
def load_remote_actions(url):
|
|
102
|
-
"""Load all jaseci actions from live pod"""
|
|
103
|
-
headers = {'content-type': 'application/json'}
|
|
104
|
-
try:
|
|
105
|
-
spec = requests.get(url.rstrip('/')+ACTIONS_SPEC_LOC,
|
|
106
|
-
headers=headers)
|
|
107
|
-
spec = spec.json()
|
|
108
|
-
for i in spec.keys():
|
|
109
|
-
live_actions[i] = gen_remote_func_hook(url, i, spec[i])
|
|
110
|
-
return True
|
|
111
|
-
|
|
112
|
-
except Exception as e:
|
|
113
|
-
logger.error(f"Cannot hot load remote actions at {url}: {e}")
|
|
114
|
-
return False
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
def gen_remote_func_hook(url, act_name, param_names):
|
|
118
|
-
"""Generater for function calls for remote action calls"""
|
|
119
|
-
def func(*args):
|
|
120
|
-
params = {}
|
|
121
|
-
for i in range(len(param_names)):
|
|
122
|
-
if(i < len(args)):
|
|
123
|
-
params[param_names[i]] = args[i]
|
|
124
|
-
else:
|
|
125
|
-
params[param_names[i]] = None
|
|
126
|
-
act_url = f"{url.rstrip('/')}/{act_name.split('.')[-1]}"
|
|
127
|
-
res = requests.post(
|
|
128
|
-
act_url, headers={'content-type': 'application/json'}, json=params)
|
|
129
|
-
return res.json()
|
|
130
|
-
return func
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
General action base class with automation for hot loading
|
|
3
|
-
"""
|
|
4
|
-
from jaseci.utils.utils import logger
|
|
5
|
-
from fastapi import FastAPI
|
|
6
|
-
from fastapi.responses import RedirectResponse
|
|
7
|
-
from pydantic import validate_arguments
|
|
8
|
-
from time import time
|
|
9
|
-
import inspect
|
|
10
|
-
import uvicorn
|
|
11
|
-
import os
|
|
12
|
-
|
|
13
|
-
remote_actions = {}
|
|
14
|
-
registered_apis = []
|
|
15
|
-
ACTIONS_SPEC_LOC = "/jaseci_actions_spec/"
|
|
16
|
-
JS_ACTION_PREAMBLE = "js_action_"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def mark_as_remote(api):
|
|
20
|
-
registered_apis.append(api)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def serv_actions():
|
|
24
|
-
"""Returns fastAPI app interface for actions"""
|
|
25
|
-
app = FastAPI()
|
|
26
|
-
@app.get("/")
|
|
27
|
-
def home_redirect():
|
|
28
|
-
return RedirectResponse(url='/docs')
|
|
29
|
-
|
|
30
|
-
@app.get(ACTIONS_SPEC_LOC)
|
|
31
|
-
def action_list():
|
|
32
|
-
return remote_actions
|
|
33
|
-
|
|
34
|
-
for i in registered_apis:
|
|
35
|
-
gen_api_service(app, i[0], i[1], i[2], i[3])
|
|
36
|
-
return app
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
def gen_api_service(app, func, act_group, aliases, caller_globals):
|
|
40
|
-
"""Helper for jaseci_action decorator"""
|
|
41
|
-
# Construct list of action apis available
|
|
42
|
-
varnames = list(inspect.signature(func).parameters.keys())
|
|
43
|
-
act_group = [os.path.basename(inspect.getfile(func)).split(
|
|
44
|
-
'.')[0]] if act_group is None else act_group
|
|
45
|
-
remote_actions[f"{'.'.join(act_group+[func.__name__])}"] = \
|
|
46
|
-
varnames
|
|
47
|
-
|
|
48
|
-
# Need to get pydatic model for func signature for fastAPI post
|
|
49
|
-
model = validate_arguments(func).model
|
|
50
|
-
|
|
51
|
-
# Keep only feilds present in param list in base model
|
|
52
|
-
keep_fields = {}
|
|
53
|
-
for i in model.__fields__.keys():
|
|
54
|
-
if i in varnames:
|
|
55
|
-
keep_fields[i] = model.__fields__[i]
|
|
56
|
-
model.__fields__ = keep_fields
|
|
57
|
-
|
|
58
|
-
# Create duplicate funtion for api endpoint and inject in call site globals
|
|
59
|
-
@app.post(f"/{func.__name__}/")
|
|
60
|
-
def new_func(params: model):
|
|
61
|
-
pl_peek = str(dict(params.__dict__))[:128]
|
|
62
|
-
logger.info(str(
|
|
63
|
-
f'Incoming call to {func.__name__} with {pl_peek}'))
|
|
64
|
-
start_time = time()
|
|
65
|
-
TY = '\033[33m'
|
|
66
|
-
TG = '\033[32m'
|
|
67
|
-
EC = '\033[m' # noqa
|
|
68
|
-
ret = validate_arguments(func)(**(params.__dict__))
|
|
69
|
-
tot_time = time()-start_time
|
|
70
|
-
logger.info(str(
|
|
71
|
-
f'API call to {TG}{func.__name__}{EC}'
|
|
72
|
-
f' completed in {TY}{tot_time:.3f} seconds{EC}'))
|
|
73
|
-
return ret
|
|
74
|
-
for i in aliases:
|
|
75
|
-
new_func = app.post(f"/{i}/")(new_func)
|
|
76
|
-
remote_actions[f"{'.'.join(act_group+[i])}"] = \
|
|
77
|
-
varnames
|
|
78
|
-
caller_globals[f'{JS_ACTION_PREAMBLE}{func.__name__}'] = new_func
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
def launch_server(port=80, host='0.0.0.0'):
|
|
82
|
-
uvicorn.run(serv_actions(), port=port, host=host)
|
|
File without changes
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"""Built in actions for Jaseci"""
|
|
2
|
-
from datetime import datetime
|
|
3
|
-
from datetime import timedelta
|
|
4
|
-
from jaseci.jac.machine.jac_value import jac_type_unwrap as jtu
|
|
5
|
-
from jaseci.actions.live_actions import jaseci_action
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
@jaseci_action()
|
|
9
|
-
def quantize_to_year(date: str):
|
|
10
|
-
date = datetime.fromisoformat(jtu(date))
|
|
11
|
-
date = date.replace(month=1, day=1, hour=0, minute=0,
|
|
12
|
-
second=0, microsecond=0)
|
|
13
|
-
return date.isoformat()
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
@jaseci_action()
|
|
17
|
-
def quantize_to_month(date: str):
|
|
18
|
-
date = datetime.fromisoformat(jtu(date))
|
|
19
|
-
date = date.replace(day=1, hour=0, minute=0,
|
|
20
|
-
second=0, microsecond=0)
|
|
21
|
-
return date.isoformat()
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
@jaseci_action()
|
|
25
|
-
def quantize_to_week(date: str):
|
|
26
|
-
date = datetime.fromisoformat(jtu(date))
|
|
27
|
-
date = date.replace(hour=0, minute=0,
|
|
28
|
-
second=0, microsecond=0)
|
|
29
|
-
date = date - timedelta(days=date.weekday())
|
|
30
|
-
return date.isoformat()
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
@jaseci_action()
|
|
34
|
-
def quantize_to_day(date: str):
|
|
35
|
-
date = datetime.fromisoformat(jtu(date))
|
|
36
|
-
date = date.replace(hour=0, minute=0,
|
|
37
|
-
second=0, microsecond=0)
|
|
38
|
-
return date.isoformat()
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
@jaseci_action()
|
|
42
|
-
def date_day_diff(start_date: str, end_date: str):
|
|
43
|
-
# Try to deal with some incompatible date in old nodes
|
|
44
|
-
# Due date has not been saving in isoformat so this doesn't work
|
|
45
|
-
# for example,'2021-03-31T04:00:00.000Z'
|
|
46
|
-
start_date = datetime.fromisoformat(jtu(start_date.split('T')[0]))
|
|
47
|
-
end_date = datetime.fromisoformat(jtu(end_date.split('T')[0]))
|
|
48
|
-
|
|
49
|
-
delta = end_date - start_date
|
|
50
|
-
|
|
51
|
-
return delta.days
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"""Built in actions for Jaseci"""
|
|
2
|
-
from jaseci.actions.live_actions import jaseci_action
|
|
3
|
-
import json
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
@jaseci_action()
|
|
7
|
-
def load_str(fn: str, max_chars: int = None):
|
|
8
|
-
"""Standard built in for loading from file to string"""
|
|
9
|
-
with open(fn, 'r') as file:
|
|
10
|
-
data = file.read(max_chars)
|
|
11
|
-
return data
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@jaseci_action()
|
|
15
|
-
def load_json(fn: str):
|
|
16
|
-
"""Standard built in for loading json from file to dictionary"""
|
|
17
|
-
with open(fn, 'r') as file:
|
|
18
|
-
data = json.load(file)
|
|
19
|
-
return data
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
@jaseci_action()
|
|
23
|
-
def dump_str(fn: str, s: str):
|
|
24
|
-
"""Standard built in for dumping to file from string"""
|
|
25
|
-
with open(fn, 'w') as file:
|
|
26
|
-
num_chars = file.write(s)
|
|
27
|
-
return num_chars
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
@jaseci_action()
|
|
31
|
-
def append_str(fn: str, s: str):
|
|
32
|
-
"""Standard built in for appending to file from string"""
|
|
33
|
-
with open(fn, 'a') as file:
|
|
34
|
-
num_chars = file.write(s)
|
|
35
|
-
return num_chars
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
@jaseci_action()
|
|
39
|
-
def dump_json(fn: str, obj, indent: int = None):
|
|
40
|
-
"""Standard built in for dumping json to file from dictionary"""
|
|
41
|
-
with open(fn, 'w') as file:
|
|
42
|
-
json.dump(obj, file, indent=indent)
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"""Built in actions for Jaseci"""
|
|
2
|
-
from jaseci.actions.live_actions import jaseci_action
|
|
3
|
-
from jaseci.jac.jac_set import jac_set
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
@jaseci_action()
|
|
7
|
-
def max(item_set: jac_set):
|
|
8
|
-
ret = None
|
|
9
|
-
if (not len(item_set)):
|
|
10
|
-
return None
|
|
11
|
-
items = item_set.obj_list()
|
|
12
|
-
max_val = items[0].anchor_value()
|
|
13
|
-
ret = items[0]
|
|
14
|
-
for i in items:
|
|
15
|
-
if(i.anchor_value() > max_val):
|
|
16
|
-
ret = i
|
|
17
|
-
max_val = i.anchor_value()
|
|
18
|
-
return ret
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"""Built in actions for Jaseci"""
|
|
2
|
-
import random
|
|
3
|
-
# import faker
|
|
4
|
-
from datetime import datetime
|
|
5
|
-
from datetime import timedelta
|
|
6
|
-
from jaseci.actions.live_actions import jaseci_action
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
@jaseci_action()
|
|
10
|
-
def seed(val: int):
|
|
11
|
-
"""Seed random num generator"""
|
|
12
|
-
random.seed(val, version=2)
|
|
13
|
-
# faker.Faker.seed(param_list[0])
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
@jaseci_action()
|
|
17
|
-
def integer(start: int, end: int):
|
|
18
|
-
"""Random integeter between range"""
|
|
19
|
-
return random.randint(start, end)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
@jaseci_action()
|
|
23
|
-
def sentence(meta):
|
|
24
|
-
"""Get a random sentence"""
|
|
25
|
-
fstr = ''
|
|
26
|
-
for i in range(random.randint(0, 10)):
|
|
27
|
-
fstr += "test "
|
|
28
|
-
return fstr
|
|
29
|
-
# return faker.Faker().sentence()
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
@jaseci_action()
|
|
33
|
-
def time(start_date: str, end_date: str):
|
|
34
|
-
"""Provide a random datetime between range"""
|
|
35
|
-
start = datetime.fromisoformat(start_date)
|
|
36
|
-
end = datetime.fromisoformat(end_date)
|
|
37
|
-
return (start + timedelta(
|
|
38
|
-
seconds=random.randint(0, int((end - start).total_seconds())),
|
|
39
|
-
)).isoformat()
|