-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfilter_outdated.py
33 lines (25 loc) · 1.12 KB
/
filter_outdated.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import subprocess
import toml
# Lese die pyproject.toml Datei
with open("pyproject.toml", "r") as file:
pyproject = toml.load(file)
# Extrahiere direkte Abhängigkeiten
dependencies = pyproject.get("tool", {}).get("poetry", {}).get("dependencies", {})
dev_dependencies = (
pyproject.get("tool").get("poetry").get("group").get("dev", {}).get("dependencies", {})
)
# Kombiniere alle Abhängigkeiten
direct_dependencies = set(dependencies.keys()).union(set(dev_dependencies.keys()))
# Führe den Befehl 'poetry show --outdated' aus und speichere die Ausgabe
result = subprocess.run(["poetry", "show", "--outdated"], capture_output=True, text=True)
# Filtere nur die Pakete, die in den direkten Abhängigkeiten stehen
outdated_packages = result.stdout.splitlines()
filtered_outdated = [
line for line in outdated_packages if line.split()[0] in direct_dependencies
]
# Ausgabe der veralteten direkten Abhängigkeiten
print("Veraltete direkte Abhängigkeiten:")
for package in filtered_outdated:
print(package)