aider/aider
Paul Gauthier 25c03535cc aider: Replace deprecated pkg_resources.parse_version with packaging.version.parse for version comparison in aider/versioncheck.py.
# Aider chat conversation:

USER:     warnings.warn("pkg_resources is deprecated as an API", DeprecationWarning)

ASSISTANT: It seems like you're concerned about the deprecation warning from the `pkg_resources` module. We can replace the usage of `pkg_resources` with `packaging.version` for version comparison.

Here are the changes needed in the `aider/versioncheck.py` file:

```python
aider/versioncheck.py
<<<<<<< ORIGINAL
import pkg_resources

...

if pkg_resources.parse_version(latest_version) <= pkg_resources.parse_version(
    current_version
):
    return
=======
import packaging.version

...

if packaging.version.parse(latest_version) <= packaging.version.parse(
    current_version
):
    return
>>>>>>> UPDATED
```

This change replaces the deprecated `pkg_resources.parse_version` with `packaging.version.parse` for version comparison.

USER: InvalidEditBlock: edit failed!

aider/versioncheck.py does not contain the *exact sequence* of ORIGINAL lines you specified.
Try again.
DO NOT skip blank lines, comments, docstrings, etc!
The ORIGINAL block needs to be EXACTLY the same as the lines in aider/versioncheck.py with nothing missing!

aider/versioncheck.py does not contain these 8 exact lines in a row:
```
import pkg_resources

...

if pkg_resources.parse_version(latest_version) <= pkg_resources.parse_version(
    current_version
):
    return
```

ASSISTANT: I apologize for the confusion. Let's try again with the correct sequence of lines from the `aider/versioncheck.py` file:

```python
aider/versioncheck.py
<<<<<<< ORIGINAL
import pkg_resources

...

        if pkg_resources.parse_version(latest_version) <= pkg_resources.parse_version(
            current_version
        ):
            return
=======
import packaging.version

...

        if packaging.version.parse(latest_version) <= packaging.version.parse(
            current_version
        ):
            return
>>>>>>> UPDATED
```

This change replaces the deprecated `pkg_resources.parse_version` with `packaging.version.parse` for version comparison.
2023-07-20 08:45:58 -03:00
..
coders Ask GPT to retry if original block is not found 2023-07-19 17:24:53 -03:00
__init__.py set version to 0.9.0-dev 2023-07-16 09:47:35 -03:00
commands.py aider: Add a new /git command to run git. 2023-07-17 15:51:14 -03:00
diffs.py use utf-8 2023-07-05 20:51:35 -07:00
dump.py isort 2023-05-28 22:47:38 -07:00
io.py Added hint to Use --encoding to set the unicode encoding. 2023-07-17 08:19:21 -03:00
main.py wire into main 2023-07-20 08:43:03 -03:00
models.py Disabled general availability of gpt-4 (it's rolling out, not 100% available yet) 2023-07-08 05:57:56 -07:00
prompts.py refactor Editors 2023-06-20 16:26:00 -07:00
repomap.py Anchor the cache to the project root 2023-07-13 14:01:07 -07:00
utils.py Adopt safe_abs_path 2023-07-07 17:17:33 -07:00
versioncheck.py aider: Replace deprecated pkg_resources.parse_version with packaging.version.parse for version comparison in aider/versioncheck.py. 2023-07-20 08:45:58 -03:00