Commit graph

1745 commits

Author SHA1 Message Date
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
fbcbe137ab cleanup 2024-04-18 16:21:15 -07:00
Paul Gauthier
f960774b51 fixed test_commands 2024-04-18 15:01:02 -07:00
Paul Gauthier
733c09d30f fixed test_repo 2024-04-18 14:55:56 -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
7699866802 Handle missing api key without exception #559 2024-04-15 12:29:49 -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
5c10944054 Abstract the default model name so it applies to scripting #537 2024-04-11 06:42:38 -07:00
Aloha
1fc1c304c7
Fix: use f-string 2024-04-11 16:58:10 +08:00
Paul Gauthier
b117c1580c set version to 0.28.1-dev 2024-04-09 16:06:32 -07:00
Paul Gauthier
aa02bd16b5 version bump to 0.28.0 2024-04-09 16:05:54 -07:00
Paul Gauthier
b75fdb92d5 Added gpt-4-turbo-2024-04-09, gpt-4-turbo 2024-04-09 14:24:13 -07:00
Paul Gauthier
3ab49f1df3 set version to 0.27.1-dev 2024-03-22 10:59:17 -07:00
Paul Gauthier
1d5b3c13d3 version bump to 0.27.0 2024-03-22 10:58:42 -07:00
Paul Gauthier
8f98f3b430 Handle languages without tags.scm files #514 2024-03-22 10:14:22 -07:00
Paul Gauthier
837f3ab048 Merge remote-tracking branch 'origin/main' 2024-03-22 10:03:04 -07:00
Paul Gauthier
a39965a9ff Only /undo the files which were part of the last commit, don't stomp other dirty files #513 2024-03-22 10:00:15 -07:00
paul-gauthier
4dd09bde99
Merge pull request #477 from ryanfreckleton/typescript-repo-map-fix 2024-03-20 18:14:39 -07:00
Paul Gauthier
7103029abb Only redact non-null values #505 2024-03-19 12:00:00 -07:00
Paul Gauthier
a4d3d2b7a5 set version to 0.26.2-dev 2024-03-10 11:24:25 -07:00
Paul Gauthier
f75576f890 version bump to 0.26.1 2024-03-10 11:23:49 -07:00
Paul Gauthier
0f9efc881e catch configparser errors 2024-03-10 08:22:48 -07:00
Paul Gauthier
31909221cc set version to 0.26.1-dev 2024-03-08 13:16:15 -08:00
Paul Gauthier
43ce68cf59 version bump to 0.26.0 2024-03-08 13:15:39 -08:00
Paul Gauthier
058c237a28 Use gpt4 turbo as the default model 2024-03-08 13:13:20 -08:00
Paul Gauthier
f565057ad4 Improved logic to check for git user name/email 2024-03-08 12:37:21 -08:00
Paul Gauthier
0871764766 Don't share local git errors with GPT #500 2024-03-08 12:24:54 -08:00
Paul Gauthier
7fbd9e2be4 Added claude post 2024-03-08 08:00:41 -08:00
Paul Gauthier
fbc3f38256 tweaked model args 2024-03-07 13:07:02 -08:00
Ryan Freckleton
e841e029b8 fix(tree-sitter-typescript-tags.scm): Add additional queries.
This fixes the behavior of the typescript parsing, while maintaining prior functionality.
2024-03-04 15:03:55 -07:00
Ryan Freckleton
19c8fa389f fix(tree-sitter-typescript-tags): correct tree-sitter queries
Add a new test case for typescript.
Fix queries for typescript.
2024-03-04 14:36:35 -07:00
Paul Gauthier
3d47049d48 set version to 0.25.1-dev 2024-03-04 12:39:00 -08:00
Paul Gauthier
75d129e679 version bump to 0.25.0 2024-03-04 12:38:28 -08:00