Skip to main content
This guide will help you set up a local development environment for Home Assistant Core.

Prerequisites

  • Python 3.14.2 or higher - Home Assistant Core requires Python 3.14+
  • Git - For cloning the repository and version control
  • uv (recommended) - Fast Python package installer

Initial Setup

1. Fork and Clone the Repository

First, fork the home-assistant/core repository on GitHub, then clone your fork:
Add the upstream repository as a remote:

2. Run the Setup Script

Home Assistant provides an automated setup script that configures your development environment:
This script will:
  • Create VSCode settings from the default template
  • Set up a Python virtual environment in .venv
  • Install uv if not already present
  • Run script/bootstrap to install dependencies
  • Install pre-commit hooks with prek
  • Generate a default configuration in the config directory
  • Configure logging for development

3. Manual Setup (Alternative)

If you prefer manual setup or need more control:

Create a Virtual Environment

Install Dependencies

Install Pre-commit Hooks

Home Assistant uses pre-commit hooks to ensure code quality:

Development Tools

Key Dependencies

Your development environment includes:
  • pytest - Test framework
  • pylint - Python linter with custom Home Assistant plugins
  • ruff - Fast Python linter and formatter
  • mypy - Static type checker
  • prek - Pre-commit hook manager
  • coverage - Code coverage measurement
See requirements_test.txt for the complete list.

Pre-commit Hooks

The following hooks run automatically on commit:
  • ruff-check - Lints code and fixes issues automatically
  • ruff-format - Formats Python code
  • codespell - Catches spelling mistakes
  • yamllint - Validates YAML files
  • prettier - Formats JSON and other files
  • mypy - Type checking (for homeassistant/ and pylint/ directories)
  • pylint - Custom linting rules (for homeassistant/ and tests/)
  • hassfest - Validates integration manifests and metadata
You can run hooks manually:

Configuration

pyproject.toml

The pyproject.toml file contains all project configuration:
  • Build system - Uses setuptools 78.1.1
  • Project metadata - Version, dependencies, and URLs
  • Tool configuration - pylint, pytest, coverage, ruff settings
Key configuration sections:

VSCode Settings

The repository includes recommended VSCode settings in .vscode/settings.default.jsonc. The setup script copies this to .vscode/settings.json if it doesn’t exist.

Running Home Assistant

Once your environment is set up, you can run Home Assistant locally:
Home Assistant will be available at http://localhost:8123.

Troubleshooting

Virtual Environment Issues

If commands aren’t found, ensure your virtual environment is activated:
The script/run-in-env.sh wrapper automatically activates the environment:

Dependency Conflicts

If you encounter dependency issues:

Pre-commit Hook Failures

If pre-commit hooks fail:

Next Steps