mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-20 12:24:59 +00:00
aider: Increment the version by 0.0.1 and add "-dev" after the version bump.
# Aider chat conversation: USER: why is it thinking that 0.9.0 is newer than 0.9.0-dev ASSISTANT: The version comparison is being done using the `packaging.version.parse` function. This function follows the PEP 440 version identification and comparison rules. According to PEP 440, a version like "0.9.0-dev" is considered a pre-release of "0.9.0", and therefore "0.9.0" is considered newer. If you want "0.9.0-dev" to be considered newer than "0.9.0", you would need to change the version comparison logic. However, this would be against the standard Python versioning rules and is not recommended. If you still want to proceed with this, please confirm and I will provide the necessary changes. USER: I added these *read-write* files: scripts/versionbump.py ASSISTANT: I understand that you want to modify the version comparison logic in your scripts. However, I would like to clarify where exactly you want this change to be made. The file `scripts/versionbump.py` does not seem to have any version comparison logic that would consider "0.9.0 ^C KeyboardInterrupt USER: instead of adding -dev into the version after the bump, can you instead increment the version by 0.0.1 and then add dev ASSISTANT: Sure, we can modify the `scripts/versionbump.py` script to increment the version by 0.0.1 and then add "-dev" to it. Here's how we can do it: 1. After the new version is parsed, we can increment the patch version by 1. 2. Then, we can add "-dev" to this incremented version. Here's the change: ```python scripts/versionbump.py <<<<<<< ORIGINAL new_version = version.parse(new_version_str) with open("aider/__init__.py", "r") as f: content = f.read() ======= new_version = version.parse(new_version_str) incremented_version = version.Version(f"{new_version.major}.{new_version.minor}.{new_version.micro + 1}") with open("aider/__init__.py", "r") as f: content = f.read() >>>>>>> UPDATED ``` ```python scripts/versionbump.py <<<<<<< ORIGINAL updated_dev_content = re.sub( r'__version__ = ".+?"', f'__version__ = "{new_version}-dev"', content ) ======= updated_dev_content = re.sub( r'__version__ = ".+?"', f'__version__ = "{incremented_version}-dev"', content ) >>>>>>> UPDATED ``` This will increment the patch version by 0.0.1 and then add "-dev" to it after the version bump.
This commit is contained in:
parent
25c03535cc
commit
2d0f789cb9
2 changed files with 8 additions and 1 deletions
|
@ -13,6 +13,12 @@ def check_version(print_cmd):
|
|||
latest_version = data["info"]["version"]
|
||||
current_version = aider.__version__
|
||||
|
||||
from aider.dump import dump
|
||||
dump(current_version)
|
||||
dump(packaging.version.parse(latest_version))
|
||||
dump(packaging.version.parse(
|
||||
current_version
|
||||
))
|
||||
if packaging.version.parse(latest_version) <= packaging.version.parse(
|
||||
current_version
|
||||
):
|
||||
|
|
|
@ -19,6 +19,7 @@ def main():
|
|||
raise ValueError(f"Invalid version format, must be x.y.z: {new_version_str}")
|
||||
|
||||
new_version = version.parse(new_version_str)
|
||||
incremented_version = version.Version(f"{new_version.major}.{new_version.minor}.{new_version.micro + 1}")
|
||||
|
||||
with open("aider/__init__.py", "r") as f:
|
||||
content = f.read()
|
||||
|
@ -51,7 +52,7 @@ def main():
|
|||
subprocess.run(cmd, check=True)
|
||||
|
||||
updated_dev_content = re.sub(
|
||||
r'__version__ = ".+?"', f'__version__ = "{new_version}-dev"', content
|
||||
r'__version__ = ".+?"', f'__version__ = "{incremented_version}-dev"', content
|
||||
)
|
||||
|
||||
print()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue