Commit graph

3735 commits

Author SHA1 Message Date
Paul Gauthier
3449f7da42 quiet tree-sitter warnings 2024-04-18 16:36:56 -07:00
Paul Gauthier
65400981c5 aider: Replace deprecated pkg_resources.resource_filename with importlib.resources.files for accessing package resources in Python 3.9+.
# Aider chat conversation:

USER: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html

ASSISTANT: To address the `DeprecationWarning` regarding `pkg_resources`, we will replace its usage with the recommended `importlib.resources` or `importlib.metadata` from the Python standard library. The specific replacement depends on the original use case of `pkg_resources`. In the provided code, `pkg_resources` is used to access package data, so we will use `importlib.resources`.

Here are the diffs for the necessary changes:

```diff
--- aider/repomap.py
+++ aider/repomap.py
@@ ... @@
 import networkx as nx
-import pkg_resources
+import importlib.resources as pkg_resources
 from diskcache import Cache
 from grep_ast import TreeContext, filename_to_lang
 from pygments.lexers import guess_lexer_for_filename
 from pygments.token import Token
 from pygments.util import ClassNotFound
@@ ... @@
         # Load the tags queries
         try:
-            scm_fname = pkg_resources.resource_filename(
-                __name__, os.path.join("queries", f"tree-sitter-{lang}-tags.scm")
-            )
+            scm_fname = pkg_resources.files(__package__).joinpath(
+                "queries", f"tree-sitter-{lang}-tags.scm"
+            )
         except KeyError:
             return
-        query_scm = Path(scm_fname)
+        query_scm = scm_fname
         if not query_scm.exists():
             return
         query_scm = query_scm.read_text()
```

These changes replace the deprecated `pkg_resources.resource_filename` with `importlib.resources.files`, which is the recommended way to access package resources in Python 3.9 and later. The `files()` function returns a `Path`-like object that can be used to read the contents of the resource.
2024-04-18 16:30:10 -07:00
Paul Gauthier
7a047dc98e networkx 3.3 no longer works on python 3.9 2024-04-18 16:25:21 -07:00
Paul Gauthier
fbcbe137ab cleanup 2024-04-18 16:21:15 -07:00
Paul Gauthier
d750511c7c added litellm dep; upgraded all deps 2024-04-18 16:18:36 -07:00
Paul Gauthier
957026d3cc fixed test_sendchat 2024-04-18 16:13:08 -07:00
Paul Gauthier
363b3202ab fixed test_repomap 2024-04-18 16:06:35 -07:00
Paul Gauthier
2a3eb8ac35 fixed test_editblock and _wholefile 2024-04-18 16:02:50 -07:00
Paul Gauthier
512b991a51 fixed test_coder 2024-04-18 15:55:59 -07:00
Paul Gauthier
f960774b51 fixed test_commands 2024-04-18 15:01:02 -07:00
Paul Gauthier
67cc974454 fixed test_main 2024-04-18 14:57:51 -07:00
Paul Gauthier
733c09d30f fixed test_repo 2024-04-18 14:55:56 -07:00
Paul Gauthier
cb547da90c Fixed test_models 2024-04-18 14:53:20 -07:00
Paul Gauthier
f291c8f777 dropped aliases 2024-04-18 14:44:50 -07:00
Paul Gauthier
0da1b59901 Fixed up images in chat 2024-04-18 14:39:32 -07:00
Paul Gauthier
f1c09ececf Switched voice to litellm 2024-04-18 14:13:26 -07:00
Paul Gauthier
cf2a48b21f get_weak_model 2024-04-18 13:55:43 -07:00
Paul Gauthier
93f4a46996 reorg 2024-04-18 09:29:26 -07:00
Paul Gauthier
15c1ad1f96 aider: Create the NoModelInfo class to handle exceptions when model information cannot be retrieved.
# Aider chat conversation:

USER: create the `NoModelInfo` class

ASSISTANT: ```diff
--- aider/models/model.py
+++ aider/models/model.py
@@ ... @@
 from dataclasses import dataclass, fields

 import litellm
+from typing import Optional
 from PIL import Image

 from aider.dump import dump

+class NoModelInfo(Exception):
+    """
+    Exception raised when model information cannot be retrieved.
+    """
+    def __init__(self, message: Optional[str] = None):
+        super().__init__(message or "No model information available.")
+
 @dataclass
 class ModelSettings:
     name: str
```
2024-04-18 09:26:07 -07:00
Paul Gauthier
dd000c6147 Add exception handling when retrieving model info in the Model class constructor. 2024-04-18 09:26:05 -07:00
Paul Gauthier
79170839ee noop 2024-04-18 09:24:18 -07:00
Paul Gauthier
68888faa6f Configure model settings, adopt litellm bugfix 2024-04-18 09:22:32 -07:00
Paul Gauthier
f12bbf1e5b todo 2024-04-17 15:55:55 -07:00
Paul Gauthier
c770fc4380 cleaned up client refs 2024-04-17 15:47:07 -07:00
Paul Gauthier
f1a31d3944 pass in commit models to gitrepo 2024-04-17 15:41:30 -07:00
Paul Gauthier
3662a4680b token pricing 2024-04-17 15:34:59 -07:00
Paul Gauthier
c9bb22d6d5 roughed in tokenizer, dropped openai, openrouter 2024-04-17 15:22:35 -07:00
Paul Gauthier
855e787175 removed skip-model-avail-check 2024-04-17 15:02:39 -07:00
Paul Gauthier
8e0f291a16 undo 2024-04-17 14:15:48 -07:00
Paul Gauthier
b0245d3930 rouged in litellm 2024-04-17 14:15:24 -07:00
Paul Gauthier
93de82c3da fixed regex in .gitignore 2024-04-17 13:31:49 -07:00
Paul Gauthier
176f6272ce Added CONTRIBUTING.md 2024-04-17 12:56:26 -07:00
Paul Gauthier
619cf47f5d Added .gitignore 2024-04-17 12:53:39 -07:00
Paul Gauthier
f6a4b7cbc7 copy 2024-04-17 08:07:37 -07:00
Paul Gauthier
7699866802 Handle missing api key without exception #559 2024-04-15 12:29:49 -07:00
Paul Gauthier
9b2e697584 copy 2024-04-12 08:32:18 -07:00
Paul Gauthier
645a18339e Updated HISTORY 2024-04-12 08:30:47 -07:00
Paul Gauthier
d010ed22de Merge remote-tracking branch 'origin/main' 2024-04-12 08:27:20 -07:00
Paul Gauthier
a84b4f8144 Add the ability to add images that are located outside the git repo #519 2024-04-12 08:26:49 -07:00
Paul Gauthier
c2b8b2355d Handle diffs on a detached head #520 2024-04-12 08:26:49 -07:00
paul-gauthier
63926a43b8
Update faq.md 2024-04-11 16:13:22 -07:00
Paul Gauthier
5c10944054 Abstract the default model name so it applies to scripting #537 2024-04-11 06:42:38 -07:00
paul-gauthier
cf7dfa816e
Merge pull request #545 from a1ooha/patch-1
Fix: use f-string
2024-04-11 06:25:20 -07:00
Aloha
1fc1c304c7
Fix: use f-string 2024-04-11 16:58:10 +08:00
paul-gauthier
04b191a25a
Update README.md 2024-04-10 19:42:55 -07:00
Paul Gauthier
7875418183 fix column order 2024-04-09 18:11:08 -07:00
Paul Gauthier
324655be75 copy 2024-04-09 17:13:12 -07:00
Paul Gauthier
17a1de22e2 copy 2024-04-09 17:06:58 -07:00
Paul Gauthier
f6c5112cc1 copy 2024-04-09 17:00:54 -07:00
Paul Gauthier
c0a6d1d1e5 copy 2024-04-09 16:59:52 -07:00