|
| 1 | +# Check File Dependencies |
| 2 | + |
| 3 | +Check File Dependencies, Python projelerinde modül bağımlılıklarını otomatik olarak kontrol eden, yükleyen ve güncelleyen güçlü bir araçtır. |
| 4 | + |
| 5 | +Tek veya çoklu modüllerin yüklü olup olmadığını kontrol eder, eksik olanları otomatik yükler ve sürüm uyumluluğunu doğrular. |
| 6 | + |
| 7 | +Proje geliştirme sürecinde bağımlılık yönetimini otomatikleştirmek için tasarlanmıştır. |
| 8 | + |
| 9 | +> *last_modify: 2025-07-20* |
| 10 | +
|
| 11 | +<br> |
| 12 | + |
| 13 | + |
| 14 | +## Özellikler |
| 15 | +- Tek veya çoklu modül bağımlılık kontrolü |
| 16 | +- Eksik modüllerin otomatik yüklenmesi |
| 17 | +- Sürüm uyumluluğu kontrolü (>=, <=, ==, !=, >, <, ~=) |
| 18 | +- Otomatik modül güncelleme özelliği |
| 19 | +- Detaylı hata yönetimi ve özel exception sınıfları |
| 20 | +- Verbose mod ile detaylı çıktı kontrolü |
| 21 | +- Timeout yönetimi |
| 22 | + |
| 23 | + |
| 24 | +<br> |
| 25 | + |
| 26 | + |
| 27 | +## Gereksinimler |
| 28 | +- Python 3.6 veya üzeri |
| 29 | +- pip package manager |
| 30 | +- İnternet bağlantısı (modül yükleme için) |
| 31 | +- Sadart kütüphane modülleri: `subprocess`, `sys`, `importlib`, `re`, `warnings`, `typing` |
| 32 | + |
| 33 | + |
| 34 | +<br> |
| 35 | + |
| 36 | + |
| 37 | +## Kurulum |
| 38 | +1. Dosyayı `check_file_dependencies.py` olarak kaydedin. |
| 39 | +2. Ekstra bağımlılık gerekmez (sadece standart kütüphane kullanılır). |
| 40 | +3. Import ederek kullanın: |
| 41 | + ```python |
| 42 | + from check_file_dependencies import CheckFileDependencies |
| 43 | + ``` |
| 44 | + |
| 45 | + |
| 46 | +<br> |
| 47 | + |
| 48 | + |
| 49 | +## Kullanım |
| 50 | +1. Modülleri import edin ve CheckFileDependencies sınıfını kullanın. |
| 51 | +2. Kontrol edilecek modül(ler)i belirtin (sürüm gereksinimleri opsiyonel). |
| 52 | +3. Tek modül: `CheckFileDependencies.ensure_module("numpy>=1.20.0")` |
| 53 | +4. Çoklu modül: `CheckFileDependencies.check_multiple_modules(["requests", "pandas>=1.3.0"])` |
| 54 | +5. Sonuç olarak modüller otomatik yüklenecek/güncellenecek ve kontrol edilecektir. |
| 55 | + |
| 56 | + |
| 57 | +<br> |
| 58 | + |
| 59 | + |
| 60 | +## Örnek (Tek Modül) |
| 61 | +```python |
| 62 | +from check_file_dependencies import CheckFileDependencies |
| 63 | + |
| 64 | +# Basit kontrol |
| 65 | +CheckFileDependencies.ensure_module("requests") |
| 66 | + |
| 67 | +# Sürüm belirterek kontrol |
| 68 | +CheckFileDependencies.ensure_module("numpy>=1.20.0") |
| 69 | +CheckFileDependencies.ensure_module("pandas==1.3.5") |
| 70 | +``` |
| 71 | + |
| 72 | +## Örnek (Çoklu Modül) |
| 73 | +```python |
| 74 | +from check_file_dependencies import CheckFileDependencies |
| 75 | + |
| 76 | +# Çoklu modül kontrolü |
| 77 | +modules = ["requests", "numpy>=1.20.0", "matplotlib", "pandas>=1.3.0"] |
| 78 | +results = CheckFileDependencies.check_multiple_modules(modules) |
| 79 | + |
| 80 | +# Sonuçları kontrol et |
| 81 | +failed = [module for module, success in results.items() if not success] |
| 82 | +if failed: |
| 83 | + print(f"Eksik modüller: {', '.join(failed)}") |
| 84 | +else: |
| 85 | + print("Tüm bağımlılıklar hazır!") |
| 86 | +``` |
| 87 | + |
| 88 | +## Örnek (Konfigürasyon) |
| 89 | +```python |
| 90 | +from check_file_dependencies import CheckFileDependencies |
| 91 | + |
| 92 | +# Ayarları değiştir |
| 93 | +CheckFileDependencies.AUTO_UPDATE = False # Otomatik güncelleme kapalı |
| 94 | +CheckFileDependencies.VERBOSE = True # Detaylı çıktı açık |
| 95 | +CheckFileDependencies.TIMEOUT = 120 # 2 dakika timeout |
| 96 | + |
| 97 | +# Kontrol et |
| 98 | +CheckFileDependencies.ensure_module("tensorflow>=2.0.0") |
| 99 | +``` |
| 100 | + |
| 101 | + |
| 102 | +<br> |
| 103 | + |
| 104 | + |
| 105 | +## Desteklenen Sürüm Operatörleri |
| 106 | +- `>=`: Büyük eşit (örn: `numpy>=1.20.0`) |
| 107 | +- `<=`: Küçük eşit (örn: `pandas<=1.5.0`) |
| 108 | +- `==`: Eşit (örn: `requests==2.25.0`) |
| 109 | +- `!=`: Eşit değil (örn: `matplotlib!=3.0.0`) |
| 110 | +- `>`: Büyük (örn: `scipy>1.0.0`) |
| 111 | +- `<`: Küçük (örn: `flask<2.0.0`) |
| 112 | +- `~=`: Uyumlu sürüm (örn: `django~=4.0.0`) |
| 113 | + |
| 114 | + |
| 115 | +<br> |
| 116 | + |
| 117 | + |
| 118 | +## Hata Yönetimi |
| 119 | +```python |
| 120 | +from check_file_dependencies import CheckFileDependencies, DependencyError |
| 121 | + |
| 122 | +try: |
| 123 | + CheckFileDependencies.ensure_module("tensorflow>=2.0.0") |
| 124 | + print("TensorFlow hazır!") |
| 125 | +except DependencyError as e: |
| 126 | + print(f"Bağımlılık hatası: {e}") |
| 127 | +``` |
| 128 | + |
| 129 | + |
| 130 | +<br> |
| 131 | + |
| 132 | + |
| 133 | +## Örnek Çıktı |
| 134 | +``` |
| 135 | +[MODULE] Starting dependency check for 3 modules... |
| 136 | +============================================================ |
| 137 | +[MODULE] ✅ ready to use: requests (v2.28.1) |
| 138 | +[MODULE] ❓ not exist : numpy |
| 139 | +[MODULE] 📥 downloading : numpy>=1.20.0 |
| 140 | +[MODULE] ✅ installed : numpy |
| 141 | +[MODULE] 🔄 updating : matplotlib |
| 142 | +[MODULE] ✅ updated : matplotlib |
| 143 | +============================================================ |
| 144 | +[MODULE] Summary: 3/3 successful |
| 145 | +``` |
| 146 | + |
| 147 | + |
| 148 | +<br> |
| 149 | + |
| 150 | + |
| 151 | +## API Referansı |
| 152 | + |
| 153 | +### CheckFileDependencies.ensure_module() |
| 154 | +```python |
| 155 | +ensure_module(module_name: str, auto_update: bool = None, verbose: bool = None) -> bool |
| 156 | +``` |
| 157 | +Tek bir modülü kontrol eder ve gerekirse yükler. |
| 158 | + |
| 159 | +### CheckFileDependencies.check_multiple_modules() |
| 160 | +```python |
| 161 | +check_multiple_modules(modules_list: List[str], auto_update: bool = None, verbose: bool = None) -> Dict[str, bool] |
| 162 | +``` |
| 163 | +Birden fazla modülü kontrol eder ve sonuçları dict olarak döner. |
| 164 | + |
| 165 | +### CheckFileDependencies.get_installed_version() |
| 166 | +```python |
| 167 | +get_installed_version(module_name: str) -> Optional[str] |
| 168 | +``` |
| 169 | +Yüklü modülün sürümünü döner. |
| 170 | + |
| 171 | +### CheckFileDependencies.compare_versions() |
| 172 | +```python |
| 173 | +compare_versions(current_version: str, required_version: str) -> bool |
| 174 | +``` |
| 175 | +İki sürümü karşılaştırır. |
| 176 | + |
| 177 | + |
| 178 | +<br> |
| 179 | + |
| 180 | + |
| 181 | +## Lisans |
| 182 | +MIT Lisansı (https://opensource.org/licenses/MIT) |
| 183 | + |
| 184 | + |
| 185 | +<br> |
| 186 | + |
| 187 | + |
| 188 | +## Yazar |
| 189 | +- @mefamex (info@mefamex.com) |
| 190 | + - GitHub: [github.com/Mefamex](https://github.com/Mefamex) |
| 191 | + - www: [mefamex.com](https://mefamex.com) |
| 192 | + |
| 193 | + |
| 194 | +<br> |
| 195 | + |
| 196 | + |
| 197 | +## Yasal Uyarı |
| 198 | +Bu yazılım, herhangi bir garanti olmaksızın "olduğu gibi" sağlanmaktadır. Kullanım riski kullanıcıya aittir. Production ortamlarında kullanımdan önce test edilmesi önerilir. |
| 199 | + |
| 200 | + |
| 201 | + |
| 202 | +<br><br><hr> |
| 203 | + |
| 204 | +> Connected : |
| 205 | +><br> - [website/projects](https://mefamex.com/projects) |
| 206 | +><br> - [Github/Mefamex/python-code-snippets](https://github.com/Mefamex/python-code-snippets) |
0 commit comments