Skip to content

Commit e51c9d6

Browse files
authored
Merge pull request #1506 from Jaseci-Labs/main
Update from main
2 parents 3d9ed82 + 1942ca1 commit e51c9d6

25 files changed

+440
-158
lines changed

.github/workflows/release-github.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Create Releases from Specific Subdirectories
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
create-github-releases:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v2
13+
14+
- name: Create Releases for Specific Subdirectories
15+
run: |
16+
# List of subdirectories for which releases need to be created
17+
subdirs=("jac" "jac-mtllm" "jac-cloud")
18+
19+
for dir in "${subdirs[@]}"; do
20+
# Extract the directory name as the release name
21+
release_name=$(basename "$dir")
22+
23+
# Get the latest commit hash for this subdirectory
24+
release_version=$(git log -n 1 --format=%h -- "$dir")
25+
26+
# Create a release for the subdirectory with the release version (commit hash)
27+
gh release create "$release_name-$release_version" "$dir/*" --title "$release_name" --notes "Release for $release_name version $release_version"
28+
done
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ If you would like to use these names or brands, please reach out for approval.
5151

5252
[jaseci]: https://jaseci.org/
5353

54-
## University of Michigan Disclosure
55-
5654
The Jaseci open-source software (OSS) is maintained by [Jaseci Labs, LLC][jaseci] for which the following University of Michigan employees have either an ownership or advisory interest in Jaseci Labs, LLC: Prof. Jason Mars, Prof. Lingjia Tang, and Dr. Yiping Kang.
5755

5856
[jaseci]: https://jaseci.org/

jac-cloud/jac_cloud/jaseci/routers/sso.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
"GITHUB": GithubSSO,
4747
"GITLAB": GitlabSSO,
4848
"GOOGLE": GoogleSSO,
49+
"GOOGLE_ANDROID": GoogleSSO,
50+
"GOOGLE_IOS": GoogleSSO,
4951
"KAKAO": KakaoSSO,
5052
"LINE": LineSSO,
5153
"LINKEDIN": LinkedInSSO,
@@ -227,7 +229,7 @@ def register(platform: str, open_id: OpenID) -> Response:
227229
}
228230
},
229231
session=session,
230-
):
232+
).modified_count:
231233
root = Root().__jac__
232234
ureq: dict[str, object] = User.register_type()(
233235
email=open_id.email,

jac-cloud/jac_cloud/jaseci/routers/user.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,15 @@ def verify(req: UserVerification) -> ORJSONResponse:
110110

111111

112112
@router.post("/login")
113-
def root(req: UserRequest) -> ORJSONResponse:
113+
def login(req: UserRequest) -> ORJSONResponse:
114114
"""Login user API."""
115+
log = log_entry("login", req.email, {"email": req.email, "password": "****"})
116+
115117
user: BaseUser = User.Collection.find_by_email(req.email) # type: ignore
116118
if not user or not pbkdf2_sha512.verify(req.password, user.password):
117-
raise HTTPException(status_code=400, detail="Invalid Email/Password!")
119+
resp = {"message": "Invalid Email/Password!"}
120+
log_exit(resp, log)
121+
return ORJSONResponse(resp, 400)
118122

119123
if RESTRICT_UNVERIFIED_USER and not user.is_activated:
120124
User.send_verification_code(create_code(user.id), req.email)
@@ -126,6 +130,7 @@ def root(req: UserRequest) -> ORJSONResponse:
126130
user_json = user.serialize()
127131
token = create_token(user_json)
128132

133+
log_exit({"token": "****", "user": {**user_json, "state": "****"}}, log)
129134
return ORJSONResponse(content={"token": token, "user": user_json})
130135

131136

jac-cloud/jac_cloud/tests/openapi_specs.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ paths:
694694
/user/login:
695695
post:
696696
description: Login user API.
697-
operationId: root_user_login_post
697+
operationId: login_user_login_post
698698
requestBody:
699699
content:
700700
application/json:
@@ -713,7 +713,7 @@ paths:
713713
schema:
714714
$ref: '#/components/schemas/HTTPValidationError'
715715
description: Validation Error
716-
summary: Root
716+
summary: Login
717717
tags:
718718
- user
719719
/user/register:

jac-cloud/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from setuptools import find_packages, setup
44

5-
VERSION = "0.1.13"
5+
VERSION = "0.1.16"
66

77
setup(
88
name="jac-cloud",

jac-mtllm/mtllm/aott.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,27 @@ def aott_raise(
131131
if not (contains_media and not is_custom)
132132
else meaning_typed_input_list
133133
)
134-
return model(meaning_typed_input, media=media, **model_params) # type: ignore
134+
if is_custom:
135+
try:
136+
# This is a temporary solution to enable passing in custom
137+
# parameters to custom models
138+
# custom model should override the __call__ method to
139+
# accept function_inputs parameter
140+
return model(
141+
meaning_typed_input, # type: ignore
142+
media=media, # type: ignore
143+
function_inputs=inputs_information, # type: ignore
144+
**model_params,
145+
)
146+
except TypeError:
147+
# this is for backward compatibility,
148+
# for any existing custom models that do not have the
149+
# function_inputs parameter
150+
return model(
151+
meaning_typed_input, media=media, **model_params # type: ignore
152+
)
153+
else:
154+
return model(meaning_typed_input, media=media, **model_params) # type: ignore
135155

136156

137157
def execute_react(

jac/jaclang/compiler/absyntree.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
SymbolType,
3131
)
3232
from jaclang.compiler.constant import DELIM_MAP, SymbolAccess, Tokens as Tok
33+
from jaclang.compiler.py_info import PyInfo
3334
from jaclang.compiler.semtable import SemRegistry
3435
from jaclang.utils.treeprinter import dotgen_ast_tree, print_ast_tree
3536

@@ -636,11 +637,10 @@ def __init__(
636637
self.impl_mod: list[Module] = []
637638
self.test_mod: list[Module] = []
638639
self.mod_deps: dict[str, Module] = {}
639-
self.py_mod_dep_map: dict[str, str] = {}
640-
self.py_raise_map: dict[str, str] = {}
641640
self.registry = registry
642641
self.terminals: list[Token] = terminals
643-
self.is_raised_from_py: bool = False
642+
self.py_info: PyInfo = PyInfo()
643+
644644
AstNode.__init__(self, kid=kid)
645645
AstDocNode.__init__(self, doc=doc)
646646

@@ -693,6 +693,19 @@ def unparse(self) -> str:
693693
super().unparse()
694694
return self.format()
695695

696+
@staticmethod
697+
def get_href_path(node: AstNode) -> str:
698+
"""Return the full path of the module that contains this node."""
699+
parent = node.find_parent_of_type(Module)
700+
mod_list = []
701+
if isinstance(node, Module):
702+
mod_list.append(node)
703+
while parent is not None:
704+
mod_list.append(parent)
705+
parent = parent.find_parent_of_type(Module)
706+
mod_list.reverse()
707+
return ".".join(p.name for p in mod_list)
708+
696709

697710
class GlobalVars(ElementStmt, AstAccessNode):
698711
"""GlobalVars node type for Jac Ast."""

jac/jaclang/compiler/passes/main/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
from .sub_node_tab_pass import SubNodeTabPass
44
from .sym_tab_build_pass import SymTabBuildPass # noqa: I100
5+
from .def_use_pass import DefUsePass # noqa: I100
56
from .import_pass import JacImportPass, PyImportPass # noqa: I100
67
from .def_impl_match_pass import DeclImplMatchPass # noqa: I100
7-
from .def_use_pass import DefUsePass # noqa: I100
88
from .pyout_pass import PyOutPass # noqa: I100
99
from .pyast_load_pass import PyastBuildPass # type: ignore # noqa: I100
1010
from .pyast_gen_pass import PyastGenPass # noqa: I100

jac/jaclang/compiler/passes/main/access_modifier_pass.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def exit_node(self, node: ast.AstNode) -> None: # TODO: Move to debug pass
4545
settings.lsp_debug
4646
and isinstance(node, ast.NameAtom)
4747
and not node.sym
48-
and not node.parent_of_type(ast.Module).is_raised_from_py
48+
and not node.parent_of_type(ast.Module).py_info.is_raised_from_py
4949
and not (
5050
node.sym_name == "py"
5151
and node.parent

jac/jaclang/compiler/passes/main/fuse_typeinfo_pass.py

Lines changed: 14 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -77,35 +77,6 @@ def __set_type_sym_table_link(self, node: ast.AstSymbolNode) -> None:
7777
if typ_sym_table != self.ir.sym_tab:
7878
node.name_spec.type_sym_tab = typ_sym_table
7979

80-
def __collect_python_dependencies(self, node: ast.AstNode) -> None:
81-
assert isinstance(node, ast.AstSymbolNode)
82-
assert isinstance(self.ir, ast.Module)
83-
84-
mypy_node = node.gen.mypy_ast[0]
85-
86-
if isinstance(mypy_node, MypyNodes.RefExpr) and mypy_node.node:
87-
node_full_name = mypy_node.node.fullname
88-
if "." in node_full_name:
89-
mod_name = node_full_name[: node_full_name.rindex(".")]
90-
else:
91-
mod_name = node_full_name
92-
93-
if mod_name not in self.ir.py_mod_dep_map:
94-
self.__debug_print(
95-
f"Can't find a python file associated with {type(node)}::{node.loc}"
96-
)
97-
return
98-
99-
mode_path = self.ir.py_mod_dep_map[mod_name]
100-
if mode_path.endswith(".jac"):
101-
return
102-
103-
self.ir.py_raise_map[mod_name] = mode_path
104-
else:
105-
self.__debug_print(
106-
f"Collect python dependencies is not supported in {type(node)}::{node.loc}"
107-
)
108-
10980
@staticmethod
11081
def __handle_node(
11182
func: Callable[[FuseTypeInfoPass, T], None]
@@ -127,7 +98,6 @@ def node_handler(self: FuseTypeInfoPass, node: T) -> None:
12798
if len(node.gen.mypy_ast) == 1:
12899
func(self, node)
129100
self.__set_type_sym_table_link(node)
130-
self.__collect_python_dependencies(node)
131101

132102
# Jac node has multiple mypy nodes linked to it
133103
elif len(node.gen.mypy_ast) > 1:
@@ -151,7 +121,6 @@ def node_handler(self: FuseTypeInfoPass, node: T) -> None:
151121
)
152122
func(self, node)
153123
self.__set_type_sym_table_link(node)
154-
self.__collect_python_dependencies(node)
155124

156125
# Special handing for BuiltinType
157126
elif isinstance(node, ast.BuiltinType):
@@ -536,7 +505,7 @@ def get_type_from_overloaded(
536505
self, mypy_type: MypyTypes.Overloaded
537506
) -> Optional[str]:
538507
"""Get type info from mypy type Overloaded."""
539-
return self.__call_type_handler(mypy_type.items[0])
508+
return self.__call_type_handler(mypy_type.items[-1])
540509

541510
def get_type_from_none_type(self, mypy_type: MypyTypes.NoneType) -> Optional[str]:
542511
"""Get type info from mypy type NoneType."""
@@ -554,6 +523,12 @@ def get_type_from_type_type(self, mypy_type: MypyTypes.TypeType) -> Optional[str
554523
"""Get type info from mypy type TypeType."""
555524
return str(mypy_type.item)
556525

526+
def get_type_from_type_var_type(
527+
self, mypy_type: MypyTypes.TypeVarType
528+
) -> Optional[str]:
529+
"""Get type info from mypy type TypeType."""
530+
return str(mypy_type.name)
531+
557532
def exit_assignment(self, node: ast.Assignment) -> None:
558533
"""Add new symbols in the symbol table in case of self."""
559534
# This will fix adding new items to the class through self
@@ -668,6 +643,13 @@ def exit_atom_trailer(self, node: ast.AtomTrailer) -> None:
668643
right.type_sym_tab = type_symtab
669644

670645
else:
646+
# Fix the symbolTable linking in case of type annotations
647+
if left.type_sym_tab is None and isinstance(node.parent, ast.SubTag):
648+
assert isinstance(left, ast.AstSymbolNode)
649+
left.name_spec.type_sym_tab = self.ir.sym_tab.find_scope(
650+
left.sym_name
651+
)
652+
671653
if left.type_sym_tab:
672654
right.name_spec.sym = left.type_sym_tab.lookup(right.sym_name)
673655
if right.name_spec.sym:

0 commit comments

Comments
 (0)