This custom integration uses multiple requirements files to separate different types of dependencies:
Purpose: Python packages needed by the integration at runtime
Installed by: Home Assistant when loading the integration
Also defined in: custom_components/ha_integration_domain/manifest.json
Note: This file is typically empty if this integration has no additional runtime dependencies beyond Home Assistant core.
Example:
aiohttp>=3.8.0
async-timeout>=4.0.0Purpose: JavaScript/Node.js tools used for Markdown formatting and linting
Installed by: script/setup/bootstrap via npm install
Used by: Developers, IDEs, pre-commit hooks
Includes:
prettier- Markdown formatter (also used byesbenp.prettier-vscodeVS Code extension)markdownlint-cli2- Markdown linter (also used bydavidanson.vscode-markdownlintVS Code extension)
Note: These tools are the CLI counterparts of the VS Code extensions already installed in the devcontainer. Having both ensures IDE and CI/pre-commit behaviour is identical.
Purpose: Additional development tools beyond what Home Assistant core provides
Installed by: script/setup/bootstrap
Used by: Developers, IDEs
Includes:
pyright- Type checker (we prefer pyright over HA's mypy for better IDE integration)colorlog- Colored logging for development scripts- Performance tools (
zlib_ng,isal) - Optional optimization packages
Note: Most development tools (ruff, pre-commit, codespell, pylint) are already provided by Home Assistant core's requirements_test.txt and requirements_test_pre_commit.txt, which are installed automatically via script/setup/bootstrap.
Purpose: Additional testing tools beyond what Home Assistant core provides
Installed by: script/setup/bootstrap
Used by: Test runners, CI/CD
Includes:
pytest-homeassistant-custom-component- Additional fixtures and utilities for custom component testing
Note: Core testing tools (pytest, pytest-asyncio, pytest-aiohttp, pytest-cov, pytest-timeout, pytest-xdist, coverage, freezegun, requests-mock, respx) are already provided by Home Assistant core's requirements_test.txt, which is installed automatically via script/setup/bootstrap.
{
"requirements": ["aiohttp>=3.8.0"]
}- ✅ Runtime dependencies for end users
- ✅ Automatically installed by Home Assistant
- ✅ Should match
requirements.txtcontent - ℹ️ Optional: If this integration doesn't need additional packages beyond Home Assistant core, you can omit this field
| Add to | When |
|---|---|
manifest.json + requirements.txt |
Runtime dependency (end users need it) |
requirements_dev.txt |
Python development tool (linting, formatting, type checking) |
requirements_test.txt |
Testing tool (pytest plugins, test utilities) |
package.json |
Node.js development tool (Markdown formatting/linting) |
When you add a runtime dependency:
- ✅ Add to
manifest.jsonrequirementsfield - ✅ Add to
requirements.txt(same version constraint) - ❌ Don't add to
requirements_dev.txtorrequirements_test.txt
Example:
// manifest.json
{
"requirements": ["aiohttp>=3.8.0"]
}# requirements.txt
aiohttp>=3.8.0The script/setup/bootstrap automatically installs dependencies from multiple sources:
Version: Configured via HA_VERSION in .devcontainer/devcontainer.json (currently 2025.12.3)
-
Runtime dependencies (
requirements_all.txt)- All packages that Home Assistant integrations might need
- Includes aiohttp, async-timeout, and hundreds of other packages
-
Test dependencies (
requirements_test.txt)- pytest and all pytest plugins (pytest-asyncio, pytest-aiohttp, pytest-cov, pytest-timeout, pytest-xdist)
- Testing utilities (coverage, freezegun, requests-mock, respx)
- mypy-dev for type checking (we use pyright instead)
-
Pre-commit dependencies (
requirements_test_pre_commit.txt)- ruff (linting and formatting)
- codespell (spell checking)
- pre-commit (hook framework)
- pylint (linting)
-
Home Assistant core (
homeassistant==$HA_VERSION)- The full Home Assistant installation
requirements_dev.txt- Additional development tools this project uses (pyright, colorlog, performance packages)requirements_test.txt- Custom component testing utilitiesrequirements.txt- This integration's runtime dependencies (if any)package.json- Node.js tools for Markdown linting/formatting (prettier, markdownlint-cli2)
This approach means this project only needs to maintain a minimal set of dependencies that are specific to this integration, while leveraging the comprehensive dependency management from Home Assistant core.
{
"name": "Integration Name",
"homeassistant": "2025.11.0",
"hacs": "2.0.5"
}- ❌ No Python dependencies - only metadata
- ✅ Minimum Home Assistant version
- ✅ Minimum HACS version
{
"requirements": ["package>=1.0.0"]
}- ✅ Python package dependencies
- ✅ Installed by Home Assistant
No duplication needed! hacs.json only contains version constraints for HA/HACS, not Python packages.