mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 08:44:59 +00:00
Merge branch 'main' into mixpanel
This commit is contained in:
commit
4d04a35e73
10 changed files with 121 additions and 84 deletions
4
.github/workflows/release.yml
vendored
4
.github/workflows/release.yml
vendored
|
@ -21,12 +21,12 @@ jobs:
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install setuptools wheel twine importlib-metadata==7.2.1
|
pip install build setuptools wheel twine importlib-metadata==7.2.1
|
||||||
|
|
||||||
- name: Build and publish
|
- name: Build and publish
|
||||||
env:
|
env:
|
||||||
TWINE_USERNAME: __token__
|
TWINE_USERNAME: __token__
|
||||||
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
python setup.py sdist bdist_wheel
|
python -m build
|
||||||
twine upload dist/*
|
twine upload dist/*
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -5,6 +5,7 @@ aider.code-workspace
|
||||||
.aider*
|
.aider*
|
||||||
aider_chat.egg-info/
|
aider_chat.egg-info/
|
||||||
build
|
build
|
||||||
|
dist/
|
||||||
Gemfile.lock
|
Gemfile.lock
|
||||||
_site
|
_site
|
||||||
.jekyll-cache/
|
.jekyll-cache/
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
- Web scraper is more robust if page never idles.
|
- Web scraper is more robust if page never idles.
|
||||||
- Improved token and cost reporting for infinite output.
|
- Improved token and cost reporting for infinite output.
|
||||||
- Improvements and bug fixes for `/read` only files.
|
- Improvements and bug fixes for `/read` only files.
|
||||||
|
- Switched from `setup.py` to `pyproject.toml`, by @branchvincent.
|
||||||
- Bug fix to persist files added during `/ask`.
|
- Bug fix to persist files added during `/ask`.
|
||||||
- Bug fix for chat history size in `/tokens`.
|
- Bug fix for chat history size in `/tokens`.
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
include requirements.txt
|
|
|
@ -3,6 +3,7 @@ import importlib
|
||||||
import json
|
import json
|
||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
|
import platform
|
||||||
import sys
|
import sys
|
||||||
from dataclasses import dataclass, fields
|
from dataclasses import dataclass, fields
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
@ -674,6 +675,13 @@ def sanity_check_model(io, model):
|
||||||
io.tool_error(f"Model {model}: Missing these environment variables:")
|
io.tool_error(f"Model {model}: Missing these environment variables:")
|
||||||
for key in model.missing_keys:
|
for key in model.missing_keys:
|
||||||
io.tool_error(f"- {key}")
|
io.tool_error(f"- {key}")
|
||||||
|
|
||||||
|
if platform.system() == "Windows" or True:
|
||||||
|
io.tool_output(
|
||||||
|
"If you just set these environment variables using `setx` you may need to restart"
|
||||||
|
" your terminal or command prompt for the changes to take effect."
|
||||||
|
)
|
||||||
|
|
||||||
elif not model.keys_in_environment:
|
elif not model.keys_in_environment:
|
||||||
show = True
|
show = True
|
||||||
io.tool_output(f"Model {model}: Unknown which environment variables are required.")
|
io.tool_output(f"Model {model}: Unknown which environment variables are required.")
|
||||||
|
|
|
@ -26,6 +26,7 @@ cog.out(text)
|
||||||
- Web scraper is more robust if page never idles.
|
- Web scraper is more robust if page never idles.
|
||||||
- Improved token and cost reporting for infinite output.
|
- Improved token and cost reporting for infinite output.
|
||||||
- Improvements and bug fixes for `/read` only files.
|
- Improvements and bug fixes for `/read` only files.
|
||||||
|
- Switched from `setup.py` to `pyproject.toml`, by @branchvincent.
|
||||||
- Bug fix to persist files added during `/ask`.
|
- Bug fix to persist files added during `/ask`.
|
||||||
- Bug fix for chat history size in `/tokens`.
|
- Bug fix for chat history size in `/tokens`.
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,10 @@ Model azure/gpt-4-turbo: Missing these environment variables:
|
||||||
- AZURE_API_KEY
|
- AZURE_API_KEY
|
||||||
```
|
```
|
||||||
|
|
||||||
|
{: .tip }
|
||||||
|
On Windows,
|
||||||
|
if you just set these environment variables using `setx` you may need to restart your terminal or
|
||||||
|
command prompt for the changes to take effect.
|
||||||
|
|
||||||
|
|
||||||
## Unknown which environment variables are required
|
## Unknown which environment variables are required
|
||||||
|
|
67
pyproject.toml
Normal file
67
pyproject.toml
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
# [[[cog
|
||||||
|
# from aider.help_pats import exclude_website_pats
|
||||||
|
# ]]]
|
||||||
|
# [[[end]]]
|
||||||
|
|
||||||
|
[project]
|
||||||
|
name = "aider-chat"
|
||||||
|
description = "Aider is AI pair programming in your terminal"
|
||||||
|
readme = "README.md"
|
||||||
|
classifiers = [
|
||||||
|
"Development Status :: 4 - Beta",
|
||||||
|
"Environment :: Console",
|
||||||
|
"Intended Audience :: Developers",
|
||||||
|
"License :: OSI Approved :: Apache Software License",
|
||||||
|
"Programming Language :: Python :: 3",
|
||||||
|
"Programming Language :: Python :: 3.10",
|
||||||
|
"Programming Language :: Python :: 3.11",
|
||||||
|
"Programming Language :: Python :: 3.12",
|
||||||
|
"Programming Language :: Python :: 3.9",
|
||||||
|
"Programming Language :: Python",
|
||||||
|
"Topic :: Software Development",
|
||||||
|
]
|
||||||
|
requires-python = ">=3.9,<3.13"
|
||||||
|
dynamic = ["dependencies", "optional-dependencies", "version"]
|
||||||
|
|
||||||
|
[project.urls]
|
||||||
|
Homepage = "https://github.com/paul-gauthier/aider"
|
||||||
|
|
||||||
|
[project.scripts]
|
||||||
|
aider = "aider.main:main"
|
||||||
|
|
||||||
|
[tool.setuptools.dynamic]
|
||||||
|
version = { attr = "aider.__init__.__version__" }
|
||||||
|
dependencies = { file = "requirements.txt" }
|
||||||
|
|
||||||
|
[tool.setuptools.dynamic.optional-dependencies]
|
||||||
|
dev = { file = "requirements/requirements-dev.txt" }
|
||||||
|
help = { file = "requirements/requirements-help.txt" }
|
||||||
|
browser = { file = "requirements/requirements-browser.txt" }
|
||||||
|
playwright = { file = "requirements/requirements-playwright.txt" }
|
||||||
|
|
||||||
|
[tool.setuptools.packages.find]
|
||||||
|
include = ["aider*", "aider.website"]
|
||||||
|
|
||||||
|
[tool.setuptools.package-data]
|
||||||
|
"aider" = ["queries/*.scm"]
|
||||||
|
"aider.website" = ["**/*.md"]
|
||||||
|
|
||||||
|
[tool.setuptools.exclude-package-data]
|
||||||
|
"aider.website" = [
|
||||||
|
# [[[cog
|
||||||
|
# cog.out("\n".join(f' "{pat}",' for pat in exclude_website_pats))
|
||||||
|
# ]]]
|
||||||
|
"examples/**",
|
||||||
|
"_posts/**",
|
||||||
|
"HISTORY.md",
|
||||||
|
"docs/benchmarks*md",
|
||||||
|
"docs/ctags.md",
|
||||||
|
"docs/unified-diffs.md",
|
||||||
|
"docs/leaderboards/index.md",
|
||||||
|
"assets/**",
|
||||||
|
# [[[end]]]
|
||||||
|
]
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["setuptools>=68"]
|
||||||
|
build-backend = "setuptools.build_meta"
|
|
@ -9,22 +9,36 @@ import sys
|
||||||
from packaging import version
|
from packaging import version
|
||||||
|
|
||||||
|
|
||||||
|
def check_cog_pyproject():
|
||||||
|
result = subprocess.run(["cog", "--check", "pyproject.toml"], capture_output=True, text=True)
|
||||||
|
|
||||||
|
if result.returncode != 0:
|
||||||
|
print("Error: cog --check pyproject.toml failed, updating.")
|
||||||
|
subprocess.run(["cog", "-r", "pyproject.toml"])
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description="Bump version")
|
parser = argparse.ArgumentParser(description="Bump version")
|
||||||
parser.add_argument("new_version", help="New version in x.y.z format")
|
parser.add_argument("new_version", help="New version in x.y.z format")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--dry-run", action="store_true", help="Print each step without actually executing them"
|
"--dry-run", action="store_true", help="Print each step without actually executing them"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Function to check if we are on the main branch
|
# Function to check if we are on the main branch
|
||||||
def check_branch():
|
def check_branch():
|
||||||
branch = subprocess.run(["git", "rev-parse", "--abbrev-ref", "HEAD"], capture_output=True, text=True).stdout.strip()
|
branch = subprocess.run(
|
||||||
|
["git", "rev-parse", "--abbrev-ref", "HEAD"], capture_output=True, text=True
|
||||||
|
).stdout.strip()
|
||||||
if branch != "main":
|
if branch != "main":
|
||||||
print("Error: Not on the main branch.")
|
print("Error: Not on the main branch.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Function to check if the working directory is clean
|
# Function to check if the working directory is clean
|
||||||
def check_working_directory_clean():
|
def check_working_directory_clean():
|
||||||
status = subprocess.run(["git", "status", "--porcelain"], capture_output=True, text=True).stdout
|
status = subprocess.run(
|
||||||
|
["git", "status", "--porcelain"], capture_output=True, text=True
|
||||||
|
).stdout
|
||||||
if status:
|
if status:
|
||||||
print("Error: Working directory is not clean.")
|
print("Error: Working directory is not clean.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@ -32,19 +46,33 @@ def main():
|
||||||
# Function to fetch the latest changes and check if the main branch is up to date
|
# Function to fetch the latest changes and check if the main branch is up to date
|
||||||
def check_main_branch_up_to_date():
|
def check_main_branch_up_to_date():
|
||||||
subprocess.run(["git", "fetch", "origin"], check=True)
|
subprocess.run(["git", "fetch", "origin"], check=True)
|
||||||
local_main = subprocess.run(["git", "rev-parse", "main"], capture_output=True, text=True).stdout.strip()
|
local_main = subprocess.run(
|
||||||
|
["git", "rev-parse", "main"], capture_output=True, text=True
|
||||||
|
).stdout.strip()
|
||||||
print(f"Local main commit hash: {local_main}")
|
print(f"Local main commit hash: {local_main}")
|
||||||
origin_main = subprocess.run(["git", "rev-parse", "origin/main"], capture_output=True, text=True).stdout.strip()
|
origin_main = subprocess.run(
|
||||||
|
["git", "rev-parse", "origin/main"], capture_output=True, text=True
|
||||||
|
).stdout.strip()
|
||||||
print(f"Origin main commit hash: {origin_main}")
|
print(f"Origin main commit hash: {origin_main}")
|
||||||
if local_main != origin_main:
|
if local_main != origin_main:
|
||||||
local_date = subprocess.run(["git", "show", "-s", "--format=%ci", "main"], capture_output=True, text=True).stdout.strip()
|
local_date = subprocess.run(
|
||||||
origin_date = subprocess.run(["git", "show", "-s", "--format=%ci", "origin/main"], capture_output=True, text=True).stdout.strip()
|
["git", "show", "-s", "--format=%ci", "main"], capture_output=True, text=True
|
||||||
|
).stdout.strip()
|
||||||
|
origin_date = subprocess.run(
|
||||||
|
["git", "show", "-s", "--format=%ci", "origin/main"], capture_output=True, text=True
|
||||||
|
).stdout.strip()
|
||||||
local_date = datetime.datetime.strptime(local_date, "%Y-%m-%d %H:%M:%S %z")
|
local_date = datetime.datetime.strptime(local_date, "%Y-%m-%d %H:%M:%S %z")
|
||||||
origin_date = datetime.datetime.strptime(origin_date, "%Y-%m-%d %H:%M:%S %z")
|
origin_date = datetime.datetime.strptime(origin_date, "%Y-%m-%d %H:%M:%S %z")
|
||||||
if local_date < origin_date:
|
if local_date < origin_date:
|
||||||
print("Error: The local main branch is behind origin/main. Please pull the latest changes.")
|
print(
|
||||||
|
"Error: The local main branch is behind origin/main. Please pull the latest"
|
||||||
|
" changes."
|
||||||
|
)
|
||||||
elif local_date > origin_date:
|
elif local_date > origin_date:
|
||||||
print("Error: The origin/main branch is behind the local main branch. Please push your changes.")
|
print(
|
||||||
|
"Error: The origin/main branch is behind the local main branch. Please push"
|
||||||
|
" your changes."
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
print("Error: The main branch and origin/main have diverged.")
|
print("Error: The main branch and origin/main have diverged.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@ -53,6 +81,7 @@ def main():
|
||||||
dry_run = args.dry_run
|
dry_run = args.dry_run
|
||||||
|
|
||||||
# Perform checks before proceeding
|
# Perform checks before proceeding
|
||||||
|
check_cog_pyproject()
|
||||||
check_branch()
|
check_branch()
|
||||||
check_working_directory_clean()
|
check_working_directory_clean()
|
||||||
check_main_branch_up_to_date()
|
check_main_branch_up_to_date()
|
||||||
|
|
73
setup.py
73
setup.py
|
@ -1,73 +0,0 @@
|
||||||
import re
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from setuptools import find_packages, setup
|
|
||||||
|
|
||||||
from aider import __version__
|
|
||||||
from aider.help_pats import exclude_website_pats
|
|
||||||
|
|
||||||
|
|
||||||
def get_requirements(suffix=""):
|
|
||||||
if suffix:
|
|
||||||
fname = "requirements-" + suffix + ".txt"
|
|
||||||
fname = Path("requirements") / fname
|
|
||||||
else:
|
|
||||||
fname = Path("requirements.txt")
|
|
||||||
|
|
||||||
requirements = fname.read_text().splitlines()
|
|
||||||
|
|
||||||
return requirements
|
|
||||||
|
|
||||||
|
|
||||||
requirements = get_requirements()
|
|
||||||
|
|
||||||
# README
|
|
||||||
with open("README.md", "r", encoding="utf-8") as f:
|
|
||||||
long_description = f.read()
|
|
||||||
long_description = re.sub(r"\n!\[.*\]\(.*\)", "", long_description)
|
|
||||||
# long_description = re.sub(r"\n- \[.*\]\(.*\)", "", long_description)
|
|
||||||
|
|
||||||
# Discover packages, plus the website
|
|
||||||
packages = find_packages(exclude=["benchmark", "tests"])
|
|
||||||
packages += ["aider.website"]
|
|
||||||
|
|
||||||
print("Packages:", packages)
|
|
||||||
|
|
||||||
extras = "dev help browser playwright".split()
|
|
||||||
|
|
||||||
setup(
|
|
||||||
name="aider-chat",
|
|
||||||
version=__version__,
|
|
||||||
packages=packages,
|
|
||||||
include_package_data=True,
|
|
||||||
package_data={
|
|
||||||
"aider": ["queries/*.scm"],
|
|
||||||
"aider.website": ["**/*.md"],
|
|
||||||
},
|
|
||||||
exclude_package_data={"aider.website": exclude_website_pats},
|
|
||||||
install_requires=requirements,
|
|
||||||
extras_require={extra: get_requirements(extra) for extra in extras},
|
|
||||||
python_requires=">=3.9,<3.13",
|
|
||||||
entry_points={
|
|
||||||
"console_scripts": [
|
|
||||||
"aider = aider.main:main",
|
|
||||||
],
|
|
||||||
},
|
|
||||||
description="Aider is AI pair programming in your terminal",
|
|
||||||
long_description=long_description,
|
|
||||||
long_description_content_type="text/markdown",
|
|
||||||
url="https://github.com/paul-gauthier/aider",
|
|
||||||
classifiers=[
|
|
||||||
"Development Status :: 4 - Beta",
|
|
||||||
"Environment :: Console",
|
|
||||||
"Intended Audience :: Developers",
|
|
||||||
"License :: OSI Approved :: Apache Software License",
|
|
||||||
"Programming Language :: Python :: 3",
|
|
||||||
"Programming Language :: Python :: 3.10",
|
|
||||||
"Programming Language :: Python :: 3.11",
|
|
||||||
"Programming Language :: Python :: 3.12",
|
|
||||||
"Programming Language :: Python :: 3.9",
|
|
||||||
"Programming Language :: Python",
|
|
||||||
"Topic :: Software Development",
|
|
||||||
],
|
|
||||||
)
|
|
Loading…
Add table
Add a link
Reference in a new issue