Skip to content

VS Code'da Modern Python Geliştirme: Sıfırdan Production-Grade IDE Setup

VS Code 2024'ün en yaygın Python IDE'si. Bu derste sıfırdan başlayıp Python extension, Pylance, debugger, Jupyter, settings.json yapılandırma, multi-root workspace, remote development (WSL/SSH/Container), ve günlük üretkenliği 2x'leyen klavye-shortcut'ları gezeceğiz.

Şükrü Yusuf KAYA
22 min read
Beginner
VS Code'da Modern Python Geliştirme: Sıfırdan Production-Grade IDE Setup
💻 VS Code neden bu kadar yaygın?
Microsoft 2015'te VS Code'u açık kaynak olarak çıkardı. 9 yıl sonra Stack Overflow Developer Survey'de '#1 IDE'. Sebep tek değil — ücretsiz olması, hızlı, hafif, devasa extension marketplace, AI entegrasyonu (Copilot/Claude Code/Cursor). Python ekosisteminde VS Code + Pylance kombinasyonu de facto standart oldu.

Kurulum#

macOS#

# Homebrew brew install --cask visual-studio-code # Veya direkt indirip .app sürükle # https://code.visualstudio.com/download

Windows#

code.visualstudio.com/download — installer'ı indir, çalıştır. "Add to PATH" seçeneğini işaretle (default işaretli ama kontrol et).
# Winget (önerilen) winget install -e --id Microsoft.VisualStudioCode

Linux#

# Ubuntu/Debian sudo apt install software-properties-common apt-transport-https wget wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/ sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/trusted.gpg.d/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list' sudo apt update sudo apt install code # Fedora sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc sudo sh -c 'echo -e "[code]\nname=Visual Studio Code\nbaseurl=https://packages.microsoft.com/yumrepos/vscode\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/vscode.repo' sudo dnf install code

İlk açılış#

# Komut satırından bir klasör aç code . # mevcut klasör code ~/projects/myapp # belirli klasör code file.py # tek dosya
code
komutu PATH'inde yoksa: VS Code aç → Cmd/Ctrl+Shift+P → "Shell Command: Install 'code' command in PATH".

Olmazsa olmaz extension'lar#

VS Code çıplak halde sadece bir text editor. Extension'larla Python IDE'sine dönüşüyor. İlk gün kurman gerekenler:
ExtensionYayıncıNe işe yarar
PythonMicrosoftResmi Python desteği — debugger, IntelliSense, linting, formatting
PylanceMicrosoftMicrosoft'un Python language server'ı — autocomplete, type checking
Python DebuggerMicrosoftdebugpy entegrasyonu (Python ile birlikte gelir genelde)
JupyterMicrosoft.ipynb notebook'larını VS Code'da aç, çalıştır
RuffAstralModern lint + format (flake8 + isort + black yerine)
Even Better TOMLtamasfepyproject.toml syntax highlight

Önerilenler (kalite hayatı)#

ExtensionNe yapar
Error LensHataları satır içinde inline gösterir
GitLensGit history, blame, diff için süper güçler
Code Spell CheckerYazım denetimi (kod ve yorumlarda)
Path IntellisensePath autocomplete (open, import içinde)
autoDocstringFonksiyon docstring template otomatik üret
Python IndentIndent davranışını PEP 8'e uygun yap
Material Icon ThemeDaha güzel dosya ikonları (görsel rahatlık)

Kurulum (komut satırından)#

code --install-extension ms-python.python code --install-extension ms-python.vscode-pylance code --install-extension ms-toolsai.jupyter code --install-extension charliermarsh.ruff code --install-extension tamasfe.even-better-toml code --install-extension usernamehw.errorlens code --install-extension eamodio.gitlens code --install-extension streetsidesoftware.code-spell-checker code --install-extension christian-kohler.path-intellisense code --install-extension njpwerner.autodocstring
Bu listeyi bir
extensions.txt
dosyasında tut, yeni makinede tek seferde kur.

Python interpreter seçimi — VS Code'un en kritik adımı#

Bir VS Code klasör açtın. Python extension yüklü. Şimdi VS Code "hangi Python kullanacağım?" diye soruyor.
Cmd/Ctrl + Shift + P → "Python: Select Interpreter"
Karşına bir liste çıkar:
Python 3.13.0 ('myproject': venv) /Users/me/myproject/venv/bin/python Python 3.13.0 /Users/me/.pyenv/versions/3.13.0/bin/python Python 3.12.7 /Users/me/.pyenv/versions/3.12.7/bin/python Python 3.10.13 /Users/me/.pyenv/versions/3.10.13/bin/python Python 3.9.6 /usr/bin/python3 (system)
VS Code otomatik olarak şunları tespit eder:
  • pyenv kurulumları
  • Klasördeki
    venv/
    ve
    .venv/
    virtualenv'leri
  • conda environment'ları
  • System Python
Doğru seçim: Projende virtualenv varsa onu seç.
.venv
klasörü varsa VS Code'un otomatik default olarak seçeceği şey budur.
Seçtiğinde:
  • VS Code alt status bar'da seçili Python sürümünü gösterir.
  • Tüm IntelliSense, debugger, terminal aktiviteleri o Python'a göre çalışır.
  • Yeni terminal açtığında otomatik virtualenv aktif olur.

Workspace ayarı kalıcı yap#

// .vscode/settings.json { "python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python" }
Bu dosya repo ile birlikte git'e ekleniyor — takım arkadaşların aynı interpreter ayarını alıyor.

settings.json — VS Code'u yontmak#

VS Code iki tip ayar kullanır:
  • User settings (
    ~/.config/Code/User/settings.json
    ): Tüm projelerde geçerli, kişisel.
  • Workspace settings (
    .vscode/settings.json
    ): Sadece bu klasörde, takımla paylaşılan.
Cmd/Ctrl + ,
ile UI ayar editörünü aç, sağ üstte
{}
ikonuna tıkla → JSON modunda aç.

Önerilen Python ayarları (workspace settings)#

{ "// Python core": "", "python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python", "python.terminal.activateEnvironment": true, "python.analysis.typeCheckingMode": "basic", "python.analysis.autoImportCompletions": true, "python.analysis.diagnosticMode": "openFilesOnly", "// Linting & formatting (ruff)": "", "[python]": { "editor.defaultFormatter": "charliermarsh.ruff", "editor.formatOnSave": true, "editor.codeActionsOnSave": { "source.fixAll.ruff": "explicit", "source.organizeImports.ruff": "explicit" } }, "// Test (pytest)": "", "python.testing.pytestEnabled": true, "python.testing.unittestEnabled": false, "python.testing.pytestArgs": ["tests"], "// Editor genel": "", "editor.rulers": [88, 100], "editor.formatOnSave": true, "editor.tabSize": 4, "editor.insertSpaces": true, "files.insertFinalNewline": true, "files.trimTrailingWhitespace": true, "// Excludes": "", "files.exclude": { "**/__pycache__": true, "**/.pytest_cache": true, "**/.ruff_cache": true, "**/*.pyc": true } }
Bu ayar setiyle her dosya kaydında:
  • Ruff otomatik formatlar (black-uyumlu).
  • Import'lar otomatik sıralanır.
  • Trailing whitespace temizlenir.
  • Final newline eklenir.

.vscode/extensions.json ile takım extension önerisi#

{ "recommendations": [ "ms-python.python", "ms-python.vscode-pylance", "ms-toolsai.jupyter", "charliermarsh.ruff", "tamasfe.even-better-toml" ] }
Repo'yu açan biri "Recommended Extensions" notification görür, tek tıkla hepsini kurar.

Debugger — IDE'nin gerçek değeri#

print()
ile hata aramak için saatler harcadıysan, debugger seni 2x hızlandırır. VS Code'un Python debugger'ı debugpy üzerine kurulu — modern, hızlı.

Hızlı debug#

Sol tarafta Run and Debug ikonuna tıkla (veya
Cmd/Ctrl + Shift + D
).
F5
ile mevcut dosyayı debug modda çalıştır.
İlk seferinde "Python File" seçeneğini seç. VS Code mevcut dosyayı interpreter'la başlatır.

Breakpoint koyma#

  • Satır numarası soluna tıkla → kırmızı nokta (breakpoint).
  • F9 ile shortcut.
Debug başlatıldığında o satıra geldiğinde durur. Şimdi:
TuşNe yapar
F10Step over (sonraki satıra, fonksiyona inme)
F11Step into (fonksiyon içine in)
Shift+F11Step out (mevcut fonksiyondan çık)
F5Continue (sonraki breakpoint'e koş)
Shift+F5Stop
Ctrl+Shift+F5Restart

Variables, Watch, Call Stack#

Debug panelinde sol kenar:
  • Variables: Mevcut scope'taki değişkenler — fareyi nesnenin üzerine getir, içeriğini gör.
  • Watch: Manuel "şu değişkene gözüm olsun" listesi.
  • Call Stack: Şu an hangi fonksiyondasın, nereden çağrıldı.
  • Breakpoints: Tüm breakpoint'lerin listesi.
  • Debug Console: Debug çalışırken Python ifadesi yaz, çalıştır.

launch.json — gelişmiş debug konfigürasyonu#

// .vscode/launch.json { "version": "0.2.0", "configurations": [ { "name": "Python: Current File", "type": "debugpy", "request": "launch", "program": "${file}", "console": "integratedTerminal", "justMyCode": true }, { "name": "Python: Module", "type": "debugpy", "request": "launch", "module": "myapp.main", "args": ["--verbose", "--config", "dev.toml"], "env": { "DEBUG": "1", "DATABASE_URL": "sqlite:///dev.db" }, "console": "integratedTerminal" }, { "name": "FastAPI: dev server", "type": "debugpy", "request": "launch", "module": "uvicorn", "args": ["myapp.main:app", "--reload", "--port", "8000"], "jinja": true, "console": "integratedTerminal" }, { "name": "Python: Pytest current file", "type": "debugpy", "request": "launch", "module": "pytest", "args": ["${file}", "-v"], "console": "integratedTerminal" }, { "name": "Python: Attach to running process", "type": "debugpy", "request": "attach", "connect": {"host": "localhost", "port": 5678} } ] }
Bu konfigürasyonlar projendeki farklı debug senaryolarını tek dropdown'dan seçilebilir hale getiriyor.
justMyCode: false
yaparsan, kütüphane kodlarına da girebilirsin — debugger Python'un her satırını izler. Standart kütüphaneyi öğrenmek için harika.

Jupyter Notebook desteği#

VS Code'un Jupyter extension'ı, .ipynb dosyalarını doğrudan IDE'de açıyor. JupyterLab açmana gerek yok.
File → New File → ".ipynb"
veya mevcut bir .ipynb dosyasını aç. VS Code render ediyor:
  • Cell'ler arası geçiş (J/K vim-like, veya ↑/↓)
  • Run cell (Shift+Enter)
  • Markdown rendering
  • Plot inline
  • Variable explorer (sol panelde)

Kernel seçimi#

Notebook açtığında sağ üstte "Select Kernel" → mevcut Python interpreter'ları + jupyter kernel'ları listelenir. Seçtiğinde her cell o ortamda çalışır.

Interactive Window — notebook olmadan notebook deneyimi#

.py
dosyalarında
# %%
ile blok başlatabilirsin:
# %% import pandas as pd df = pd.read_csv("data.csv") df.head() # %% df.groupby("region").sum() # %% import matplotlib.pyplot as plt df["amount"].plot(kind="hist") plt.show()
Her
# %%
bloğu üstündeki "Run Cell" butonuna tıkla — interactive window açılır, blok orada çalışır. Notebook'un avantajları .py dosyasında.
Bu yaklaşım modern data scientist'lerin tercih ettiği yol — git diff güzel çalışır, IDE features tam, ama notebook esnekliği var.

Tasks ile özel komutlar#

VS Code'da
tasks.json
ile sıkça çalıştırdığın komutları kısayollara bağlayabilirsin.
// .vscode/tasks.json { "version": "2.0.0", "tasks": [ { "label": "Run tests", "type": "shell", "command": "${workspaceFolder}/.venv/bin/pytest", "args": ["-v", "tests/"], "group": { "kind": "test", "isDefault": true }, "presentation": { "reveal": "always", "panel": "new" } }, { "label": "Format with ruff", "type": "shell", "command": "ruff", "args": ["format", "src/", "tests/"] }, { "label": "Type check with mypy", "type": "shell", "command": "mypy", "args": ["src/"] }, { "label": "Start dev server", "type": "shell", "command": "uvicorn", "args": ["myapp.main:app", "--reload"], "isBackground": true } ] }
Cmd/Ctrl+Shift+P → "Tasks: Run Task" ile listeyi gör, çalıştır. Default test task'ına Cmd/Ctrl+Shift+B kısayolu otomatik atanır.

Remote development — uzak ortamlarda yerel deneyim#

VS Code'un en güçlü özelliklerinden biri: uzaktaki bir bilgisayara/container'a/WSL'e bağlanıp orada çalışmak, ama IDE'nin yerel olduğu kadar hızlı kalmak.

1. Remote - SSH#

Uzak Linux sunucuna SSH ile bağlan, dosyaları orada düzenle, kod çalıştır:
# SSH config'in olduğunu varsayıyorum (~/.ssh/config) Host myserver HostName 192.168.1.100 User ubuntu IdentityFile ~/.ssh/id_ed25519
VS Code: Cmd/Ctrl+Shift+P → "Remote-SSH: Connect to Host" → myserver. Yeni VS Code window açılır, sunucuya bağlı.
Avantaj: Sunucudaki Python, env, paketler hepsi yerel gibi. Local makinende büyük bağımlılıkları kurmaya gerek yok.

2. Remote - WSL (Windows kullanıcılar için)#

Windows'tasen ama WSL'de Linux Python kullanıyorsan: VS Code WSL extension ile bağlan, hem Windows GUI'sini hem Linux ortamı al.
wsl # WSL terminal'inde code . # mevcut klasörü VS Code'la WSL bağlantılı aç

3. Remote - Containers (Dev Containers)#

Bir
.devcontainer/devcontainer.json
dosyası ile bütün geliştirme ortamını Docker container'ında tut:
{ "name": "Python 3.13 dev", "image": "mcr.microsoft.com/devcontainers/python:3.13", "features": { "ghcr.io/devcontainers/features/git:1": {} }, "customizations": { "vscode": { "extensions": [ "ms-python.python", "ms-python.vscode-pylance", "charliermarsh.ruff" ], "settings": { "python.defaultInterpreterPath": "/usr/local/bin/python" } } }, "postCreateCommand": "pip install -r requirements.txt" }
Repo'yu klonladıktan sonra "Reopen in Container" ile container içinde çalış. Hiçbir şey local makinena kurman gerekmez. Takım arkadaşların da aynı ortamda çalışıyor.

4. GitHub Codespaces#

Tarayıcıda VS Code — GitHub'da repo aç, "Open in Codespace" → bulutta tam VS Code instance'ı. Local kurulum sıfır.
Sadece GitHub paid hesabı için mevcut (ücretsiz quota var). Demo, eğitim, geçici developmentler için ideal.

Hayatını değiştirecek 20 klavye kısayolu#

VS Code'un asıl gücü klavyede. Mouse'a uzanmadan çalışmak hızı 2x'liyor.
KısayolNe yapar
Cmd/Ctrl + PDosya hızlı açma
Cmd/Ctrl + Shift + PKomut paleti (her şey burada)
Cmd/Ctrl + ,Settings
Cmd/Ctrl + Shift + EExplorer (dosya gezgini) toggle
Cmd/Ctrl + Shift + FKlasör genelinde arama
Cmd/Ctrl + Shift + GGit panel
Cmd/Ctrl + Shift + DDebug panel
Cmd/Ctrl + BSidebar göster/gizle
Cmd/Ctrl + `Terminal aç/gizle
Cmd/Ctrl + Shift + `Yeni terminal
Cmd/Ctrl + WTab kapat
Cmd/Ctrl + Shift + TSon kapatılan tab'ı geri aç
Cmd/Ctrl + K, Cmd/Ctrl + SKlavye kısayolları (öğren!)
F12Tanıma git (go to definition)
Alt + ←Geri (history)
Cmd/Ctrl + .Quick fix (lint düzeltme öner)
Cmd/Ctrl + DMevcut kelimeyi çoklu seç
Alt + ↑/↓Satırı yukarı/aşağı taşı
Cmd/Ctrl + /Satırı yorum yap
F2Rename (her yerde)
İlk hafta bunlar yorucu gelir, ikinci hafta kasınla kullanırsın, üçüncü hafta bilinçsizce yapıyor olursun.

Bu derste neler kazandın?#

✓ VS Code'u 3 platform için kurma yolları.
6 essential extension + 7 önerilen liste.
Python interpreter seçimi ve workspace settings ile kalıcı yapma.
settings.json ile Python-spesifik konfigürasyon (ruff format-on-save, test runner, vs).
Debugger — breakpoint, step over/into, variables panel, launch.json ile gelişmiş senaryolar.
Jupyter Notebook desteği +
# %%
ile interactive window pattern'ı.
tasks.json ile sık çalıştırılan komutlar.
Remote development — SSH, WSL, Dev Containers, Codespaces.
20 klavye kısayolu — günlük üretkenlik 2x.
Sıradaki ders: VS Code'un en büyük rakibi olan PyCharm'a bakacağız. Community ve Professional sürümler arasındaki fark, hangi senaryoda PyCharm seçilir, JetBrains ekosisteminin avantajları, ve "VS Code mu PyCharm mı?" tartışmasının pragmatik cevabı.

Frequently Asked Questions

Olası sebepler: (1) Pylance extension'ı kurmamış olabilirsin (Microsoft Python paketi otomatik öneriyor ama bazen atlanıyor). (2) Python interpreter seçilmemiş — Cmd/Ctrl+Shift+P → 'Python: Select Interpreter' ile seç. (3) Pylance hâlâ index'liyor — büyük projede ilk açılışta 30sn-2dk sürebilir, sağ alt status bar'da progress var. (4) Type stubs eksik — `pip install types-requests` gibi paketin stub'unu kur.

Yorumlar & Soru-Cevap

(0)
Yorum yazmak için giriş yap.
Yorumlar yükleniyor...

Related Content