clapp-pm 1.0.17__tar.gz → 1.0.19__tar.gz
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.
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/PKG-INFO +1 -1
- clapp_pm-1.0.19/apps/test-app/README.md +51 -0
- clapp_pm-1.0.19/apps/test-app/main.py +55 -0
- clapp_pm-1.0.19/apps/test-app/manifest.json +15 -0
- clapp_pm-1.0.19/cache_manager.py +376 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/clapp_pm.egg-info/SOURCES.txt +32 -1
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/clapp_pm.egg-info/top_level.txt +7 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/cli_commands.py +5 -1
- clapp_pm-1.0.19/docs/developer_guide.md +361 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/main.py +192 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/manifest_schema.py +20 -5
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/manifest_validator.py +3 -3
- clapp_pm-1.0.19/new_command.py +181 -0
- clapp_pm-1.0.19/package_runner.py +187 -0
- clapp_pm-1.0.19/package_signing.py +148 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/requirements.txt +7 -1
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/setup.py +4 -0
- clapp_pm-1.0.19/smart_search.py +451 -0
- clapp_pm-1.0.19/templates/dart/manifest.json +11 -0
- clapp_pm-1.0.19/templates/lua/manifest.json +11 -0
- clapp_pm-1.0.19/templates/python/README.md +51 -0
- clapp_pm-1.0.19/templates/python/main.py +55 -0
- clapp_pm-1.0.19/templates/python/manifest.json +11 -0
- clapp_pm-1.0.19/test-app/README.md +51 -0
- clapp_pm-1.0.19/test-app/main.py +55 -0
- clapp_pm-1.0.19/test-app/manifest.json +15 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/version.json +1 -1
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/version.py +1 -1
- clapp_pm-1.0.19/version_manager.py +351 -0
- clapp_pm-1.0.17/package_runner.py +0 -87
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/CHANGELOG.md +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/GITHUB_SETUP.md +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/LICENSE +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/MANIFEST.in +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/PYPI_UPLOAD.md +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/README.md +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/advanced_test.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/backup_current/build_index.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/backup_current/check_env.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/backup_current/clapp_core.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/backup_current/clean_command.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/backup_current/cli_commands.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/backup_current/dependency_resolver.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/backup_current/doctor_command.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/backup_current/info_command.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/backup_current/install_command.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/backup_current/installer.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/backup_current/list_command.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/backup_current/main.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/backup_current/manifest_schema.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/backup_current/manifest_validator.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/backup_current/package_registry.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/backup_current/package_runner.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/backup_current/post_install_hint.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/backup_current/publish_command.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/backup_current/remote_registry.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/backup_current/setup.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/backup_current/system_test.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/backup_current/uninstall_command.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/backup_current/validate_command.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/backup_current/version.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/backup_current/version_command.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/backup_current/where_command.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/build_index.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/check_env.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/clapp-packages-repo/README.md +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/clapp-packages-repo/index.json +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/clapp-packages-repo/packages/hello-python/main.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/clapp-packages-repo/packages/hello-python/manifest.json +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/clapp-packages-repo/packages/test-app/main.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/clapp-packages-repo/packages/test-app/manifest.json +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/clapp-packages-repo/packages/test-app2/main.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/clapp-packages-repo/packages/test-app2/manifest.json +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/clapp-packages-repo/packages.json +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/clapp_app_structure.md +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/clapp_core.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/clapp_pm.egg-info/dependency_links.txt +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/clapp_pm.egg-info/entry_points.txt +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/clapp_pm.egg-info/requires.txt +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/clean_command.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/dependency_resolver.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/deploy.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/doctor_command.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/index.json +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/info_command.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/install_command.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/installer.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/list_command.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/package_registry.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/packages/hello-python/main.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/packages/hello-python/manifest.json +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/packages/test-app/main.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/packages/test-app/manifest.json +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/packages/test-app2/main.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/packages/test-app2/manifest.json +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/post_install_hint.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/publish_command.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/pyproject.toml +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/remote_registry.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/setup.cfg +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/system_test.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/uninstall_command.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/validate_command.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/version_command.py +0 -0
- {clapp_pm-1.0.17 → clapp_pm-1.0.19}/where_command.py +0 -0
@@ -0,0 +1,51 @@
|
|
1
|
+
# Hello Python - clapp Örnek Uygulaması
|
2
|
+
|
3
|
+
Bu uygulama, clapp için Python uygulaması geliştirme örneğidir.
|
4
|
+
|
5
|
+
## 🚀 Özellikler
|
6
|
+
|
7
|
+
- Basit kullanıcı etkileşimi
|
8
|
+
- Hata yönetimi
|
9
|
+
- Sistem bilgileri gösterimi
|
10
|
+
- Matematik işlemleri
|
11
|
+
|
12
|
+
## 📦 Kurulum
|
13
|
+
|
14
|
+
```bash
|
15
|
+
# Uygulamayı yükle
|
16
|
+
clapp install ./hello-python
|
17
|
+
|
18
|
+
# Uygulamayı çalıştır
|
19
|
+
clapp run hello-python
|
20
|
+
```
|
21
|
+
|
22
|
+
## 🧪 Test
|
23
|
+
|
24
|
+
```bash
|
25
|
+
# Uygulamayı doğrula
|
26
|
+
clapp validate ./hello-python
|
27
|
+
|
28
|
+
# Bağımlılıkları kontrol et
|
29
|
+
clapp dependency check hello-python
|
30
|
+
```
|
31
|
+
|
32
|
+
## 📁 Dosya Yapısı
|
33
|
+
|
34
|
+
```
|
35
|
+
hello-python/
|
36
|
+
├── manifest.json # Uygulama manifesti
|
37
|
+
├── main.py # Ana uygulama dosyası
|
38
|
+
└── README.md # Bu dosya
|
39
|
+
```
|
40
|
+
|
41
|
+
## 🔧 Geliştirme
|
42
|
+
|
43
|
+
Bu şablonu kendi uygulamanız için kullanabilirsiniz:
|
44
|
+
|
45
|
+
1. `manifest.json` dosyasındaki `name` alanını değiştirin
|
46
|
+
2. `main.py` dosyasını kendi kodunuzla değiştirin
|
47
|
+
3. Gerekirse `requirements.txt` ekleyin
|
48
|
+
|
49
|
+
## 📝 Lisans
|
50
|
+
|
51
|
+
MIT License
|
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
Hello Python - clapp Örnek Uygulaması
|
4
|
+
|
5
|
+
Bu uygulama clapp için Python uygulaması geliştirme örneğidir.
|
6
|
+
"""
|
7
|
+
|
8
|
+
import sys
|
9
|
+
import os
|
10
|
+
from datetime import datetime
|
11
|
+
|
12
|
+
def main():
|
13
|
+
"""Ana fonksiyon"""
|
14
|
+
print("=" * 50)
|
15
|
+
print("🚀 Hello Python - clapp Örnek Uygulaması")
|
16
|
+
print("=" * 50)
|
17
|
+
|
18
|
+
# Temel bilgiler
|
19
|
+
print(f"📅 Tarih: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
|
20
|
+
print(f"🐍 Python Sürümü: {sys.version}")
|
21
|
+
print(f"📁 Çalışma Dizini: {os.getcwd()}")
|
22
|
+
|
23
|
+
# Kullanıcı etkileşimi
|
24
|
+
name = input("\n👋 Adınızı girin: ")
|
25
|
+
if name.strip():
|
26
|
+
print(f"Merhaba {name}! clapp'e hoş geldiniz!")
|
27
|
+
else:
|
28
|
+
print("Merhaba! clapp'e hoş geldiniz!")
|
29
|
+
|
30
|
+
# Örnek işlemler
|
31
|
+
print("\n🔢 Basit Hesaplama Örneği:")
|
32
|
+
try:
|
33
|
+
a = float(input("Birinci sayıyı girin: "))
|
34
|
+
b = float(input("İkinci sayıyı girin: "))
|
35
|
+
|
36
|
+
print(f"Toplam: {a + b}")
|
37
|
+
print(f"Çarpım: {a * b}")
|
38
|
+
print(f"Bölüm: {a / b if b != 0 else 'Tanımsız'}")
|
39
|
+
|
40
|
+
except ValueError:
|
41
|
+
print("❌ Geçersiz sayı girişi!")
|
42
|
+
except ZeroDivisionError:
|
43
|
+
print("❌ Sıfıra bölme hatası!")
|
44
|
+
|
45
|
+
print("\n✅ Uygulama başarıyla tamamlandı!")
|
46
|
+
print("=" * 50)
|
47
|
+
|
48
|
+
if __name__ == "__main__":
|
49
|
+
try:
|
50
|
+
main()
|
51
|
+
except KeyboardInterrupt:
|
52
|
+
print("\n\n👋 Uygulama kullanıcı tarafından sonlandırıldı.")
|
53
|
+
except Exception as e:
|
54
|
+
print(f"\n❌ Beklenmeyen hata: {e}")
|
55
|
+
sys.exit(1)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
{
|
2
|
+
"name": "test-app",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"language": "python",
|
5
|
+
"entry": "main.py",
|
6
|
+
"description": "Basit bir Python Hello World uygulaması",
|
7
|
+
"author": "clapp Developer",
|
8
|
+
"license": "MIT",
|
9
|
+
"tags": [
|
10
|
+
"example",
|
11
|
+
"hello",
|
12
|
+
"python"
|
13
|
+
],
|
14
|
+
"category": "demo"
|
15
|
+
}
|
@@ -0,0 +1,376 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
cache_manager.py - Performans Optimizasyonu ve Önbellekleme Sistemi
|
4
|
+
|
5
|
+
Bu modül clapp'in performansını artırmak için:
|
6
|
+
- Paket meta verilerini önbellekleme
|
7
|
+
- Registry verilerini önbellekleme
|
8
|
+
- Dosya checksum'larını önbellekleme
|
9
|
+
- Akıllı cache yönetimi
|
10
|
+
- Paralel indirme desteği
|
11
|
+
"""
|
12
|
+
|
13
|
+
import os
|
14
|
+
import json
|
15
|
+
import hashlib
|
16
|
+
import pickle
|
17
|
+
import threading
|
18
|
+
import time
|
19
|
+
from pathlib import Path
|
20
|
+
from typing import Dict, Any, Optional, List, Tuple
|
21
|
+
from datetime import datetime, timedelta
|
22
|
+
import concurrent.futures
|
23
|
+
import requests
|
24
|
+
from functools import wraps
|
25
|
+
|
26
|
+
class CacheManager:
|
27
|
+
"""Akıllı önbellekleme yöneticisi"""
|
28
|
+
|
29
|
+
def __init__(self, cache_dir: Optional[str] = None):
|
30
|
+
"""
|
31
|
+
CacheManager başlatıcısı
|
32
|
+
|
33
|
+
Args:
|
34
|
+
cache_dir: Cache dizini (varsayılan: ~/.clapp/cache)
|
35
|
+
"""
|
36
|
+
if cache_dir is None:
|
37
|
+
cache_dir = os.path.join(os.path.expanduser("~"), ".clapp", "cache")
|
38
|
+
|
39
|
+
self.cache_dir = Path(cache_dir)
|
40
|
+
self.cache_dir.mkdir(parents=True, exist_ok=True)
|
41
|
+
|
42
|
+
# Cache türleri
|
43
|
+
self.metadata_cache = self.cache_dir / "metadata"
|
44
|
+
self.registry_cache = self.cache_dir / "registry"
|
45
|
+
self.checksum_cache = self.cache_dir / "checksums"
|
46
|
+
self.download_cache = self.cache_dir / "downloads"
|
47
|
+
|
48
|
+
# Cache dizinlerini oluştur
|
49
|
+
for cache_path in [self.metadata_cache, self.registry_cache,
|
50
|
+
self.checksum_cache, self.download_cache]:
|
51
|
+
cache_path.mkdir(exist_ok=True)
|
52
|
+
|
53
|
+
# Cache istatistikleri
|
54
|
+
self.stats = {
|
55
|
+
"hits": 0,
|
56
|
+
"misses": 0,
|
57
|
+
"evictions": 0,
|
58
|
+
"size": 0
|
59
|
+
}
|
60
|
+
|
61
|
+
# Thread-safe cache
|
62
|
+
self._lock = threading.Lock()
|
63
|
+
|
64
|
+
def _get_cache_key(self, key: str, cache_type: str = "metadata") -> Path:
|
65
|
+
"""Cache anahtarı için dosya yolu oluşturur"""
|
66
|
+
if cache_type == "metadata":
|
67
|
+
return self.metadata_cache / f"{key}.json"
|
68
|
+
elif cache_type == "registry":
|
69
|
+
return self.registry_cache / f"{key}.json"
|
70
|
+
elif cache_type == "checksum":
|
71
|
+
return self.checksum_cache / f"{key}.txt"
|
72
|
+
elif cache_type == "download":
|
73
|
+
return self.download_cache / f"{key}.zip"
|
74
|
+
else:
|
75
|
+
raise ValueError(f"Geçersiz cache türü: {cache_type}")
|
76
|
+
|
77
|
+
def get(self, key: str, cache_type: str = "metadata", max_age: int = 3600) -> Optional[Any]:
|
78
|
+
"""
|
79
|
+
Cache'den veri alır
|
80
|
+
|
81
|
+
Args:
|
82
|
+
key: Cache anahtarı
|
83
|
+
cache_type: Cache türü
|
84
|
+
max_age: Maksimum yaş (saniye)
|
85
|
+
|
86
|
+
Returns:
|
87
|
+
Cache'lenmiş veri veya None
|
88
|
+
"""
|
89
|
+
cache_file = self._get_cache_key(key, cache_type)
|
90
|
+
|
91
|
+
if not cache_file.exists():
|
92
|
+
self.stats["misses"] += 1
|
93
|
+
return None
|
94
|
+
|
95
|
+
# Dosya yaşını kontrol et
|
96
|
+
file_age = time.time() - cache_file.stat().st_mtime
|
97
|
+
if file_age > max_age:
|
98
|
+
cache_file.unlink()
|
99
|
+
self.stats["misses"] += 1
|
100
|
+
return None
|
101
|
+
|
102
|
+
try:
|
103
|
+
with self._lock:
|
104
|
+
if cache_type in ["metadata", "registry"]:
|
105
|
+
with open(cache_file, 'r', encoding='utf-8') as f:
|
106
|
+
data = json.load(f)
|
107
|
+
elif cache_type == "checksum":
|
108
|
+
with open(cache_file, 'r', encoding='utf-8') as f:
|
109
|
+
data = f.read().strip()
|
110
|
+
else:
|
111
|
+
# Binary dosyalar için pickle kullan
|
112
|
+
with open(cache_file, 'rb') as f:
|
113
|
+
data = pickle.load(f)
|
114
|
+
|
115
|
+
self.stats["hits"] += 1
|
116
|
+
return data
|
117
|
+
|
118
|
+
except Exception as e:
|
119
|
+
print(f"Cache okuma hatası: {e}")
|
120
|
+
cache_file.unlink()
|
121
|
+
self.stats["misses"] += 1
|
122
|
+
return None
|
123
|
+
|
124
|
+
def set(self, key: str, data: Any, cache_type: str = "metadata") -> bool:
|
125
|
+
"""
|
126
|
+
Cache'e veri kaydeder
|
127
|
+
|
128
|
+
Args:
|
129
|
+
key: Cache anahtarı
|
130
|
+
data: Kaydedilecek veri
|
131
|
+
cache_type: Cache türü
|
132
|
+
|
133
|
+
Returns:
|
134
|
+
Başarılıysa True
|
135
|
+
"""
|
136
|
+
cache_file = self._get_cache_key(key, cache_type)
|
137
|
+
|
138
|
+
try:
|
139
|
+
with self._lock:
|
140
|
+
if cache_type in ["metadata", "registry"]:
|
141
|
+
with open(cache_file, 'w', encoding='utf-8') as f:
|
142
|
+
json.dump(data, f, indent=2, ensure_ascii=False)
|
143
|
+
elif cache_type == "checksum":
|
144
|
+
with open(cache_file, 'w', encoding='utf-8') as f:
|
145
|
+
f.write(str(data))
|
146
|
+
else:
|
147
|
+
# Binary dosyalar için pickle kullan
|
148
|
+
with open(cache_file, 'wb') as f:
|
149
|
+
pickle.dump(data, f)
|
150
|
+
|
151
|
+
return True
|
152
|
+
|
153
|
+
except Exception as e:
|
154
|
+
print(f"Cache yazma hatası: {e}")
|
155
|
+
return False
|
156
|
+
|
157
|
+
def delete(self, key: str, cache_type: str = "metadata") -> bool:
|
158
|
+
"""Cache'den veri siler"""
|
159
|
+
cache_file = self._get_cache_key(key, cache_type)
|
160
|
+
|
161
|
+
try:
|
162
|
+
if cache_file.exists():
|
163
|
+
cache_file.unlink()
|
164
|
+
return True
|
165
|
+
return False
|
166
|
+
except Exception:
|
167
|
+
return False
|
168
|
+
|
169
|
+
def clear(self, cache_type: Optional[str] = None) -> int:
|
170
|
+
"""
|
171
|
+
Cache'i temizler
|
172
|
+
|
173
|
+
Args:
|
174
|
+
cache_type: Temizlenecek cache türü (None ise tümü)
|
175
|
+
|
176
|
+
Returns:
|
177
|
+
Silinen dosya sayısı
|
178
|
+
"""
|
179
|
+
deleted_count = 0
|
180
|
+
|
181
|
+
if cache_type:
|
182
|
+
cache_path = self._get_cache_key("", cache_type).parent
|
183
|
+
if cache_path.exists():
|
184
|
+
for file in cache_path.iterdir():
|
185
|
+
if file.is_file():
|
186
|
+
file.unlink()
|
187
|
+
deleted_count += 1
|
188
|
+
else:
|
189
|
+
# Tüm cache'leri temizle
|
190
|
+
for cache_path in [self.metadata_cache, self.registry_cache,
|
191
|
+
self.checksum_cache, self.download_cache]:
|
192
|
+
if cache_path.exists():
|
193
|
+
for file in cache_path.iterdir():
|
194
|
+
if file.is_file():
|
195
|
+
file.unlink()
|
196
|
+
deleted_count += 1
|
197
|
+
|
198
|
+
return deleted_count
|
199
|
+
|
200
|
+
def get_stats(self) -> Dict[str, Any]:
|
201
|
+
"""Cache istatistiklerini döndürür"""
|
202
|
+
total_size = 0
|
203
|
+
|
204
|
+
# Cache boyutunu hesapla
|
205
|
+
for cache_path in [self.metadata_cache, self.registry_cache,
|
206
|
+
self.checksum_cache, self.download_cache]:
|
207
|
+
if cache_path.exists():
|
208
|
+
for file in cache_path.iterdir():
|
209
|
+
if file.is_file():
|
210
|
+
total_size += file.stat().st_size
|
211
|
+
|
212
|
+
return {
|
213
|
+
**self.stats,
|
214
|
+
"size_bytes": total_size,
|
215
|
+
"size_mb": round(total_size / (1024 * 1024), 2),
|
216
|
+
"hit_rate": round(self.stats["hits"] / max(1, self.stats["hits"] + self.stats["misses"]) * 100, 2)
|
217
|
+
}
|
218
|
+
|
219
|
+
def calculate_checksum(self, file_path: str) -> str:
|
220
|
+
"""Dosyanın SHA-256 checksum'unu hesaplar ve cache'ler"""
|
221
|
+
cache_key = hashlib.md5(file_path.encode()).hexdigest()
|
222
|
+
cached_checksum = self.get(cache_key, "checksum", max_age=86400) # 24 saat
|
223
|
+
|
224
|
+
if cached_checksum:
|
225
|
+
return cached_checksum
|
226
|
+
|
227
|
+
# Checksum hesapla
|
228
|
+
sha256_hash = hashlib.sha256()
|
229
|
+
with open(file_path, "rb") as f:
|
230
|
+
for chunk in iter(lambda: f.read(4096), b""):
|
231
|
+
sha256_hash.update(chunk)
|
232
|
+
|
233
|
+
checksum = sha256_hash.hexdigest()
|
234
|
+
self.set(cache_key, checksum, "checksum")
|
235
|
+
|
236
|
+
return checksum
|
237
|
+
|
238
|
+
def cache_package_metadata(self, package_path: str, metadata: Dict[str, Any]) -> bool:
|
239
|
+
"""Paket meta verilerini cache'ler"""
|
240
|
+
cache_key = hashlib.md5(package_path.encode()).hexdigest()
|
241
|
+
return self.set(cache_key, metadata, "metadata")
|
242
|
+
|
243
|
+
def get_cached_package_metadata(self, package_path: str) -> Optional[Dict[str, Any]]:
|
244
|
+
"""Cache'lenmiş paket meta verilerini alır"""
|
245
|
+
cache_key = hashlib.md5(package_path.encode()).hexdigest()
|
246
|
+
return self.get(cache_key, "metadata", max_age=3600) # 1 saat
|
247
|
+
|
248
|
+
def cache_registry_data(self, registry_url: str, data: List[Dict[str, Any]]) -> bool:
|
249
|
+
"""Registry verilerini cache'ler"""
|
250
|
+
cache_key = hashlib.md5(registry_url.encode()).hexdigest()
|
251
|
+
return self.set(cache_key, data, "registry")
|
252
|
+
|
253
|
+
def get_cached_registry_data(self, registry_url: str) -> Optional[List[Dict[str, Any]]]:
|
254
|
+
"""Cache'lenmiş registry verilerini alır"""
|
255
|
+
cache_key = hashlib.md5(registry_url.encode()).hexdigest()
|
256
|
+
return self.get(cache_key, "registry", max_age=1800) # 30 dakika
|
257
|
+
|
258
|
+
class ParallelDownloader:
|
259
|
+
"""Paralel indirme yöneticisi"""
|
260
|
+
|
261
|
+
def __init__(self, max_workers: int = 4):
|
262
|
+
"""
|
263
|
+
ParallelDownloader başlatıcısı
|
264
|
+
|
265
|
+
Args:
|
266
|
+
max_workers: Maksimum paralel işçi sayısı
|
267
|
+
"""
|
268
|
+
self.max_workers = max_workers
|
269
|
+
self.session = requests.Session()
|
270
|
+
self.session.headers.update({
|
271
|
+
'User-Agent': 'clapp-package-manager/1.0'
|
272
|
+
})
|
273
|
+
|
274
|
+
def download_file(self, url: str, destination: str) -> Tuple[bool, str]:
|
275
|
+
"""Tek dosya indirir"""
|
276
|
+
try:
|
277
|
+
response = self.session.get(url, stream=True, timeout=30)
|
278
|
+
response.raise_for_status()
|
279
|
+
|
280
|
+
with open(destination, 'wb') as f:
|
281
|
+
for chunk in response.iter_content(chunk_size=8192):
|
282
|
+
f.write(chunk)
|
283
|
+
|
284
|
+
return True, f"Dosya indirildi: {destination}"
|
285
|
+
|
286
|
+
except Exception as e:
|
287
|
+
return False, f"İndirme hatası: {str(e)}"
|
288
|
+
|
289
|
+
def download_files_parallel(self, download_tasks: List[Tuple[str, str]]) -> List[Tuple[bool, str]]:
|
290
|
+
"""
|
291
|
+
Birden fazla dosyayı paralel indirir
|
292
|
+
|
293
|
+
Args:
|
294
|
+
download_tasks: [(url, destination), ...] listesi
|
295
|
+
|
296
|
+
Returns:
|
297
|
+
[(success, message), ...] listesi
|
298
|
+
"""
|
299
|
+
results = []
|
300
|
+
|
301
|
+
with concurrent.futures.ThreadPoolExecutor(max_workers=self.max_workers) as executor:
|
302
|
+
# İndirme görevlerini başlat
|
303
|
+
future_to_task = {
|
304
|
+
executor.submit(self.download_file, url, dest): (url, dest)
|
305
|
+
for url, dest in download_tasks
|
306
|
+
}
|
307
|
+
|
308
|
+
# Sonuçları topla
|
309
|
+
for future in concurrent.futures.as_completed(future_to_task):
|
310
|
+
task = future_to_task[future]
|
311
|
+
try:
|
312
|
+
result = future.result()
|
313
|
+
results.append(result)
|
314
|
+
except Exception as e:
|
315
|
+
results.append((False, f"İndirme hatası: {str(e)}"))
|
316
|
+
|
317
|
+
return results
|
318
|
+
|
319
|
+
# Cache decorator
|
320
|
+
def cached(max_age: int = 3600, cache_type: str = "metadata"):
|
321
|
+
"""Cache decorator'ı"""
|
322
|
+
def decorator(func):
|
323
|
+
@wraps(func)
|
324
|
+
def wrapper(*args, **kwargs):
|
325
|
+
# Cache anahtarı oluştur
|
326
|
+
cache_key = f"{func.__name__}_{hash(str(args) + str(sorted(kwargs.items())))}"
|
327
|
+
|
328
|
+
# Cache manager oluştur
|
329
|
+
cache_manager = CacheManager()
|
330
|
+
|
331
|
+
# Cache'den kontrol et
|
332
|
+
cached_result = cache_manager.get(cache_key, cache_type, max_age)
|
333
|
+
if cached_result is not None:
|
334
|
+
return cached_result
|
335
|
+
|
336
|
+
# Fonksiyonu çalıştır
|
337
|
+
result = func(*args, **kwargs)
|
338
|
+
|
339
|
+
# Sonucu cache'le
|
340
|
+
cache_manager.set(cache_key, result, cache_type)
|
341
|
+
|
342
|
+
return result
|
343
|
+
return wrapper
|
344
|
+
return decorator
|
345
|
+
|
346
|
+
# Yardımcı fonksiyonlar
|
347
|
+
def create_cache_manager() -> CacheManager:
|
348
|
+
"""Varsayılan ayarlarla CacheManager oluşturur"""
|
349
|
+
return CacheManager()
|
350
|
+
|
351
|
+
def create_parallel_downloader(max_workers: int = 4) -> ParallelDownloader:
|
352
|
+
"""ParallelDownloader oluşturur"""
|
353
|
+
return ParallelDownloader(max_workers)
|
354
|
+
|
355
|
+
def get_cache_stats() -> Dict[str, Any]:
|
356
|
+
"""Cache istatistiklerini alır"""
|
357
|
+
cache_manager = create_cache_manager()
|
358
|
+
return cache_manager.get_stats()
|
359
|
+
|
360
|
+
def clear_all_caches() -> int:
|
361
|
+
"""Tüm cache'leri temizler"""
|
362
|
+
cache_manager = create_cache_manager()
|
363
|
+
return cache_manager.clear()
|
364
|
+
|
365
|
+
def download_packages_parallel(package_urls: List[str], destination_dir: str) -> List[Tuple[bool, str]]:
|
366
|
+
"""Paketleri paralel indirir"""
|
367
|
+
downloader = create_parallel_downloader()
|
368
|
+
|
369
|
+
# İndirme görevlerini hazırla
|
370
|
+
download_tasks = []
|
371
|
+
for url in package_urls:
|
372
|
+
filename = os.path.basename(url)
|
373
|
+
destination = os.path.join(destination_dir, filename)
|
374
|
+
download_tasks.append((url, destination))
|
375
|
+
|
376
|
+
return downloader.download_files_parallel(download_tasks)
|
@@ -5,6 +5,7 @@ PYPI_UPLOAD.md
|
|
5
5
|
README.md
|
6
6
|
advanced_test.py
|
7
7
|
build_index.py
|
8
|
+
cache_manager.py
|
8
9
|
check_env.py
|
9
10
|
clapp_app_structure.md
|
10
11
|
clapp_core.py
|
@@ -21,20 +22,24 @@ list_command.py
|
|
21
22
|
main.py
|
22
23
|
manifest_schema.py
|
23
24
|
manifest_validator.py
|
25
|
+
new_command.py
|
24
26
|
package_registry.py
|
25
27
|
package_runner.py
|
28
|
+
package_signing.py
|
26
29
|
post_install_hint.py
|
27
30
|
publish_command.py
|
28
31
|
pyproject.toml
|
29
32
|
remote_registry.py
|
30
33
|
requirements.txt
|
31
34
|
setup.py
|
35
|
+
smart_search.py
|
32
36
|
system_test.py
|
33
37
|
uninstall_command.py
|
34
38
|
validate_command.py
|
35
39
|
version.json
|
36
40
|
version.py
|
37
41
|
version_command.py
|
42
|
+
version_manager.py
|
38
43
|
where_command.py
|
39
44
|
./CHANGELOG.md
|
40
45
|
./GITHUB_SETUP.md
|
@@ -42,6 +47,7 @@ where_command.py
|
|
42
47
|
./README.md
|
43
48
|
./advanced_test.py
|
44
49
|
./build_index.py
|
50
|
+
./cache_manager.py
|
45
51
|
./check_env.py
|
46
52
|
./clapp_app_structure.md
|
47
53
|
./clapp_core.py
|
@@ -58,20 +64,27 @@ where_command.py
|
|
58
64
|
./main.py
|
59
65
|
./manifest_schema.py
|
60
66
|
./manifest_validator.py
|
67
|
+
./new_command.py
|
61
68
|
./package_registry.py
|
62
69
|
./package_runner.py
|
70
|
+
./package_signing.py
|
63
71
|
./post_install_hint.py
|
64
72
|
./publish_command.py
|
65
73
|
./remote_registry.py
|
66
74
|
./requirements.txt
|
67
75
|
./setup.py
|
76
|
+
./smart_search.py
|
68
77
|
./system_test.py
|
69
78
|
./uninstall_command.py
|
70
79
|
./validate_command.py
|
71
80
|
./version.json
|
72
81
|
./version.py
|
73
82
|
./version_command.py
|
83
|
+
./version_manager.py
|
74
84
|
./where_command.py
|
85
|
+
./apps/test-app/README.md
|
86
|
+
./apps/test-app/main.py
|
87
|
+
./apps/test-app/manifest.json
|
75
88
|
./backup_current/build_index.py
|
76
89
|
./backup_current/check_env.py
|
77
90
|
./backup_current/clapp_core.py
|
@@ -112,12 +125,21 @@ where_command.py
|
|
112
125
|
./clapp_pm.egg-info/entry_points.txt
|
113
126
|
./clapp_pm.egg-info/requires.txt
|
114
127
|
./clapp_pm.egg-info/top_level.txt
|
128
|
+
./docs/developer_guide.md
|
115
129
|
./packages/hello-python/main.py
|
116
130
|
./packages/hello-python/manifest.json
|
117
131
|
./packages/test-app/main.py
|
118
132
|
./packages/test-app/manifest.json
|
119
133
|
./packages/test-app2/main.py
|
120
134
|
./packages/test-app2/manifest.json
|
135
|
+
./templates/dart/manifest.json
|
136
|
+
./templates/lua/manifest.json
|
137
|
+
./templates/python/README.md
|
138
|
+
./templates/python/main.py
|
139
|
+
./templates/python/manifest.json
|
140
|
+
./test-app/README.md
|
141
|
+
./test-app/main.py
|
142
|
+
./test-app/manifest.json
|
121
143
|
backup_current/build_index.py
|
122
144
|
backup_current/check_env.py
|
123
145
|
backup_current/clapp_core.py
|
@@ -153,9 +175,18 @@ clapp-packages-repo/packages/test-app/main.py
|
|
153
175
|
clapp-packages-repo/packages/test-app/manifest.json
|
154
176
|
clapp-packages-repo/packages/test-app2/main.py
|
155
177
|
clapp-packages-repo/packages/test-app2/manifest.json
|
178
|
+
docs/developer_guide.md
|
156
179
|
packages/hello-python/main.py
|
157
180
|
packages/hello-python/manifest.json
|
158
181
|
packages/test-app/main.py
|
159
182
|
packages/test-app/manifest.json
|
160
183
|
packages/test-app2/main.py
|
161
|
-
packages/test-app2/manifest.json
|
184
|
+
packages/test-app2/manifest.json
|
185
|
+
templates/dart/manifest.json
|
186
|
+
templates/lua/manifest.json
|
187
|
+
templates/python/README.md
|
188
|
+
templates/python/main.py
|
189
|
+
templates/python/manifest.json
|
190
|
+
test-app/README.md
|
191
|
+
test-app/main.py
|
192
|
+
test-app/manifest.json
|
@@ -1,4 +1,5 @@
|
|
1
1
|
backup_current
|
2
|
+
cache_manager
|
2
3
|
check_env
|
3
4
|
clapp-packages-repo
|
4
5
|
clapp_core
|
@@ -6,6 +7,7 @@ clean_command
|
|
6
7
|
cli_commands
|
7
8
|
dependency_resolver
|
8
9
|
dist
|
10
|
+
docs
|
9
11
|
doctor_command
|
10
12
|
info_command
|
11
13
|
install_command
|
@@ -16,12 +18,17 @@ manifest_schema
|
|
16
18
|
manifest_validator
|
17
19
|
package_registry
|
18
20
|
package_runner
|
21
|
+
package_signing
|
19
22
|
packages
|
20
23
|
post_install_hint
|
21
24
|
publish_command
|
22
25
|
remote_registry
|
26
|
+
smart_search
|
27
|
+
templates
|
28
|
+
test-app
|
23
29
|
uninstall_command
|
24
30
|
validate_command
|
25
31
|
version
|
26
32
|
version_command
|
33
|
+
version_manager
|
27
34
|
where_command
|
@@ -118,7 +118,11 @@ def list_installed_apps(format_type="table", language_filter=None, search_term=N
|
|
118
118
|
tuple: (success: bool, message: str)
|
119
119
|
"""
|
120
120
|
try:
|
121
|
-
output = list_apps(
|
121
|
+
output = list_apps(
|
122
|
+
format_type,
|
123
|
+
language_filter or "",
|
124
|
+
search_term or ""
|
125
|
+
)
|
122
126
|
print(output)
|
123
127
|
return True, "Liste gösterildi"
|
124
128
|
except Exception as e:
|