Skip to content

Commit 76b1a8e

Browse files
committed
several fixes before initial release
1 parent 35c0d28 commit 76b1a8e

17 files changed

Lines changed: 170 additions & 153 deletions

File tree

.github/workflows/publish.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Publish to TestPyPI with uv
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: '3.11'
19+
20+
- name: Install uv
21+
run: pip install uv
22+
23+
- name: Install dependencies
24+
run: uv pip install setuptools wheel twine
25+
26+
- name: Build package
27+
run: python setup.py sdist bdist_wheel
28+
29+
- name: Publish to TestPyPI
30+
env:
31+
PYPI_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }}
32+
run: twine upload dist/* --repository testpypi --username __token__ --password $PYPI_TOKEN

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.28.3

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ tinydb
55
fasta2a
66
attrobj
77
fastapi
8+
logfire
89
uvicorn
910
pydantic
1011
aiocache

setup.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
from setuptools import setup
2+
from pathlib import Path
3+
4+
parent = Path(__file__).parent
5+
6+
description = (parent / "README.md").read_text()
7+
requirements = (parent / "requirements.txt").read_text().splitlines()
8+
9+
setup(
10+
name="venai",
11+
version="1.28.3",
12+
author="Mert Sirakaya",
13+
author_email="contact@tomris.dev",
14+
maintainer="Mert Sirakaya",
15+
maintainer_email="contact@tomris.dev",
16+
description="VenusAI is a secure and extensible Agent framework built for modern AI applications.",
17+
packages=["venus", "venus.helpers", "venus.helpers.sandbox", "venus.models"],
18+
fullname="VenusAI",
19+
install_requires=requirements,
20+
long_description=description,
21+
long_description_content_type="text/markdown",
22+
url="https://github.com/VenusAgent/VenusAI",
23+
classifiers=[
24+
"Programming Language :: Python :: 3.10",
25+
"Programming Language :: Python :: 3.11",
26+
"Programming Language :: Python :: 3.12",
27+
"License :: OSI Approved :: MIT License",
28+
"Operating System :: OS Independent",
29+
],
30+
python_requires=">=3.10",
31+
include_package_data=True,
32+
license="MIT",
33+
keywords="safety, ai, agent, llm, agentic ai, pydantic, pydantic-ai, self-healing, sandbox, ai agent",
34+
project_urls={
35+
"Documentation": "https://venai.tech/docs",
36+
"Source": "https://github.com/VenusAgent/VenusAI",
37+
"Tracker": "https://github.com/VenusAgent/VenusAI/issues",
38+
},
39+
entry_points={
40+
"console_scripts": [
41+
"venus=venus.__main__:main",
42+
"venai=venus.__main__:main",
43+
],
44+
},
45+
46+
)

tests/empty

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
silence is golden

venus/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"""
66

77
from .agent import Tool, Venus, VenusCode
8-
from .decorators import tool, mcp_tool, safe_call, autofix
8+
from .decorators import autofix, mcp_tool, safe_call, tool
99
from .errors import ErrorDict
1010
from .helpers import e2b, tools
1111

@@ -21,3 +21,5 @@
2121
"e2b",
2222
"tools",
2323
]
24+
25+
__version__ = "1.28.3"

venus/__main__.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import importlib
88
import os
9+
import sys
910
from typing import Any, cast
1011

1112
import click
@@ -19,6 +20,8 @@
1920

2021
vc = VenusConsole()
2122

23+
sys.path.insert(0, os.getcwd())
24+
2225

2326
def attr_resolve(obj: Any, path: str):
2427
"""
@@ -38,12 +41,12 @@ def attr_resolve(obj: Any, path: str):
3841
return obj
3942

4043

41-
def start_chat(app: Venus, deps: None = None):
44+
def start_chat(app: Venus, deps: None = None, prog_name: str | None = None):
4245
"""
4346
Start the chat interface.
4447
"""
45-
name = app.name or "venus"
46-
app.to_cli_sync(deps=deps, prog_name=name)
48+
prog_name = prog_name or app.name or "venus"
49+
app.to_cli_sync(deps=deps, prog_name=prog_name)
4750

4851

4952
@click.group()
@@ -57,7 +60,8 @@ def main():
5760

5861
@main.command()
5962
@click.argument("app_string")
60-
def chat(app_string: str):
63+
@click.option("--name", default="venus", help="Name of the chat assistant")
64+
def chat(app_string: str, name: str):
6165
"""Start the chat interface."""
6266
try:
6367
module_name, app_name = app_string.split(":", maxsplit=1)
@@ -70,7 +74,7 @@ def chat(app_string: str):
7074
else:
7175
app = getattr(module, app_name)
7276

73-
start_chat(app)
77+
start_chat(app, prog_name=name)
7478

7579
except ValueError:
7680
vc.print_exception(show_locals=True)
@@ -175,7 +179,6 @@ def serve(app: str, host: str, port: int, auto: bool, env: str, plugin: str = No
175179
try:
176180
module, app = app.split(":")
177181
app = app.removesuffix(".api")
178-
179182
module_instance = importlib.import_module(module)
180183
app_instance = attr_resolve(module_instance, app)
181184

@@ -221,7 +224,7 @@ def serve(app: str, host: str, port: int, auto: bool, env: str, plugin: str = No
221224
vc.fail(
222225
"[cyan]App.tools_http_api()[/cyan] "
223226
"[bold yellow]not called yet.[/bold yellow]\n"
224-
"[bold green]Hint:[/bold green] Pass [italic]--auto[/italic] to use registered tools of Agent automatically."
227+
"[bold green]Hint:[/bold green] Pass [italic]--auto[/italic] to use registered tools of Agent automatically."
225228
)
226229
return
227230

venus/_decorator_utils.py

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,16 @@
1010
from datetime import datetime
1111
from pathlib import Path
1212
from types import TracebackType
13-
from typing import (
14-
Any,
15-
Callable,
16-
ParamSpec,
17-
TypeVar,
18-
Union,
19-
cast,
20-
get_origin,
21-
get_type_hints,
22-
)
13+
from typing import (Any, Callable, ParamSpec, TypeVar, Union, cast,
14+
get_type_hints)
2315

2416
from attrobj import Object
2517
from pydantic_ai import StructuredDict
2618

2719
from venus.mock_types import Autofix
2820

29-
from .errors import (
30-
ContextParamDuplicated,
31-
ErrorDict,
32-
InvalidContextParam,
33-
InvalidDependencyParam,
34-
MainBlockNotFound,
35-
)
21+
from .errors import (ContextParamDuplicated, ErrorDict, InvalidContextParam,
22+
InvalidDependencyParam, MainBlockNotFound)
3623
from .logger import VenusConsole
3724
from .schemas import FixFuncResult
3825
from .settings import settings

venus/agent.py

Lines changed: 34 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,51 @@
1-
import json
2-
import types
3-
import tinydb
4-
import inspect
5-
import logfire
61
import asyncio
2+
import inspect
3+
import json
74
import logging
8-
import uvicorn
9-
10-
from pathlib import Path
11-
from datetime import datetime
12-
from dotenv import load_dotenv
5+
import os
6+
import types
137
from collections import defaultdict
14-
158
from contextlib import asynccontextmanager
9+
from datetime import datetime
10+
from pathlib import Path
11+
from typing import (Any, Callable, Dict, Generic, Literal, Optional, Sequence,
12+
TypeVar, Union, cast, get_type_hints, overload)
1613

17-
18-
from .settings import Settings
19-
from .logger import VenusConsole
20-
from .schemas import DoesNeedFix, FixFuncResult
21-
from .prompts import CODING_PROMPT
22-
from .helpers import tools, time_diff_prettify
23-
from .permissions import Permissions, get_allowed_tools
24-
from ._module_utils import import_module
25-
from ._decorator_utils import (
26-
extract_function_body,
27-
has_context_param,
28-
)
29-
from .decorators import safe_call, is_context_tool
30-
31-
from typing import (
32-
Any,
33-
Dict,
34-
Union,
35-
Literal,
36-
TypeVar,
37-
Generic,
38-
Callable,
39-
Sequence,
40-
cast,
41-
overload,
42-
Optional,
43-
get_type_hints,
44-
)
45-
14+
import logfire
15+
import tinydb
16+
import uvicorn
17+
from dotenv import load_dotenv
4618
from fastapi import APIRouter as Router
4719
from fastapi import FastAPI as Server
48-
4920
from pydantic_ai import Agent, EndStrategy
50-
from pydantic_ai.agent.abstract import EventStreamHandler
5121
from pydantic_ai import _system_prompt as _system_prompt
52-
from pydantic_ai._run_context import AgentDepsT
53-
from pydantic_ai.settings import ModelSettings
54-
from pydantic_ai.output import OutputSpec, OutputDataT
5522
from pydantic_ai._agent_graph import HistoryProcessor
56-
from pydantic_ai.toolsets import ToolsetFunc
57-
from pydantic_ai.agent import (
58-
InstrumentationSettings,
59-
)
23+
from pydantic_ai._run_context import AgentDepsT
24+
from pydantic_ai.agent import InstrumentationSettings
25+
from pydantic_ai.agent.abstract import EventStreamHandler
26+
from pydantic_ai.builtin_tools import AbstractBuiltinTool
6027
from pydantic_ai.mcp import MCPServer
6128
from pydantic_ai.models import KnownModelName
6229
from pydantic_ai.models.openai import Model
63-
from pydantic_ai.tools import Tool, ToolFuncContext, ToolFuncEither, ToolFuncPlain
64-
65-
from .types import FuncParams, ToolsPrepareFunc, _EnableFeature, Deps
66-
67-
from pydantic_ai.tools import ToolParams
68-
from pydantic_ai.toolsets import AbstractToolset
69-
from pydantic_ai.builtin_tools import AbstractBuiltinTool
70-
71-
from .errors import (
72-
ErrorDict,
73-
ExecutionNotAllowed,
74-
InvalidFunction,
75-
InvalidTool,
76-
InvalidTools,
77-
InvalidContextParam,
78-
)
30+
from pydantic_ai.output import OutputDataT, OutputSpec
31+
from pydantic_ai.settings import ModelSettings
32+
from pydantic_ai.tools import (Tool, ToolFuncContext, ToolFuncEither,
33+
ToolFuncPlain, ToolParams)
34+
from pydantic_ai.toolsets import AbstractToolset, ToolsetFunc
7935

8036
from . import decorators
37+
from ._decorator_utils import extract_function_body, has_context_param
38+
from ._module_utils import import_module
39+
from .decorators import is_context_tool, safe_call
40+
from .errors import (ErrorDict, ExecutionNotAllowed, InvalidContextParam,
41+
InvalidFunction, InvalidTool, InvalidTools)
42+
from .helpers import time_diff_prettify, tools
43+
from .logger import VenusConsole
44+
from .permissions import Permissions, get_allowed_tools
45+
from .prompts import CODING_PROMPT
46+
from .schemas import DoesNeedFix, FixFuncResult
47+
from .settings import Settings
48+
from .types import Deps, FuncParams, ToolsPrepareFunc, _EnableFeature
8149

8250
"""
8351
Agent module for building and configuring an agent with HTTP client support.
@@ -448,7 +416,7 @@ def build_agent(
448416
)
449417
self._agent_built = True
450418
if load_env:
451-
load_dotenv(override=override_env)
419+
load_dotenv(Path(os.getcwd()) / ".env", override=override_env)
452420

453421
model = settings.model_name
454422
system_prompt = settings.system_prompt.format(

venus/caching.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,8 @@ def decorator(
7777
) from e
7878
else:
7979
try:
80-
from cachetools import (
81-
FIFOCache,
82-
LFUCache,
83-
LRUCache,
84-
RRCache,
85-
TLRUCache,
86-
TTLCache,
87-
cached,
88-
)
80+
from cachetools import (FIFOCache, LFUCache, LRUCache, RRCache,
81+
TLRUCache, TTLCache, cached)
8982
from cachetools.keys import hashkey
9083

9184
cachekey = (

0 commit comments

Comments
 (0)