patchllm 0.2.1__py3-none-any.whl → 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- patchllm/__main__.py +0 -0
- patchllm/agent/__init__.py +0 -0
- patchllm/agent/actions.py +73 -0
- patchllm/agent/executor.py +57 -0
- patchllm/agent/planner.py +76 -0
- patchllm/agent/session.py +425 -0
- patchllm/cli/__init__.py +0 -0
- patchllm/cli/entrypoint.py +120 -0
- patchllm/cli/handlers.py +192 -0
- patchllm/cli/helpers.py +72 -0
- patchllm/interactive/__init__.py +0 -0
- patchllm/interactive/selector.py +100 -0
- patchllm/llm.py +39 -0
- patchllm/main.py +1 -283
- patchllm/parser.py +120 -64
- patchllm/patcher.py +118 -0
- patchllm/scopes/__init__.py +0 -0
- patchllm/scopes/builder.py +55 -0
- patchllm/scopes/constants.py +70 -0
- patchllm/scopes/helpers.py +147 -0
- patchllm/scopes/resolvers.py +82 -0
- patchllm/scopes/structure.py +64 -0
- patchllm/tui/__init__.py +0 -0
- patchllm/tui/completer.py +153 -0
- patchllm/tui/interface.py +703 -0
- patchllm/utils.py +19 -1
- patchllm/voice/__init__.py +0 -0
- patchllm/{listener.py → voice/listener.py} +8 -1
- patchllm-1.0.0.dist-info/METADATA +153 -0
- patchllm-1.0.0.dist-info/RECORD +51 -0
- patchllm-1.0.0.dist-info/entry_points.txt +2 -0
- {patchllm-0.2.1.dist-info → patchllm-1.0.0.dist-info}/top_level.txt +1 -0
- tests/__init__.py +0 -0
- tests/conftest.py +112 -0
- tests/test_actions.py +62 -0
- tests/test_agent.py +383 -0
- tests/test_completer.py +121 -0
- tests/test_context.py +140 -0
- tests/test_executor.py +60 -0
- tests/test_interactive.py +64 -0
- tests/test_parser.py +70 -0
- tests/test_patcher.py +71 -0
- tests/test_planner.py +53 -0
- tests/test_recipes.py +111 -0
- tests/test_scopes.py +47 -0
- tests/test_structure.py +48 -0
- tests/test_tui.py +397 -0
- tests/test_utils.py +31 -0
- patchllm/context.py +0 -238
- patchllm-0.2.1.dist-info/METADATA +0 -127
- patchllm-0.2.1.dist-info/RECORD +0 -12
- patchllm-0.2.1.dist-info/entry_points.txt +0 -2
- {patchllm-0.2.1.dist-info → patchllm-1.0.0.dist-info}/WHEEL +0 -0
- {patchllm-0.2.1.dist-info → patchllm-1.0.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,127 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.4
|
2
|
-
Name: patchllm
|
3
|
-
Version: 0.2.1
|
4
|
-
Summary: Lightweight tool to manage contexts and update code with LLMs
|
5
|
-
Author: nassimberrada
|
6
|
-
License: MIT License
|
7
|
-
|
8
|
-
Copyright (c) 2025 nassimberrada
|
9
|
-
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
11
|
-
of this software and associated documentation files (the “Software”), to deal
|
12
|
-
in the Software without restriction, including without limitation the rights
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
15
|
-
furnished to do so, subject to the following conditions:
|
16
|
-
|
17
|
-
The above copyright notice and this permission notice shall be included in all
|
18
|
-
copies or substantial portions of the Software.
|
19
|
-
|
20
|
-
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
26
|
-
SOFTWARE.
|
27
|
-
Requires-Python: >=3.8
|
28
|
-
Description-Content-Type: text/markdown
|
29
|
-
License-File: LICENSE
|
30
|
-
Requires-Dist: litellm
|
31
|
-
Requires-Dist: python-dotenv
|
32
|
-
Requires-Dist: rich
|
33
|
-
Provides-Extra: voice
|
34
|
-
Requires-Dist: SpeechRecognition; extra == "voice"
|
35
|
-
Requires-Dist: pyttsx3; extra == "voice"
|
36
|
-
Provides-Extra: url
|
37
|
-
Requires-Dist: html2text; extra == "url"
|
38
|
-
Dynamic: license-file
|
39
|
-
|
40
|
-
<p align="center">
|
41
|
-
<picture>
|
42
|
-
<source srcset="./assets/logo_dark.png" media="(prefers-color-scheme: dark)">
|
43
|
-
<source srcset="./assets/logo_light.png" media="(prefers-color-scheme: light)">
|
44
|
-
<img src="./assets/logo_light.png" alt="PatchLLM Logo" height="200">
|
45
|
-
</picture>
|
46
|
-
</p>
|
47
|
-
|
48
|
-
## About
|
49
|
-
PatchLLM is a command-line tool that lets you flexibly build LLM context from your codebase using glob patterns, URLs, and keyword searches. It then automatically applies file edits directly from the LLM's response.
|
50
|
-
|
51
|
-
## Usage
|
52
|
-
PatchLLM is designed to be used directly from your terminal.
|
53
|
-
|
54
|
-
### 1. Initialize a Configuration
|
55
|
-
The easiest way to get started is to run the interactive initializer. This will create a `configs.py` file for you.
|
56
|
-
|
57
|
-
```bash
|
58
|
-
patchllm --init
|
59
|
-
```
|
60
|
-
|
61
|
-
This will guide you through creating your first context configuration, including setting a base path and file patterns. You can add multiple configurations to this file.
|
62
|
-
|
63
|
-
A generated `configs.py` might look like this:
|
64
|
-
```python
|
65
|
-
# configs.py
|
66
|
-
configs = {
|
67
|
-
"default": {
|
68
|
-
"path": ".",
|
69
|
-
"include_patterns": ["**/*.py"],
|
70
|
-
"exclude_patterns": ["**/tests/*", "venv/*"],
|
71
|
-
"urls": ["https://docs.python.org/3/library/argparse.html"]
|
72
|
-
},
|
73
|
-
"docs": {
|
74
|
-
"path": "./docs",
|
75
|
-
"include_patterns": ["**/*.md"],
|
76
|
-
}
|
77
|
-
}
|
78
|
-
```
|
79
|
-
|
80
|
-
### 2. Run a Task
|
81
|
-
Use the `patchllm` command with a configuration name and a task instruction.
|
82
|
-
|
83
|
-
```bash
|
84
|
-
# Apply a change using the 'default' configuration
|
85
|
-
patchllm --config default --task "Add type hints to the main function in main.py"
|
86
|
-
```
|
87
|
-
|
88
|
-
The tool will then:
|
89
|
-
1. Build a context from the files and URLs matching your configuration.
|
90
|
-
2. Send the context and your task to the configured LLM.
|
91
|
-
3. Parse the response and automatically write the changes to the relevant files.
|
92
|
-
|
93
|
-
### All Commands & Options
|
94
|
-
|
95
|
-
#### Configuration Management
|
96
|
-
* `--init`: Create a new configuration interactively.
|
97
|
-
* `--list-configs`: List all available configurations from your `configs.py`.
|
98
|
-
* `--show-config <name>`: Display the settings for a specific configuration.
|
99
|
-
|
100
|
-
#### Core Task Execution
|
101
|
-
* `--config <name>`: The name of the configuration to use for building context.
|
102
|
-
* `--task "<instruction>"`: The task instruction for the LLM.
|
103
|
-
* `--model <model_name>`: Specify a different model (e.g., `claude-3-opus`). Defaults to `gemini/gemini-1.5-flash`.
|
104
|
-
|
105
|
-
#### Context Handling
|
106
|
-
* `--context-out [filename]`: Save the generated context to a file (defaults to `context.md`) instead of sending it to the LLM.
|
107
|
-
* `--context-in <filename>`: Use a previously saved context file directly, skipping context generation.
|
108
|
-
* `--update False`: A flag to prevent sending the prompt to the LLM. Useful when you only want to generate and save the context with `--context-out`.
|
109
|
-
|
110
|
-
#### Alternative Inputs
|
111
|
-
* `--from-file <filename>`: Apply file patches directly from a local file instead of from an LLM response.
|
112
|
-
* `--from-clipboard`: Apply file patches directly from your clipboard content.
|
113
|
-
* `--voice True`: Use voice recognition to provide the task instruction. Requires extra dependencies.
|
114
|
-
|
115
|
-
### Setup
|
116
|
-
|
117
|
-
PatchLLM uses [LiteLLM](https://github.com/BerriAI/litellm) under the hood. Please refer to their documentation for setting up API keys (e.g., `OPENAI_API_KEY`, `GEMINI_API_KEY`) in a `.env` file and for a full list of available models.
|
118
|
-
|
119
|
-
To use the voice feature (`--voice True`), you will need to install extra dependencies:
|
120
|
-
```bash
|
121
|
-
pip install "speechrecognition>=3.10" "pyttsx3>=2.90"
|
122
|
-
# Note: speechrecognition may require PyAudio, which might have system-level dependencies.
|
123
|
-
```
|
124
|
-
|
125
|
-
## License
|
126
|
-
|
127
|
-
This project is licensed under the MIT License. See the `LICENSE` file for details.
|
patchllm-0.2.1.dist-info/RECORD
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
patchllm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
patchllm/context.py,sha256=BZxhUUnlwejcY3I5jfIuk9r2xAqgN1eNcOARmD5VLzU,8520
|
3
|
-
patchllm/listener.py,sha256=VjQ_CrSRT4-PolXAAradPKyt8NSUaUQwvgPNH7Oi9q0,968
|
4
|
-
patchllm/main.py,sha256=lwEE98yFULW1C0Lo9i1z5u9_r7zJYPSalWxh8juSRT8,12931
|
5
|
-
patchllm/parser.py,sha256=DNcf9iUH8umExfK78CSIwac1Bbu7K9iE3754y7CvYzs,3229
|
6
|
-
patchllm/utils.py,sha256=hz28hd017gRGT632VQAYLPdX0KAS1GLvZzeUDCKbLc0,647
|
7
|
-
patchllm-0.2.1.dist-info/licenses/LICENSE,sha256=vZxgIRNxffjkTV2NWLemgYjDRu0hSMTyFXCZ1zEWbUc,1077
|
8
|
-
patchllm-0.2.1.dist-info/METADATA,sha256=zbk1TqpmkEbpXV1jtjLP34CYZ_MyDboZCRQ9FTnNCNk,5429
|
9
|
-
patchllm-0.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
10
|
-
patchllm-0.2.1.dist-info/entry_points.txt,sha256=xm-W7FKOQd3o9RgK_4krVnO2sC8phpYxDCobf0htLiU,48
|
11
|
-
patchllm-0.2.1.dist-info/top_level.txt,sha256=SLIZj9EhBXbSnYrbnV8EjL-OfNz-hXRwABCPCjE5Fas,9
|
12
|
-
patchllm-0.2.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|