7  Development Environment and Tools

This chapter covers setting up Visual Studio Code (VS Code) for Python data science work. A well-configured development environment makes coding more pleasant and efficient. We’ll cover fonts, themes, extensions for formatting and linting, data exploration tools, and productivity enhancements.

Note Videos

This chapter follows my VS Code configuration video for data science.

7.1 Fonts for Coding

Before opening VS Code, choose a good programming font. The right font makes code more readable and reduces eye strain during long sessions. Programming fonts have specific characteristics:

  • Monospace: Every character has the same width, essential for code alignment
  • Distinguishable characters: Clear differences between similar characters like 1, l, I and 0, O
  • Ligatures (optional): Special combined glyphs for common character sequences

Ligatures are combined symbols that appear when certain characters follow each other. For example, -> becomes a proper arrow →, != becomes a not-equal symbol ≠, and >= becomes a greater-than-or-equal symbol ≥. The underlying characters don’t change—your code still contains ->. Ligatures simply render more elegantly on screen. Whether to use ligatures is a personal choice; some developers love them, others find them distracting.

Here are some recommended programming fonts:

  • FiraCode: A popular programming font with excellent readability and comprehensive ligature support. It’s the font used throughout this book.
  • JetBrains Mono: Designed specifically for developers by JetBrains (makers of PyCharm), featuring increased letter height for better readability and distinctive character shapes.
  • Monaspace: A family of programming fonts published by GitHub with several variants optimized for different use cases.
  • Victor Mono: Particularly nice-looking in terminal applications, with a distinctive style that some developers prefer.

All of these fonts are also available as Nerd Fonts versions. Nerd Fonts are patched versions that include additional icons and symbols. While they don’t add anything when coding in an editor, they make many terminal-based tools look nicer by enabling icons for file types, git status, and other visual indicators.

Pick the font that feels right to you, install it on your system, and we’ll configure it in VS Code below.

7.2 VS Code Setup

In this section, I present how I configure VS Code for research and data science work. These are my personal preferences—feel free to adapt them to your own workflow.

7.2.1 Theme and colors

A good color theme makes your editor pleasant to look at during long coding sessions. My favorite is Catppuccin, which offers four variants: one light and three dark.

To install:

  1. Open the Extensions panel (Ctrl+Shift+X or Cmd+Shift+X on Mac)
  2. Search for “Catppuccin for VSCode”
  3. Install the extension
  4. Choose your preferred variant (I use Mocha, the darkest)

Also install Catppuccin Icons for VS Code to get matching file icons in the explorer.

TipConsistent theming

Catppuccin is available for many applications beyond VS Code. If you like the color scheme, check out their website to theme your terminal, browser, and other tools consistently.

7.2.2 Configuring your font

To set your chosen font in VS Code:

  1. Open Settings (Ctrl+, or Cmd+, on Mac)
  2. Search for “font”
  3. In “Editor: Font Family”, enter your font name (e.g., Fira Code)

To enable ligatures, you need to edit the settings JSON directly:

  1. In Settings, search for “Font Ligatures”
  2. Click “Edit in settings.json”
  3. Add or modify:
{
    "editor.fontFamily": "Fira Code",
    "editor.fontLigatures": true
}

Set fontLigatures to false if you prefer not to use them.

7.2.3 Disabling the minimap

The minimap (the code preview on the right side of the editor) takes up space without adding much value for most workflows. To disable it:

  1. Open Settings
  2. Search for “minimap”
  3. Uncheck “Editor: Minimap: Enabled”

7.2.4 Adding a ruler

Ruff (which we’ll install next) limits lines to 88 characters by default. Adding a visual ruler helps you see this limit:

  1. Open Settings and search for “rulers”
  2. Click “Edit in settings.json”
  3. Add:
{
    "editor.rulers": [88]
}

This displays a vertical line at column 88, making it easy to arrange multiple files side by side.

7.3 Extensions

7.3.1 Essential extensions

7.3.1.1 Python extension

The Python extension is fundamental for Python development in VS Code. It provides:

  • IntelliSense (smart code completion)
  • Linting and error detection
  • Debugging support
  • Jupyter notebook integration
  • Test runner integration

Install it from the Extensions panel by searching for “Python” (by Microsoft).

7.3.1.2 Ruff for formatting and linting

Ruff is a fast Python linter and formatter. Install the Ruff extension from the Extensions panel.

To configure automatic formatting on save, add to your settings.json:

{
    "[python]": {
        "editor.formatOnSave": true,
        "editor.defaultFormatter": "charliermarsh.ruff",
        "editor.codeActionsOnSave": {
            "source.organizeImports": "explicit"
        }
    }
}

This configuration:

  • Formats your Python code automatically when you save
  • Uses Ruff as the default formatter
  • Organizes imports (alphabetically, grouped by standard library, third-party, and local imports)
  • Removes unused imports

To enable formatting for Jupyter notebooks as well:

{
    "notebook.formatOnSave.enabled": true
}
NoteWhat Ruff does

Ruff doesn’t change your code’s behavior—it reformats it to follow consistent conventions. For example, it fixes spacing, line breaks, and quote styles. It also removes unused imports and organizes your import statements.

7.3.1.3 Markdown

If you write Markdown documents (notes, README files, documentation), these extensions are useful:

  • markdownlint: Catches formatting issues and enforces consistent style.
  • Markdown All-in-One: Adds productivity features like keyboard shortcuts, table of contents generation, and list editing.
  • Markdown Preview Mermaid Support: Previews Mermaid diagrams in Markdown files. Mermaid is a standard diagramming format supported by GitHub and many documentation tools.

7.3.2 Data science extensions

  • Rainbow CSV: Colorizes CSV files when you open them in VS Code, making it easier to distinguish columns in raw data files.
  • Data Wrangler: A powerful extension for exploring and cleaning pandas DataFrames interactively. When you load data with pandas, you can click “View Data” to open an interactive data explorer, filter and sort data visually, and generate Python code that replicates your data transformations. This extension is particularly valuable for data cleaning and initial data exploration.

7.3.3 Git extensions

VS Code has built-in Git support, but these extensions enhance it:

  • Git Graph: Provides a visual representation of your repository’s branch structure and commit history. It’s essential for understanding complex branching scenarios.
  • GitLens: By GitKraken, adds inline blame annotations showing who changed each line, detailed commit information, and file and line history. The free version includes many useful features; premium features require a subscription.

7.3.4 AI coding assistant

GitHub Copilot provides AI-powered code suggestions as you type. Install the GitHub Copilot extension and sign in with your GitHub account. A free tier is available with some limitations. Students and academics can apply for GitHub Education, which includes Copilot access.

CautionAI tools require verification

While AI assistants can boost productivity, always verify the code they generate. AI models can produce plausible-looking but incorrect code, especially for domain-specific tasks like financial calculations.

7.3.5 Productivity extensions

  • TODO Tree: Scans your project for comments containing TODO or FIXME and displays them in a sidebar panel. This helps you track tasks and issues scattered throughout your codebase.
  • Even Better TOML: Adds syntax highlighting and validation for TOML files. TOML is the standard format for Python configuration files (pyproject.toml), so this extension is useful for any Python project.
  • Vim (VSCodeVim): For keyboard-driven editing without touching the mouse. Vim bindings have a steep learning curve but dramatically increase editing speed once mastered. If you’re new to Vim, also install Learn Vim, which provides an interactive tutorial.

7.3.6 Dev containers

The Dev Containers extension lets you develop inside containerized environments, isolating your project dependencies and keeping your system clean. See the Dev Containers chapter for details on setting this up.

7.4 Complete Settings Reference

Here’s a complete settings.json incorporating the configurations discussed:

{
    "editor.fontFamily": "Fira Code",
    "editor.fontLigatures": true,
    "editor.minimap.enabled": false,
    "editor.rulers": [88],
    "[python]": {
        "editor.formatOnSave": true,
        "editor.defaultFormatter": "charliermarsh.ruff",
        "editor.codeActionsOnSave": {
            "source.organizeImports": "explicit"
        }
    },
    "notebook.formatOnSave.enabled": true
}

You can access your settings file by opening the Command Palette (Ctrl+Shift+P or Cmd+Shift+P) and selecting “Preferences: Open User Settings (JSON)”.