Skip to content

Commit

Permalink
build: improve support for uv (#288)
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare authored Nov 27, 2024
1 parent 906bc96 commit 25d6e45
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 19 deletions.
2 changes: 1 addition & 1 deletion gptme/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from .logmanager import Log, LogManager, prepare_messages
from .message import Message
from .prompts import get_workspace_prompt
from .readline import add_history
from .util.readline import add_history
from .tools import ToolUse, execute_msg, has_tool
from .tools.base import ConfirmFunc
from .tools.browser import read_url
Expand Down
2 changes: 1 addition & 1 deletion gptme/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
from .logmanager import ConversationMeta, get_user_conversations
from .message import Message
from .prompts import get_prompt
from .readline import add_history
from .tools import all_tools, init_tools
from .util import epoch_to_age, generate_name
from .util.readline import add_history

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion gptme/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
get_recommended_model,
set_default_model,
)
from .readline import load_readline_history, register_tabcomplete
from .tools import init_tools
from .util import console
from .util.readline import load_readline_history, register_tabcomplete

logger = logging.getLogger(__name__)
_init_done = False
Expand Down
2 changes: 1 addition & 1 deletion gptme/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def prompt_timeinfo() -> Generator[Message, None, None]:
def get_workspace_prompt(workspace: Path) -> str:
# NOTE: needs to run after the workspace is initialized (i.e. initial prompt is constructed)
# TODO: update this prompt if the files change
# TODO: include `git status/diff/log` summary, and keep it up-to-date
# TODO: include `git status -vv`, and keep it up-to-date
if project := get_project_config(workspace):
files = []
for file in project.files:
Expand Down
8 changes: 4 additions & 4 deletions gptme/readline.py → gptme/util/readline.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
from functools import lru_cache
from pathlib import Path

from .commands import COMMANDS
from .dirs import get_readline_history_file
from ..commands import COMMANDS
from ..dirs import get_readline_history_file

# noreorder
try:
import readline # fmt: skip
except ImportError: # pragma: no cover
except ImportError as e: # pragma: no cover
raise Exception(
"Unsupported platform: readline not available.\nIf you are on Windows, use WSL or Docker to run gptme."
) from None
) from e


logger = logging.getLogger(__name__)
Expand Down
5 changes: 3 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 36 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,31 @@ packages = [

include = ["gptme/server/static/**/*", "media/logo.png"]

[project]
name = "gptme"
dependencies = [
"python = \"^3.10\"",
"click = \"^8.0\"",
"python-dotenv = \"^1.0.0\"",
"rich = \"^13.5.2\"",
"tabulate = \"*\"",
"pick = \"^2.2.0\"",
"tiktoken = \">=0.7\"",
"tomlkit = \"*\"",
"typing-extensions = \"*\"",
"platformdirs = \"^4.3\"",
"lxml = \"*\"",
"ipython = \"^8.17.2\"",
"bashlex = \"^0.18\"",
]

[project.scripts]
gptme = "gptme.cli:main"
gptme-server = "gptme.server.cli:main"
gptme-eval = "gptme.eval.main:main"
gptme-util = "gptme.util.cli:main"
gptme-nc = "gptme.ncurses:main"

[tool.poetry.scripts]
gptme = "gptme.cli:main"
gptme-server = "gptme.server.cli:main"
Expand All @@ -31,20 +56,20 @@ typing-extensions = "*"
platformdirs = "^4.3"
lxml = "*"

# providers
openai = "^1.0"
anthropic = ">=0.36,<0.40"

# tools
ipython = "^8.17.2"
bashlex = "^0.18"
playwright = {version = "1.47.*", optional=true} # version constrained due to annoying to have to run `playwright install` on every update
youtube_transcript_api = {version = "^0.6.1", optional = true}
python-xlib = {version = "^0.33", optional = true} # for X11 interaction
youtube_transcript_api = {version = "^0.6.1", optional=true}
python-xlib = {version = "^0.33", optional=true} # for X11 interaction

# RAG
gptme-rag = {version = "^0.3.1", optional = true}
#gptme-rag = {path = "../gptme-rag", optional = true, develop = true}

# providers
openai = "^1.0"
anthropic = ">=0.36,<0.40"
gptme-rag = {version = "^0.3.1", optional=true}
#gptme-rag = {path = "../gptme-rag", optional=true, develop=true}

# evals
multiprocessing-logging = "^0.3.4"
Expand Down Expand Up @@ -95,6 +120,7 @@ browser = ["playwright"]
datascience = ["matplotlib", "pandas", "numpy", "pillow"]
computer = ["python-xlib", "pillow"] # pillow already in datascience but listed for clarity
rag = ["gptme-rag"] # RAG functionality
youtube = ["youtube_transcript_api"]
all = [
# server
"flask", "flask-cors",
Expand All @@ -106,6 +132,8 @@ all = [
"python-xlib",
# rag
"gptme-rag",
# youtube transcript tool
"youtube_transcript_api",
]

[tool.ruff]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_readline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import sys
from pathlib import Path

from gptme.readline import _matches
from gptme.util.readline import _matches

project_root = Path(__file__).parent.parent

Expand Down

0 comments on commit 25d6e45

Please sign in to comment.