base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / ai / aider-chat / package.nix
blobab55239d814e1687652cacfeeee65b733a207c9c
2   lib,
3   stdenv,
4   python311,
5   fetchFromGitHub,
6   gitMinimal,
7   portaudio,
8 }:
10 let
11   python3 = python311.override {
12     self = python3;
13     packageOverrides = _: super: { tree-sitter = super.tree-sitter_0_21; };
14   };
15   version = "0.62.0";
16   aider-chat = python3.pkgs.buildPythonApplication {
17     pname = "aider-chat";
18     inherit version;
19     pyproject = true;
21     src = fetchFromGitHub {
22       owner = "Aider-AI";
23       repo = "aider";
24       rev = "refs/tags/v${version}";
25       hash = "sha256-o5vyOaJSUcdwuHBbzgpo5RDpZLnIur5dM+b7Y7PVBXA=";
26     };
28     pythonRelaxDeps = true;
30     build-system = with python3.pkgs; [ setuptools-scm ];
32     dependencies = with python3.pkgs; [
33       aiohappyeyeballs
34       aiohttp
35       aiosignal
36       annotated-types
37       anyio
38       attrs
39       backoff
40       beautifulsoup4
41       certifi
42       cffi
43       charset-normalizer
44       click
45       configargparse
46       diff-match-patch
47       diskcache
48       distro
49       filelock
50       flake8
51       frozenlist
52       fsspec
53       gitdb
54       gitpython
55       grep-ast
56       h11
57       httpcore
58       httpx
59       huggingface-hub
60       idna
61       importlib-resources
62       jinja2
63       jiter
64       json5
65       jsonschema
66       jsonschema-specifications
67       litellm
68       markdown-it-py
69       markupsafe
70       mccabe
71       mdurl
72       multidict
73       networkx
74       numpy
75       openai
76       packaging
77       pathspec
78       pexpect
79       pillow
80       prompt-toolkit
81       psutil
82       ptyprocess
83       pycodestyle
84       pycparser
85       pydantic
86       pydantic-core
87       pydub
88       pyflakes
89       pygments
90       pypandoc
91       pyperclip
92       python-dotenv
93       pyyaml
94       referencing
95       regex
96       requests
97       rich
98       rpds-py
99       scipy
100       smmap
101       sniffio
102       sounddevice
103       soundfile
104       soupsieve
105       tiktoken
106       tokenizers
107       tqdm
108       tree-sitter
109       tree-sitter-languages
110       typing-extensions
111       urllib3
112       wcwidth
113       yarl
114       zipp
116       # Not listed in requirements
117       mixpanel
118       monotonic
119       posthog
120       propcache
121       python-dateutil
122     ];
124     buildInputs = [ portaudio ];
126     nativeCheckInputs = (with python3.pkgs; [ pytestCheckHook ]) ++ [ gitMinimal ];
128     disabledTestPaths = [
129       # Tests require network access
130       "tests/scrape/test_scrape.py"
131       # Expected 'mock' to have been called once
132       "tests/help/test_help.py"
133     ];
135     disabledTests =
136       [
137         # Tests require network
138         "test_urls"
139         "test_get_commit_message_with_custom_prompt"
140         # FileNotFoundError
141         "test_get_commit_message"
142         # Expected 'launch_gui' to have been called once
143         "test_browser_flag_imports_streamlit"
144         # AttributeError
145         "test_simple_send_with_retries"
146         # Expected 'check_version' to have been called once
147         "test_main_exit_calls_version_check"
148       ]
149       ++ lib.optionals stdenv.hostPlatform.isDarwin [
150         # Tests fails on darwin
151         "test_dark_mode_sets_code_theme"
152         "test_default_env_file_sets_automatic_variable"
153       ];
155     preCheck = ''
156       export HOME=$(mktemp -d)
157       export AIDER_CHECK_UPDATE=false
158     '';
160     optional-dependencies = with python3.pkgs; {
161       playwright = [
162         greenlet
163         playwright
164         pyee
165         typing-extensions
166       ];
167     };
169     passthru = {
170       withPlaywright = aider-chat.overridePythonAttrs (
171         { dependencies, ... }:
172         {
173           dependencies = dependencies ++ aider-chat.optional-dependencies.playwright;
174         }
175       );
176     };
178     meta = {
179       description = "AI pair programming in your terminal";
180       homepage = "https://github.com/paul-gauthier/aider";
181       changelog = "https://github.com/paul-gauthier/aider/blob/v${version}/HISTORY.md";
182       license = lib.licenses.asl20;
183       maintainers = with lib.maintainers; [ taha-yassine ];
184       mainProgram = "aider";
185     };
186   };
188 aider-chat