ziya 0.1.11__py3-none-any.whl → 0.1.13__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.
Potentially problematic release.
This version of ziya might be problematic. Click here for more details.
- app/main.py +31 -3
- app/server.py +10 -0
- app/utils/gitignore_parser.py +4 -3
- pyproject.toml +1 -1
- {ziya-0.1.11.dist-info → ziya-0.1.13.dist-info}/METADATA +3 -4
- {ziya-0.1.11.dist-info → ziya-0.1.13.dist-info}/RECORD +9 -9
- {ziya-0.1.11.dist-info → ziya-0.1.13.dist-info}/LICENSE +0 -0
- {ziya-0.1.11.dist-info → ziya-0.1.13.dist-info}/WHEEL +0 -0
- {ziya-0.1.11.dist-info → ziya-0.1.13.dist-info}/entry_points.txt +0 -0
app/main.py
CHANGED
|
@@ -48,12 +48,38 @@ def check_version_and_upgrade():
|
|
|
48
48
|
logger.info(f"Ziya version {current_version} is up to date.")
|
|
49
49
|
|
|
50
50
|
|
|
51
|
+
def is_package_installed_with_pip(package_name: str) -> bool:
|
|
52
|
+
try:
|
|
53
|
+
subprocess.check_call([sys.executable, '-m', 'pip', 'show', package_name], stdout=subprocess.DEVNULL,
|
|
54
|
+
stderr=subprocess.DEVNULL)
|
|
55
|
+
return True
|
|
56
|
+
except subprocess.CalledProcessError:
|
|
57
|
+
return False
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def is_package_installed_with_pipx(package_name: str) -> bool:
|
|
61
|
+
try:
|
|
62
|
+
subprocess.check_call(['pipx', 'list'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
63
|
+
result = subprocess.run(['pipx', 'list'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
64
|
+
return package_name in result.stdout.decode()
|
|
65
|
+
except subprocess.CalledProcessError:
|
|
66
|
+
return False
|
|
67
|
+
|
|
68
|
+
|
|
51
69
|
def update_package(current_version: str, latest_version: Optional[str]) -> None:
|
|
52
70
|
try:
|
|
53
71
|
logger.info(f"Updating ziya from {current_version} to {latest_version}")
|
|
54
|
-
subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', 'ziya'])
|
|
55
|
-
logger.info("Update completed. Next time you run ziya it will be with the latest version.")
|
|
56
72
|
|
|
73
|
+
if is_package_installed_with_pip('ziya'):
|
|
74
|
+
logger.info("Package installed via pip")
|
|
75
|
+
subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--upgrade', 'ziya'])
|
|
76
|
+
elif is_package_installed_with_pipx('ziya'):
|
|
77
|
+
logger.info("Package installed via pipx")
|
|
78
|
+
subprocess.check_call(['pipx', 'upgrade', 'ziya'])
|
|
79
|
+
else:
|
|
80
|
+
logger.info("ziya is not installed with pip or pipx.")
|
|
81
|
+
|
|
82
|
+
logger.info("Update completed. Next time you run ziya it will be with the latest version.")
|
|
57
83
|
except Exception as e:
|
|
58
84
|
logger.info(f"Unexpected error upgrading ziya: {e}")
|
|
59
85
|
|
|
@@ -65,7 +91,9 @@ def print_version():
|
|
|
65
91
|
|
|
66
92
|
def start_server(args):
|
|
67
93
|
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
|
68
|
-
|
|
94
|
+
# Override the default server location from 127.0.0.1 to 0.0.0.0
|
|
95
|
+
# This allows the server to be accessible from other machines on the network
|
|
96
|
+
serve(host="0.0.0.0", port=args.port)
|
|
69
97
|
|
|
70
98
|
|
|
71
99
|
def main():
|
app/server.py
CHANGED
|
@@ -3,6 +3,7 @@ from typing import Dict, Any, List, Tuple
|
|
|
3
3
|
|
|
4
4
|
import tiktoken
|
|
5
5
|
from fastapi import FastAPI, Request
|
|
6
|
+
from fastapi.middleware.cors import CORSMiddleware
|
|
6
7
|
from fastapi.staticfiles import StaticFiles
|
|
7
8
|
from fastapi.templating import Jinja2Templates
|
|
8
9
|
from langserve import add_routes
|
|
@@ -16,6 +17,15 @@ from app.utils.directory_util import get_ignored_patterns
|
|
|
16
17
|
from app.utils.gitignore_parser import parse_gitignore_patterns
|
|
17
18
|
|
|
18
19
|
app = FastAPI()
|
|
20
|
+
|
|
21
|
+
app.add_middleware(
|
|
22
|
+
CORSMiddleware,
|
|
23
|
+
allow_origins=["*"],
|
|
24
|
+
allow_credentials=True,
|
|
25
|
+
allow_methods=["*"],
|
|
26
|
+
allow_headers=["*"],
|
|
27
|
+
)
|
|
28
|
+
|
|
19
29
|
app.mount("/static", StaticFiles(directory="../templates/static"), name="static")
|
|
20
30
|
templates = Jinja2Templates(directory="../templates")
|
|
21
31
|
|
app/utils/gitignore_parser.py
CHANGED
|
@@ -119,9 +119,10 @@ class IgnoreRule(collections.namedtuple('IgnoreRule_', IGNORE_RULE_FIELDS)):
|
|
|
119
119
|
def match(self, abs_path: Union[str, Path]):
|
|
120
120
|
matched = False
|
|
121
121
|
if self.base_path:
|
|
122
|
-
|
|
122
|
+
try:
|
|
123
123
|
rel_path = str(_normalize_path(abs_path).relative_to(self.base_path))
|
|
124
|
-
|
|
124
|
+
except ValueError:
|
|
125
|
+
# If the path is not a subpath of the base path, treat it as a separate path
|
|
125
126
|
rel_path = str(_normalize_path(abs_path))
|
|
126
127
|
else:
|
|
127
128
|
rel_path = str(_normalize_path(abs_path))
|
|
@@ -212,4 +213,4 @@ def _normalize_path(path: Union[str, Path]) -> Path:
|
|
|
212
213
|
Note that this simplifies paths by removing double slashes, `..`, `.` etc. like
|
|
213
214
|
`Path.resolve()` does.
|
|
214
215
|
"""
|
|
215
|
-
return Path(abspath(path))
|
|
216
|
+
return Path(abspath(path))
|
pyproject.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ziya
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.13
|
|
4
4
|
Summary:
|
|
5
5
|
Author: Vishnu Krishnaprasad
|
|
6
6
|
Author-email: vishnukool@gmail.com
|
|
@@ -78,9 +78,7 @@ ziya
|
|
|
78
78
|
|
|
79
79
|
### Options
|
|
80
80
|
|
|
81
|
-
`--exclude`: Comma-separated list of files or directories or file suffix patterns to exclude from the codebase. Eg:
|
|
82
|
-
|
|
83
|
-
`--include`: Comma-separated list of directories to include. By default, it only searches for current directory for code files, but you can specify a list of subset directories under current folder to search instead of the entire folder. Eg: `--include='app,src/mappers'`
|
|
81
|
+
`--exclude`: Comma-separated list of files or directories or file suffix patterns to exclude from the codebase. Eg: "--exclude 'tst,build,*.py'"
|
|
84
82
|
|
|
85
83
|
`--profile`: AWS profile to use for the Bedrock LLM.
|
|
86
84
|
|
|
@@ -91,3 +89,4 @@ ziya
|
|
|
91
89
|
```bash
|
|
92
90
|
ziya --include='app,src/mappers' --exclude='tst,build,*.py' --profile=ziya --model=sonnet --port=8080
|
|
93
91
|
```
|
|
92
|
+
|
|
@@ -2,16 +2,16 @@ app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
2
2
|
app/agents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
app/agents/agent.py,sha256=l_GmvQ_G4eKwd_9h4tH325jnQDS3_-NYFAX2yKcypPw,5363
|
|
4
4
|
app/agents/prompts.py,sha256=LMwNzbYexns8er7mlF5VKhlobYH9yy37HR-axL_DNkk,1747
|
|
5
|
-
app/main.py,sha256=
|
|
6
|
-
app/server.py,sha256=
|
|
5
|
+
app/main.py,sha256=WZlsI0_CKi37BawhHohGt9J3HJ7U_QeFwr16ed536Mo,4052
|
|
6
|
+
app/server.py,sha256=nzm94XVuntOQgM61ivQGAMghG8HexeCSI29sziVSocI,3397
|
|
7
7
|
app/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
app/utils/directory_util.py,sha256=2zxsSxSOZKesjhgjF3KguY__fC9XkjxHHnDbcxtnhXk,2762
|
|
9
|
-
app/utils/gitignore_parser.py,sha256=
|
|
9
|
+
app/utils/gitignore_parser.py,sha256=Li3hQd60eclIuN2qxn8-NQ5sxRyMcnS88DFUxVHdx-A,7487
|
|
10
10
|
app/utils/langchain_validation_util.py,sha256=RgmKayKMApvUA7SPF_DrBAcYdIzzLUVJfnOwTSc1Eug,527
|
|
11
11
|
app/utils/logging_utils.py,sha256=8JEcc1t7L-a0G4HLmM8zFydNNSOd5l2-gkTxviLQUns,280
|
|
12
12
|
app/utils/print_tree_util.py,sha256=O4Rb-GS8UODxfH7Z6bZGsr-opG6QLmvdaU1im5kh4IA,1419
|
|
13
13
|
app/utils/version_util.py,sha256=NcvMWIImJDcO9K5OMX6jJD4q6Zb8Y117Mu8sWIkhxEc,631
|
|
14
|
-
pyproject.toml,sha256=
|
|
14
|
+
pyproject.toml,sha256=kyROW3FoBvl30o2ASGTIteNmHl-jlATvWlknhEFIAFc,804
|
|
15
15
|
scripts.py,sha256=70BOvYoboMhl3Bxjy73m1ozmI8UV8JZVyi2RwUptkK8,809
|
|
16
16
|
templates/.DS_Store,sha256=IWzGxsqGRcdoSHwV5Q9YF26GaZGnTClZWzKJgx33UyY,6148
|
|
17
17
|
templates/asset-manifest.json,sha256=-cGZTauN08338NqyS6yzTSJs0xFusjbbXrLN7PJiAuE,1157
|
|
@@ -30,8 +30,8 @@ templates/static/media/fa-solid-900.4d986b00ff9ca3828fbd.woff2,sha256=rhfBavvqIW
|
|
|
30
30
|
templates/static/media/fa-solid-900.bacd5de623fb563b961a.ttf,sha256=tJkNDQxfXTjWLpNu6hIGdOWEx-6o3O44qXXAz5o3U5s,420332
|
|
31
31
|
templates/static/media/fa-v4compatibility.c8e090db312b0bea2aa2.ttf,sha256=_49SX7BQxdJFGczI9XI9hbLlHt0_m8ZUivVa663U8mk,10832
|
|
32
32
|
templates/static/media/fa-v4compatibility.cf7f5903d06b79ad60f1.woff2,sha256=x6hp-sopnRW-EKAfGdB2WnxNRtiSLZuTFyNcHkpvCYI,4792
|
|
33
|
-
ziya-0.1.
|
|
34
|
-
ziya-0.1.
|
|
35
|
-
ziya-0.1.
|
|
36
|
-
ziya-0.1.
|
|
37
|
-
ziya-0.1.
|
|
33
|
+
ziya-0.1.13.dist-info/LICENSE,sha256=8CfErGEG13yY1Z-CDlIhAQawX2KOv-QI_2Ge2z6x8SU,1064
|
|
34
|
+
ziya-0.1.13.dist-info/METADATA,sha256=HPDvbeEfsdrRh6YqSsiM7M8tfJ23V982HsAb7ky-0Ps,2706
|
|
35
|
+
ziya-0.1.13.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
36
|
+
ziya-0.1.13.dist-info/entry_points.txt,sha256=6-KUolj5XXeOPVCJGTJgUL_3lDVGxG-YtK5BTvFPyBg,147
|
|
37
|
+
ziya-0.1.13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|