Skip to content

Commit

Permalink
refactor: Improve version handling and cleanup version-related files
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-gauthier committed Nov 30, 2024
1 parent 295040c commit 0dbaec5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ _site
.jekyll-cache/
.jekyll-metadata
aider/__version__.py
aider/_version.py
.venv/
.gitattributes
17 changes: 10 additions & 7 deletions aider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
safe_version = __version__

try:
from aider.__version__ import __version__
from aider._version import __version__
except Exception:
__version__ = safe_version + ".import"
__version__ = safe_version + "+import"

try:
if version.parse(__version__) < version.parse(safe_version):
__version__ = safe_version + ".less"
except Exception:
__version__ = safe_version + ".parse"
if type(__version__) is not str:
__version__ = safe_version + "+type"
else:
try:
if version.parse(__version__) < version.parse(safe_version):
__version__ = safe_version + "+less"
except Exception:
__version__ = safe_version + "+parse"

__all__ = [__version__]
2 changes: 1 addition & 1 deletion aider/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ def cmd_exit(self, args):

def cmd_quit(self, args):
"Exit the application"
sys.exit()
self.cmd_exit(args)

def cmd_ls(self, args):
"List all known files and indicate which are included in the chat session"
Expand Down
4 changes: 4 additions & 0 deletions aider/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,10 @@ def is_first_run_of_new_version(io, verbose=False):
installs_file = Path.home() / ".aider" / "installs.json"
key = (__version__, sys.executable)

# Never show notes for .dev versions
if ".dev" in __version__:
return False

if verbose:
io.tool_output(
f"Checking imports for version {__version__} and executable {sys.executable}"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ requires = ["setuptools>=68", "setuptools_scm[toml]>=8"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
write_to = "aider/__version__.py"
write_to = "aider/_version.py"

[tool.codespell]
skip = "*.svg,Gemfile.lock"
Expand Down

0 comments on commit 0dbaec5

Please sign in to comment.