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:2. Run the Setup Script
Home Assistant provides an automated setup script that configures your development environment:- Create VSCode settings from the default template
- Set up a Python virtual environment in
.venv - Install
uvif not already present - Run
script/bootstrapto install dependencies - Install pre-commit hooks with
prek - Generate a default configuration in the
configdirectory - 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
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/andpylint/directories) - pylint - Custom linting rules (for
homeassistant/andtests/) - hassfest - Validates integration manifests and metadata
Configuration
pyproject.toml
Thepyproject.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
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:http://localhost:8123.
Troubleshooting
Virtual Environment Issues
If commands aren’t found, ensure your virtual environment is activated: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
- Learn about Testing to run and write tests
- Review Code Quality standards
- Read the Contributing Guide before submitting changes
- Check the Developer Documentation for detailed guides