Spaces:
Runtime error
Runtime error
Create project_patcher.py
Browse files- agent/project_patcher.py +17 -0
agent/project_patcher.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class ProjectPatcher:
|
| 2 |
+
def __init__(self, dry_run=True):
|
| 3 |
+
self.dry_run = dry_run
|
| 4 |
+
|
| 5 |
+
def add_dependency(self, project_path, package, version=None):
|
| 6 |
+
"""Fügt requirements.txt Eintrag hinzu"""
|
| 7 |
+
req_file = Path(project_path) / "requirements.txt"
|
| 8 |
+
entry = f"{package}{f'=={version}' if version else ''}\n"
|
| 9 |
+
|
| 10 |
+
with open(req_file, 'a') as f:
|
| 11 |
+
f.write(entry)
|
| 12 |
+
return f"✅ {package} zu requirements.txt hinzugefügt"
|
| 13 |
+
|
| 14 |
+
def rename_package(self, project_path, old_name, new_name):
|
| 15 |
+
"""Benennt komplettes Package um (Ordner + Imports)"""
|
| 16 |
+
# Alle Python-Dateien durchgehen und Imports aktualisieren
|
| 17 |
+
pass
|